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

[BUG] Update streaming interfaces through deeply nested funtions #182

Open
AdrianLiu00 opened this issue Sep 12, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@AdrianLiu00
Copy link
Contributor

Describe the bug
When updating the streaming interface in .to(), if the inner function is deeply nested, the interface may be not exposed to update.

To Reproduce

def test_deep_nested_function():
    T = int32

    def func1(A: T[10, 20], B: T[10, 20]):
        for i, j in allo.grid(10, 20):
            B[i, j] = A[i, j] + 1

    def func2(A: T[10, 20], B: T[10, 20]):
        func1(A, B)
        for i, j in allo.grid(10, 20):
            B[i, j] = A[i, j] * 2

    def func3(A: T[10, 20], B: T[10, 20]):
        func2(A, B)
        for i, j in allo.grid(10, 20):
            B[i, j] = A[i, j] - 1

    def top(A: T[10, 20]) -> T[10, 20]:
        B: T[10, 20]
        func3(A, B)
        return B

    s = allo.customize(top)
    s.to(s.B, "top", depth=1)
    print(s.module)

Buggy output
test_deep_nested_function - hcl_mlir._mlir_libs._site_initialize.<locals>.MLIRError: Failure while executing pass pipeline:

Expected behavior
All related interfaces are well-updated and pass the mlir test.

Additional context
Sufficient recursive traversal can be a solution to this issue.

@AdrianLiu00 AdrianLiu00 added the bug Something isn't working label Sep 12, 2024
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

1 participant