loopy
loopy copied to clipboard
`lp.assignment_to_subst`: Should it support 1-long axes as a special case?
knl = lp.make_kernel(
'{[i, j]: 0<=i,j<10}',
"""
<> tmp[i, 0] = 2 * i
out[j] = tmp[j, 0]
""")
knl = lp.assignment_to_subst(knl, 'tmp')
fails with:
File "/home/square/projects/ceesd/loopy/loopy/transform/subst.py", line 431, in assignment_to_subst
raise LoopyError("In defining instruction '%s': "
loopy.diagnostic.LoopyError: In defining instruction 'insn': asignee index '0' is not a plain variable. Perhaps use loopy.affine_map_inames() to perform substitution.
Should we support such trivial definitions in assignment_to_subst or is it the user's problem to avoid having such definitions in the first place?
I'm OK with supporting that. Longer-term, I would also like to support assignment_to_subst on
tmp[i,0] = 1
tmp[i,1] = 12
generating a conditional, so this seems like a potential first step towards that.