loopy icon indicating copy to clipboard operation
loopy copied to clipboard

`lp.assignment_to_subst`: Should it support 1-long axes as a special case?

Open kaushikcfd opened this issue 3 years ago • 1 comments

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?

kaushikcfd avatar Jan 12 '22 00:01 kaushikcfd

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.

inducer avatar Jan 12 '22 18:01 inducer