[TE] Make elem_offset of the buffers created by te.extern a variable to avoid crash#13297
Merged
Conversation
Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
Collaborator
|
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 |
vinx13
approved these changes
Nov 4, 2022
Contributor
|
LGTM, and thank you for making this change! For context on the fix, this didn't cause an issue previously, because the default |
xinetzone
pushed a commit
to daobook/tvm
that referenced
this pull request
Nov 10, 2022
…ble to avoid crash (apache#13297) * make elem_offset of the buffers created by te.extern a variable Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai> * add test * fix te extern create_prim_func test Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
xinetzone
pushed a commit
to daobook/tvm
that referenced
this pull request
Nov 25, 2022
…ble to avoid crash (apache#13297) * make elem_offset of the buffers created by te.extern a variable Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai> * add test * fix te extern create_prim_func test Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, when compiling MobileBERT on x86, we get a crash from
tvm/src/tir/transforms/arg_binder.cc
Lines 102 to 106 in 11d22bd
This is caused from the subgraph attached in the test. Since #11341,
concatenateis implemented as a TE extern on x86.te.extern(...)doesn't explicitly set theelem_offsetparameter of input / output buffers it creates, which ends upelem_offsetof these buffers being the default value, 0. This causes a problem from the above check inBindBuffer, since the subgraph does create a non-zeroelem_offsetslice from a buffer whoseelem_offsetis set to zero.Since we don't require buffers created in
te.extern(...)to have zeroelem_offset, we can avoid this problem by explicitly settingelem_offsetto be a variable there. This fix was found by @Lunderberg and I'm sending this PR on behalf of him. He also suggested making thestridesparameter an array ofVaras well, but I didn't do it to keep the change minimal.cc @Lunderberg @tkonolige @shtinsa