| 1 |
-- Negative test. We cannot fulfill safety condition 1, since 'ys' is used |
| 2 |
-- after the coalescing-enabling line (in 'zs'). |
| 3 |
-- |
| 4 |
-- However, the new fusion engine fuses the two maps (ys and zs), meaning that |
| 5 |
-- it actually is short-circuited on the seq-mem backend. |
| 6 |
-- == |
| 7 |
-- input { 3i64 |
| 8 |
-- [0i64, 1i64, 2i64, 3i64] |
| 9 |
-- } |
| 10 |
-- output { [[0i64, 1i64, 2i64, 3i64], |
| 11 |
-- [4i64, 5i64, 6i64, 7i64], |
| 12 |
-- [8i64, 9i64, 10i64, 11i64], |
| 13 |
-- [1i64, 2i64, 3i64, 4i64]] |
| 14 |
-- [2i64, 3i64, 4i64, 5i64] |
| 15 |
-- } |
| 16 |
-- structure seq-mem { Alloc 2 } |
| 17 |
-- structure gpu-mem { Alloc 2 } |
| 18 |
|
| 19 |
let main [n] (i: i64) (ys0: [n]i64): ([n][n]i64, [n]i64) = |
| 20 |
let xs = tabulate_2d n n (\i j -> i*n + j) |> opaque |
| 21 |
|
| 22 |
let ys = map (+ 1) ys0 |
| 23 |
let xs[i] = ys |
| 24 |
|
| 25 |
let zs = map (+ 1) ys -- This could also be a short-circuit point in SeqMem |
| 26 |
|
| 27 |
in (xs, zs) |