Uh oh!
There was an error while loading. Please reload this page.
[TIR] Fix int32 vs int64 mismatch in For construct. - #10595
Conversation
lazycal
commented
Mar 14, 2022
tkonolige
commented
Mar 14, 2022
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 |
masahi
commented
Mar 15, 2022
oh @lazycal can you send a revert PR? We can ask @tkonolige for a follow-up later. |
tkonolige
commented
Mar 15, 2022
@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 |
lazycal
commented
Mar 15, 2022
@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 |
lazycal
commented
Apr 3, 2022
The CI seems broken. I got error like |
masahi
commented
Apr 4, 2022
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. |
lazycal
commented
Apr 5, 2022
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 |
masahi
commented
Apr 5, 2022
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.
…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.