From 396a352a0d0bb411dd77789bdf07acef870a07f4 Mon Sep 17 00:00:00 2001 From: Nikolaj Hinnerskov Date: Wed, 9 Aug 2023 14:58:15 +0200 Subject: [PATCH] Make reduce0 operator more complicated. --- tests/dependence-analysis/reduce0.fut | 80 +++++++++++++++------------ 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/tests/dependence-analysis/reduce0.fut b/tests/dependence-analysis/reduce0.fut index fd0085c97c..e1d11998d5 100644 --- a/tests/dependence-analysis/reduce0.fut +++ b/tests/dependence-analysis/reduce0.fut @@ -1,13 +1,15 @@ -- == --- structure { Screma/BinOp 2 } +-- structure { BinOp 2 } def tadd ((x1, y1): (i32, i32)) (x2, y2) = (x1+x2, y1+y2) def main (X: []i32) (Y: []i32) (n: i64) = let A = (zip X Y) let r = - loop x = (0,0) for _i < n do - reduce (\(a,b) (x,y) -> (x+a,y+b)) (0,0) (map (tadd x) A) + loop r' = (0,0) for i < n do + reduce (\(a,b) (x,y) -> if i == 0 then (a,b) else (a+x,b+y)) + (0,0) + (map (tadd r') A) in r.0 -- Before changes: @@ -16,42 +18,52 @@ def main (X: []i32) (Y: []i32) (n: i64) = -- Y: []i32, -- n: i64}, -- {i32}) --- entry_main (d₁_5311 : i64, --- X_5312 : [d₁_5311]i32, --- Y_5313 : [d₁_5311]i32, --- n_5314 : i64) +-- entry_main (d₁_5328 : i64, +-- X_5329 : [d₁_5328]i32, +-- Y_5330 : [d₁_5328]i32, +-- n_5331 : i64) -- : {i32} = { --- let {main_res_5385 : i32, --- main_res_5386 : i32} = --- loop {x_5388 : i32, --- x_5389 : i32} = {0i32, 0i32} --- for _i_5387:i64 < n_5314 do { --- let {defunc_0_reduce_res_5416 : i32, --- defunc_0_reduce_res_5417 : i32} = --- redomap(d₁_5311, --- {X_5312, Y_5313}, --- {\ {eta_p_5398 : i32, --- eta_p_5399 : i32, --- eta_p_5400 : i32, --- eta_p_5401 : i32} +-- let {main_res_5397 : i32, +-- main_res_5398 : i32} = +-- loop {r'_5400 : i32, +-- r'_5401 : i32} = {0i32, 0i32} +-- for i_5399:i64 < n_5331 do { +-- let {cond_5414 : bool} = +-- eq_i64(i_5399, 0i64) +-- let {defunc_0_reduce_res_5431 : i32, +-- defunc_0_reduce_res_5432 : i32} = +-- redomap(d₁_5328, +-- {X_5329, Y_5330}, +-- {\ {eta_p_5410 : i32, +-- eta_p_5411 : i32, +-- eta_p_5412 : i32, +-- eta_p_5413 : i32} -- : {i32, -- i32} -> --- let {tmp_5402 : i32} = --- add32(eta_p_5398, eta_p_5400) --- let {tmp_5403 : i32} = --- add32(eta_p_5399, eta_p_5401) --- in {tmp_5402, tmp_5403}, +-- let {lifted_lambda_res_5415 : i32, +-- lifted_lambda_res_5416 : i32} = +-- if cond_5414 +-- then {eta_p_5410, eta_p_5411} else { +-- let {tmp_5417 : i32} = +-- add32(eta_p_5410, eta_p_5412) +-- let {tmp_5418 : i32} = +-- add32(eta_p_5411, eta_p_5413) +-- in {tmp_5417, tmp_5418} +-- } +-- : {i32, +-- i32} +-- in {lifted_lambda_res_5415, lifted_lambda_res_5416}, -- {0i32, 0i32}}, --- \ {eta_p_5408 : i32, --- eta_p_5409 : i32} +-- \ {eta_p_5423 : i32, +-- eta_p_5424 : i32} -- : {i32, -- i32} -> --- let {tmp_5410 : i32} = --- add32(x_5388, eta_p_5408) --- let {tmp_5411 : i32} = --- add32(x_5389, eta_p_5409) --- in {tmp_5410, tmp_5411}) --- in {defunc_0_reduce_res_5416, defunc_0_reduce_res_5417} +-- let {tmp_5425 : i32} = +-- add32(r'_5400, eta_p_5423) +-- let {tmp_5426 : i32} = +-- add32(r'_5401, eta_p_5424) +-- in {tmp_5425, tmp_5426}) +-- in {defunc_0_reduce_res_5431, defunc_0_reduce_res_5432} -- } --- in {main_res_5385} +-- in {main_res_5397} -- }