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

[dataflow][backend] Add IO analysis pass #266

Merged
merged 11 commits into from
Nov 26, 2024

Conversation

chhzh123
Copy link
Member

Description

This PR fixes the issue of incorrect dataflow construction introduced by #263. Specifically, we need to analyze the arguments in the top-level function and check whether they have read/write operations. This is done by a sequential traversal of the IR through the FuncOp.

Examples

def kernel(A: int32[32], B: int32[32], C: int32[32]):
    for i in range(32):
        C[i] = A[i] + B[i]

def rw_kernel(D: int32[32]):
    for i in range(32):
        D[i] = D[i] + 1

def top2(A: int32[32], B: int32[32], C: int32[32], D: int32[32]):
    kernel(A, B, C)
    write_kernel(A)
    rw_kernel(D)

s = allo.customize(top2)
res = analyze_arg_load_store(s.module)
{'kernel': ['in', 'in', 'out'], 'write_kernel': ['out'], 'rw_kernel': ['both'], 'top2': ['both', 'in', 'out', 'both']}

Checklist

  • PR's title starts with a category (e.g. [Bugfix], [IR], [Builder], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage (It would be better to provide ~2 different test cases to test the robustness of your code)
  • Code is well-documented

@chhzh123 chhzh123 merged commit f2022bf into cornell-zhang:main Nov 26, 2024
1 check passed
@chhzh123 chhzh123 deleted the analyze_io branch November 26, 2024 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant