[Unity][Bugfix] Handle symbolic matching with non-structural match#15994
Merged
Hzfengsy merged 2 commits intoapache:unityfrom Nov 30, 2023
Merged
[Unity][Bugfix] Handle symbolic matching with non-structural match#15994Hzfengsy merged 2 commits intoapache:unityfrom
Hzfengsy merged 2 commits intoapache:unityfrom
Conversation
Member
|
cc @Hzfengsy |
tqchen
reviewed
Nov 1, 2023
src/relax/transform/fuse_tir.cc
Outdated
| LOG(FATAL) << "Failed to match PrimExpr " << param << " with " << arg; | ||
| } | ||
| VisitExpr(param, arg); | ||
| must_prove_ = arith::Analyzer().Simplify(Substitute(must_prove_, *var_remap_)); |
Member
There was a problem hiding this comment.
would be useful to generate analyzer once and reuse multiple times when possibe
Contributor
Author
There was a problem hiding this comment.
Good call, and updated to be outside of the SymbolicMatcher.
Prior to this commit, `FuseTIR` required the symbolic shape of an argument to be a structural match to the symbolic shape of a parameter. As a result, erroneous failures to match would occur when the dynamic shape parameter contains expressions, and the static shape argument does not. For example, a parameter `[n, m, n*m]` is not structurally matched to an argument `[16, 16, 256]`, but is a valid substitution. This commit updates `FuseTIR` to handle these cases.
e2a476e to
567ac75
Compare
Contributor
Author
|
Rebased onto |
Hzfengsy
approved these changes
Nov 30, 2023
Archermmt
pushed a commit
to Archermmt/tvm
that referenced
this pull request
Dec 18, 2023
…pache#15994) * [Unity][Bugfix] Handle symbolic matching with non-structural match Prior to this commit, `FuseTIR` required the symbolic shape of an argument to be a structural match to the symbolic shape of a parameter. As a result, erroneous failures to match would occur when the dynamic shape parameter contains expressions, and the static shape argument does not. For example, a parameter `[n, m, n*m]` is not structurally matched to an argument `[16, 16, 256]`, but is a valid substitution. This commit updates `FuseTIR` to handle these cases. * Avoid repeated initialization of arith::Analyzer
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.
Prior to this commit,
FuseTIRrequired the symbolic shape of an argument to be a structural match to the symbolic shape of a parameter. As a result, erroneous failures to match would occur when the dynamic shape parameter contains expressions, and the static shape argument does not. For example, a parameter[n, m, n*m]is not structurally matched to an argument[16, 16, 256], but is a valid substitution. This commit updatesFuseTIRto handle these cases.