-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] Fix int32 vs int64 mismatch in For construct. #10595
Conversation
This seems related to #10571. I wonder if it introduced the error? |
|
@tkonolige You were right. After reverting your PR, this error disappeared (a green check on
|
oh @lazycal can you send a revert PR? We can ask @tkonolige for a follow-up later. |
@lazycal I don't think reverting #10571 is the correct way to go. I think that just uncovered more issues that we have. Specifically we sometime mismatch the dtypes between the To prevent issues like this in the future, we should add a dtype check to the |
@masahi @tkonolige Just saw your comments. I agree reverting is not the right way to go, and there might be other issues uncovered by our combined change. I did that just for testing (I don't have VK on my end). I'll revert the revert commit and let you decide whether to merge this or not. Good point about adding the dtype check to |
7b8c703
to
1a31d96
Compare
The CI seems broken. I got error like |
ooh, I also keep getting the same error, but only from PyTorch tests involving large model download like https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/PR-10876/6/pipeline. So I thought it is PyTorch problem (we also updated our PT install to v1.11 last week). I'll talk to people about this tomorrow. In the mean time, since it is likely a flaky problem, you may try pushing new jobs. |
It's finally finished. This PR now aims to fix the dtype mismatch issue brought by constructing TIR's Not sure about the impact of this restriction. If not desired, there might be other solutions to this problem, e.g.:
I am not familiar with various codegen pass, and not sure exactly where to insert this additional legalization pass, so I didn't go down those paths, but happy to discusss more. P.S. I added one exception to the For constructor for cc: @masahi @tkonolige |
I think this is not a big restriction, it's always better to be precise about data types. I'm ok with additional casting I may need to do. |
* Respect dtype in Scalarize. * Add unittest. * Fix lint. * Promote dtype of IntImm to match loop_var in For. * Fix dtype mismatches. * Lint * Lint. * jostle ci * Match dtype in hybrid parser.
* Respect dtype in Scalarize. * Add unittest. * Fix lint. * Promote dtype of IntImm to match loop_var in For. * Fix dtype mismatches. * Lint * Lint. * jostle ci * Match dtype in hybrid parser.
This PR fixes a bug uncovered in end-to-end tests, where the dtype of loop variable could has fewer bits than the loop min/extent, which leads to a fatal error introduced by the recent #10595 which enforces more restrictive checks.
* Respect dtype in Scalarize. * Add unittest. * Fix lint. * Promote dtype of IntImm to match loop_var in For. * Fix dtype mismatches. * Lint * Lint. * jostle ci * Match dtype in hybrid parser.
…he#11030) This PR fixes a bug uncovered in end-to-end tests, where the dtype of loop variable could has fewer bits than the loop min/extent, which leads to a fatal error introduced by the recent apache#10595 which enforces more restrictive checks.
…he#11030) This PR fixes a bug uncovered in end-to-end tests, where the dtype of loop variable could has fewer bits than the loop min/extent, which leads to a fatal error introduced by the recent apache#10595 which enforces more restrictive checks.
In the VectorizeLoop pass, when scalarizing a vectorized loop into serialized loop (for reasons like it's not vectorizable), the for-loop is not properly constructed to respect the loop variable's dtype. For example, the second loop in the following code
is scalarized into
where
ax2.inner.s
's start and extent are changed silently to int32. Later it caused SegFault. After this PR, the above code will handle the dtype correctly and output the followingAn onnx model to trigger this issue: model.onnx.zip.