Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule creation error with hcl.if_ and struct field access in the condition #141

Closed
jcasas00 opened this issue Sep 8, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jcasas00
Copy link
Collaborator

jcasas00 commented Sep 8, 2022

def test_if_struct_access():
    hcl.init()

    def kernel():
        tag = hcl.scalar(0, "tag", dtype='uint32')

        stype = hcl.Struct({"x": hcl.UInt(8), "y": hcl.UInt(8)})
        xy = hcl.scalar(0x1234, "xy", dtype=stype).v

        with hcl.if_(xy.x==1):  # use of struct field access causes a scheduler error
            tag.v = 1

        r = hcl.compute((2,), lambda i: tag.v, dtype=hcl.UInt(32))
        return r
    s = hcl.create_schedule([], kernel)

The above code generates the following runtime error:

error: 'affine.load' op operation destroyed but still has uses
LLVM ERROR: operation destroyed but still has uses

@zzzDavid zzzDavid self-assigned this Sep 12, 2022
@zzzDavid zzzDavid added the bug Something isn't working label Sep 12, 2022
@zzzDavid
Copy link
Collaborator

@zzzDavid
Copy link
Collaborator

Fixed by 7906b26

Added remove and profile mode for struct op visitors

@zzzDavid
Copy link
Collaborator

Test case added here: https://github.com/cornell-zhang/heterocl/blob/9f7212f02dcf49e72fe6a980ace86e9f8b591f4d/tests/test_scalar.py#L87-L125

Closing the thread as the issue has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants