Skip to content

Commit

Permalink
test: update outplace-inplace stencil tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Feb 4, 2025
1 parent af4edfc commit 3ccd9db
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 118 deletions.
27 changes: 12 additions & 15 deletions test/build_function_tests/intermediate-exprs-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
:(function (u,)
let ˍ₋out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
ˍ₋out_input_1 = let _out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
_out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5)))
end
:(function (ˍ₋out, u)
begin
ˍ₋out_input_1 = let _out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
_out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (Main.limit2)((+)(-1, i), 5), (Main.limit2)((+)(1, j), 5)))
end
end
_out
end
for (j, j′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
for (i, i′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(ˍ₋out_input_1, j, i))
end
_out
end
for (j, j′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
for (i, i′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(ˍ₋out_input_1, j, i))
end
end
ˍ₋out
end
end)
27 changes: 15 additions & 12 deletions test/build_function_tests/intermediate-exprs-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
:(function (ˍ₋out, u)
begin
ˍ₋out_input_1 = let _out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
_out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5)))
:(function (u,)
let ˍ₋out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
ˍ₋out_input_1 = let _out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
_out[i′, j′] = (+)(_out[i′, j′], (getindex)(u, (Main.limit2)((+)(-1, i), 5), (Main.limit2)((+)(1, j), 5)))
end
end
end
_out
end
for (j, j′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
for (i, i′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(ˍ₋out_input_1, j, i))
end
_out
end
for (j, j′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
for (i, i′) = zip(Base.OneTo(5), reset_to_one(Base.OneTo(5)))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(ˍ₋out_input_1, j, i))
end
end
ˍ₋out
end
end)
13 changes: 5 additions & 8 deletions test/build_function_tests/manual-limits-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
:(function (u,)
let ˍ₋out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5)))
end
:(function (ˍ₋out, u)
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (Main.limit2)((+)(-1, i), 5), (Main.limit2)((+)(1, j), 5)))
end
end
ˍ₋out
end
end)
13 changes: 8 additions & 5 deletions test/build_function_tests/manual-limits-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
:(function (ˍ₋out, u)
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (Main.limit)((+)(-1, i), 5), (Main.limit)((+)(1, j), 5)))
:(function (u,)
let ˍ₋out = zeros(Float64, map(length, (Base.OneTo(5), Base.OneTo(5))))
begin
for (j, j′) = zip(1:5, reset_to_one(1:5))
for (i, i′) = zip(1:5, reset_to_one(1:5))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(u, (Main.limit2)((+)(-1, i), 5), (Main.limit2)((+)(1, j), 5)))
end
end
end
ˍ₋out
end
end)
21 changes: 9 additions & 12 deletions test/build_function_tests/stencil-broadcast-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (1:6, 1:6)))
begin
ˍ₋out_2_input_1 = (broadcast)(+, x, (adjoint)(x))
ˍ₋out_1 = (view)(ˍ₋out, 1:6, 1:6)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
for (i, i′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (+)(1, (getindex)(ˍ₋out_2_input_1, i, j)))
end
:(function (ˍ₋out, x)
begin
ˍ₋out_2_input_1 = (broadcast)(+, x, (adjoint)(x))
ˍ₋out_1 = (view)(ˍ₋out, 1:6, 1:6)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
for (i, i′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (+)(1, (getindex)(ˍ₋out_2_input_1, i, j)))
end
end
ˍ₋out
end
end)
21 changes: 12 additions & 9 deletions test/build_function_tests/stencil-broadcast-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
:(function (ˍ₋out, x)
begin
ˍ₋out_2_input_1 = (broadcast)(+, x, (adjoint)(x))
ˍ₋out_1 = (view)(ˍ₋out, 1:6, 1:6)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
for (i, i′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (+)(1, (getindex)(ˍ₋out_2_input_1, i, j)))
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (1:6, 1:6)))
begin
ˍ₋out_2_input_1 = (broadcast)(+, x, (adjoint)(x))
ˍ₋out_1 = (view)(ˍ₋out, 1:6, 1:6)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
for (i, i′) = zip(Base.OneTo(4), reset_to_one(Base.OneTo(4)))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (+)(1, (getindex)(ˍ₋out_2_input_1, i, j)))
end
end
end
ˍ₋out
end
end)
19 changes: 8 additions & 11 deletions test/build_function_tests/stencil-extents-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (1:5, 1:5)))
begin
ˍ₋out_1 = (view)(ˍ₋out, 1:5, 1:5)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:4, 2:4)
for (j, j′) = zip(2:4, reset_to_one(2:4))
for (i, i′) = zip(2:4, reset_to_one(2:4))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (*)(1//2, (+)((+)((+)((getindex)(x, (+)(-1, i), j), (getindex)(x, (+)(1, i), j)), (getindex)(x, i, (+)(-1, j))), (getindex)(x, i, (+)(1, j)))))
end
:(function (ˍ₋out, x)
begin
ˍ₋out_1 = (view)(ˍ₋out, 1:5, 1:5)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:4, 2:4)
for (j, j′) = zip(2:4, reset_to_one(2:4))
for (i, i′) = zip(2:4, reset_to_one(2:4))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (*)(1//2, (+)((+)((+)((getindex)(x, (+)(-1, i), j), (getindex)(x, (+)(1, i), j)), (getindex)(x, i, (+)(-1, j))), (getindex)(x, i, (+)(1, j)))))
end
end
ˍ₋out
end
end)
19 changes: 11 additions & 8 deletions test/build_function_tests/stencil-extents-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
:(function (ˍ₋out, x)
begin
ˍ₋out_1 = (view)(ˍ₋out, 1:5, 1:5)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:4, 2:4)
for (j, j′) = zip(2:4, reset_to_one(2:4))
for (i, i′) = zip(2:4, reset_to_one(2:4))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (*)(1//2, (+)((+)((+)((getindex)(x, (+)(-1, i), j), (getindex)(x, (+)(1, i), j)), (getindex)(x, i, (+)(-1, j))), (getindex)(x, i, (+)(1, j)))))
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (1:5, 1:5)))
begin
ˍ₋out_1 = (view)(ˍ₋out, 1:5, 1:5)
ˍ₋out_1 .= 0
ˍ₋out_2 = (view)(ˍ₋out, 2:4, 2:4)
for (j, j′) = zip(2:4, reset_to_one(2:4))
for (i, i′) = zip(2:4, reset_to_one(2:4))
ˍ₋out_2[i′, j′] = (+)(ˍ₋out_2[i′, j′], (*)(1//2, (+)((+)((+)((getindex)(x, (+)(-1, i), j), (getindex)(x, (+)(1, i), j)), (getindex)(x, i, (+)(-1, j))), (getindex)(x, i, (+)(1, j)))))
end
end
end
ˍ₋out
end
end)
15 changes: 6 additions & 9 deletions test/build_function_tests/stencil-transpose-arrayop-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (1:6, 1:6)))
begin
ˍ₋out_1 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out_1[i′, j′] = (+)(ˍ₋out_1[i′, j′], (getindex)(x, j, i))
end
:(function (ˍ₋out, x)
begin
ˍ₋out_1 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out_1[i′, j′] = (+)(ˍ₋out_1[i′, j′], (getindex)(x, j, i))
end
end
ˍ₋out
end
end)
15 changes: 9 additions & 6 deletions test/build_function_tests/stencil-transpose-arrayop-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
:(function (ˍ₋out, x)
begin
ˍ₋out_1 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out_1[i′, j′] = (+)(ˍ₋out_1[i′, j′], (getindex)(x, j, i))
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (1:6, 1:6)))
begin
ˍ₋out_1 = (view)(ˍ₋out, 2:5, 2:5)
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out_1[i′, j′] = (+)(ˍ₋out_1[i′, j′], (getindex)(x, j, i))
end
end
end
ˍ₋out
end
end)
13 changes: 5 additions & 8 deletions test/build_function_tests/transpose-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (Base.OneTo(4), Base.OneTo(4))))
begin
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(x, j, i))
end
:(function (ˍ₋out, x)
begin
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(x, j, i))
end
end
ˍ₋out
end
end)
13 changes: 8 additions & 5 deletions test/build_function_tests/transpose-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
:(function (ˍ₋out, x)
begin
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(x, j, i))
:(function (x,)
let ˍ₋out = zeros(Float64, map(length, (Base.OneTo(4), Base.OneTo(4))))
begin
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(x, j, i))
end
end
end
ˍ₋out
end
end)
10 changes: 8 additions & 2 deletions test/build_function_tests/transpose-term-inplace.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
:(function (x,)
(adjoint)(x)
:(function (ˍ₋out, x)
begin
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(x, j, i))
end
end
end
end)
10 changes: 2 additions & 8 deletions test/build_function_tests/transpose-term-outplace.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
:(function (ˍ₋out, x)
begin
for (j, j′) = zip(1:4, reset_to_one(1:4))
for (i, i′) = zip(1:4, reset_to_one(1:4))
ˍ₋out[i′, j′] = (+)(ˍ₋out[i′, j′], (getindex)(x, j, i))
end
end
end
:(function (x,)
(adjoint)(x)
end)

0 comments on commit 3ccd9db

Please sign in to comment.