tests/memory-block-merging/coalescing/safety-condition-3/pos0.fut
raw| 1 | -- Positive test. 'xs' is not used while 'ys' is live, so we can merge their |
| 2 | -- memory blocks. |
| 3 | -- == |
| 4 | -- input { [[2, 2], |
| 5 | -- [2, 2]] |
| 6 | -- [3, 4] |
| 7 | -- 1 |
| 8 | -- } |
| 9 | -- output { [[2, 2], |
| 10 | -- [4, 5]] |
| 11 | -- 6 |
| 12 | -- } |
| 13 | -- structure seq-mem { Alloc 1 } |
| 14 | -- structure gpu-mem { Alloc 1 } |
| 15 | |
| 16 | let main [n] (xs: *[n][n]i32) (ys0: [n]i32) (i: i32): ([n][n]i32, i32) = |
| 17 | let ys = map (+ 1) ys0 -- Will use the memory of xs[i]. |
| 18 | let zs = map (+ 1) ys |
| 19 | let xs[i] = ys |
| 20 | in (xs, zs[i]) |