Skip to content
Snippets Groups Projects
Commit 69c0c6f4 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Add test that divisibility assumptions work.

parent bf493847
No related branches found
No related tags found
No related merge requests found
......@@ -49,8 +49,6 @@ To-do
- Fuse: store/fetch elimination?
- divisibility constraints
Fixes:
- Group instructions by dependency/inames for scheduling, to
......@@ -109,6 +107,8 @@ Future ideas
Dealt with
^^^^^^^^^^
- test divisibility constraints
- Test join_inames
- Divisibility, modulo, strides?
......
......@@ -89,6 +89,38 @@ def test_join_inames(ctx_factory):
def test_divisibility_assumption(ctx_factory):
ctx = ctx_factory()
knl = lp.make_kernel(ctx.devices[0],
"[n] -> {[i]: 0<=i<n}",
[
"b[i] = 2*a[i]"
],
[
lp.GlobalArg("a", np.float32, shape=("n",)),
lp.GlobalArg("b", np.float32, shape=("n",)),
lp.ValueArg("n", np.int32),
],
assumptions="n>=1 and (exists zz: n = 16*zz)")
ref_knl = knl
knl = lp.split_iname(knl, "i", 16)
for k in lp.generate_loop_schedules(knl):
code = lp.generate_code(k)
assert "if" not in code
kernel_gen = lp.generate_loop_schedules(knl)
kernel_gen = lp.check_kernels(kernel_gen)
lp.auto_test_vs_ref(ref_knl, ctx, kernel_gen,
parameters={"n": 16**3})
def test_multi_cse(ctx_factory):
ctx = ctx_factory()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment