Skip to content

Commit 5ac2e2e

Browse files
committed
actually run example with vector extensions
1 parent b9b2fbe commit 5ac2e2e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/test_target.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ def test_vec_tag_with_omp_simd_fallback():
708708
""",
709709
[lp.GlobalArg("x, y", shape=lp.auto, dtype=float)],
710710
seq_dependencies=True,
711-
target=lp.CVectorExtensionsTarget())
711+
target=lp.ExecutableCVectorExtensionsTarget())
712712

713713
knl = lp.tag_inames(knl, {"j1": lp.VectorizeTag(lp.OpenMPSIMDTag()),
714714
"j2": lp.VectorizeTag(lp.OpenMPSIMDTag()),
@@ -721,6 +721,10 @@ def test_vec_tag_with_omp_simd_fallback():
721721
for line in code_str.split("\n")
722722
if line.strip() == "#pragma omp simd"]) == 2
723723

724+
x = np.random.rand(10, 4)
725+
_, (out,) = knl(x=x)
726+
np.testing.assert_allclose(out, 2*x+1)
727+
724728

725729
def test_vec_extensions_with_multiple_loopy_body_insns():
726730
knl = lp.make_kernel(
@@ -734,7 +738,7 @@ def test_vec_extensions_with_multiple_loopy_body_insns():
734738
end
735739
""",
736740
seq_dependencies=True,
737-
target=lp.CVectorExtensionsTarget())
741+
target=lp.ExecutableCVectorExtensionsTarget())
738742

739743
knl = lp.add_dtypes(knl, {"dat0": "float64"})
740744
knl = lp.split_iname(knl, "n", 4, slabs=(1, 1),
@@ -744,7 +748,8 @@ def test_vec_extensions_with_multiple_loopy_body_insns():
744748
knl = lp.tag_inames(knl, {
745749
"n_batch": lp.VectorizeTag(lp.OpenMPSIMDTag())})
746750

747-
print(lp.generate_code_v2(knl).device_code())
751+
_, (out,) = knl(N=100)
752+
np.testing.assert_allclose(out, 2*np.ones((100, 1)))
748753

749754

750755
if __name__ == "__main__":

0 commit comments

Comments
 (0)