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

[TIR][NarrowDataType] Bufferload's index should not inherit bits constraint of value #17411

Merged

Conversation

wrongtest-intellif
Copy link
Contributor

Fix an issue in NarrowDataType pass. When we perform narrowing on buffer indices, the integer bits constraint is irrelevant to buffer load value's integer bits. Thus it looks like we should reset the context bit info when traverse into the indices field.

Another small change is in cast node rewrite, skip node construction when dtype actually matches.

@tqchen
Copy link
Member

tqchen commented Sep 24, 2024

do u mind leave a quick comment about what will happen without this PR

@wrongtest-intellif
Copy link
Contributor Author

do u mind leave a quick comment about what will happen without this PR

In the main branch, this case's indices would not change after narrowing with i32.

@T.prim_func
def before(A: T.Buffer((16,), "int64")):
    for i in range(T.int64(15)):
          A[i + T.int64(1)] = A[i] + T.int64(1)

The deduction chain is like below:

  1. A[i] + T.int64(1) -> 64b
  2. A[i] -> 64b
  3. indices of load A -> 64b (here is the issue)
  4. i -> requires 64b

@tqchen tqchen merged commit a90fb8e into apache:main Sep 25, 2024
18 of 19 checks passed
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.

2 participants