Skip to content

[loopy-codegen, bug] Code generation for tagged NamedArrays is buggy #195

@kaushikcfd

Description

@kaushikcfd

Tagging a named array and then accessing other results of the container loses the tag information as it might freshly create a "dirty" no-tagged variant, see

pytato/pytato/array.py

Lines 718 to 722 in 1c9ee78

@memoize_method
def __getitem__(self, name: str) -> NamedArray:
if name not in self._data:
raise KeyError(name)
return NamedArray(self, name)


Loopy codegen is broken for tagged instances of NamedArray for the same reason. Here's an MWE:

class FooTag(Tag):
    pass

knl = lp.make_kernel(
    "{[i]: 0<=i<10}",
    """
    y[i] = i
    """)

y = call_loopy(knl, bindings={})["y"]
y = y.tagged(FooTag())
pt.generate_loopy(2 * y)

raises:

  File "/home/kgk2/projects/ceesd/pytato/pytato/target/loopy/codegen.py", line 414, in map_named_array
    assert expr in state.results
AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions