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] Fix crash on transform_layout #13958

Closed

Conversation

quic-sanirudh
Copy link
Contributor

When ScheduleTransformLayout is called, the block corresponding to the BlockRV named block is potentially changed. The symbol_table_ however is not updated for changes to BlockRV and hence when the same blockRV block is passed to ScheduleSetAxisSeparator, the sref corresponding to that is invalid and that results in crash as unknown type_index_

This PR is a temporary fix and a permanent fix would probably need to identify that the BlockRV is not pointing to a valid sref and throw a proper error or update the symbol_table_ appropriately to avoid this error completely.

When `ScheduleTransformLayout` is called, the block corresponding to the BlockRV
named `block` is potentially changed. The symbol_table_ however is not
updated for changes to BlockRV and hence when the same blockRV `block`
is passed to `ScheduleSetAxisSeparator`, the sref corresponding to that
is invalid and that results in crash as unknown type_index_

This PR is a temporary fix and a permanent fix would probably need to
identify that the BlockRV is not pointing to a valid sref and throw a
proper error or update the symbol_table_ appropriately to avoid this
error completely.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Feb 11, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@quic-sanirudh
Copy link
Contributor Author

This PR provides a temporary fix to the error seen in #13957

@quic-sanirudh
Copy link
Contributor Author

cc @vinx13 @Lunderberg

@quic-sanirudh quic-sanirudh changed the title [TIR] Fix crash error on transform_layout [TIR] Fix crash on transform_layout Feb 11, 2023
@quic-sanirudh
Copy link
Contributor Author

@tvm-bot rerun

@quic-sanirudh
Copy link
Contributor Author

This PR is a temporary fix and a permanent fix would probably need to identify that the BlockRV is not pointing to a valid sref and throw a proper error

Just realized that if we enable debug_mask="all" when creating the Schedule, we do get a proper error message related to the sref, so maybe this fix could be considered a permanent fix?

@quic-sanirudh
Copy link
Contributor Author

@tvm-bot rerun

@quic-sanirudh quic-sanirudh marked this pull request as draft February 13, 2023 10:20
@vinx13
Copy link
Member

vinx13 commented Feb 13, 2023

I think as a permanent fix, the schedule primitive should always guarantee correct remapping of block reference. This is achieved by setting correct block_sref_reuse https://github.com/apache/tvm/blob/main/src/tir/schedule/primitive/layout_transformation.cc#L1165

@quic-sanirudh
Copy link
Contributor Author

I think as a permanent fix, the schedule primitive should always guarantee correct remapping of block reference. This is achieved by setting correct block_sref_reuse https://github.com/apache/tvm/blob/main/src/tir/schedule/primitive/layout_transformation.cc#L1165

Thanks @vinx13 for the suggestion. I'll try to update this PR with the permanent fix.

@quic-sanirudh
Copy link
Contributor Author

Closing in favor of #14023

@quic-sanirudh quic-sanirudh deleted the type_index_bug_workaround branch February 17, 2023 17:26
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.

3 participants