Skip to content

Arg inference doesn't work for args used solely in predicates

Consider the following kernel:

>>> import loopy as lp
>>> knl = lp.make_kernel("{[i]: 0 <= i < 10}",
... """
... if incr[i]
...   a = a + 1
... end
... """)

The argument incr is not recognized:

>>> print(knl)
...
---------------------------------------------------------------------------
ARGUMENTS:
a: GlobalArg, type: <runtime>, shape: ()
---------------------------------------------------------------------------
...
>>> lp.generate_code_v2(knl)
...
  File "/home/matt/src/loopy/loopy/target/c/codegen/expression.py", line 84, in find_array
    % expr.aggregate.name)
RuntimeError: nothing known about subscripted variable 'incr'