-
Notifications
You must be signed in to change notification settings - Fork 643
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
[GlobalOptimization] Fix a silent bug in DetatchElementwiseFromNamedOps pass #19356
[GlobalOptimization] Fix a silent bug in DetatchElementwiseFromNamedOps pass #19356
Conversation
…, and report possible match failures before rewriting Signed-off-by: zjgarvey <[email protected]>
Signed-off-by: zjgarvey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, and thanks for the fix! I left a few style nits, and I have a question.
loosens the check for identity map access to the output tensor.
Why? Is there a test for it?
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Outdated
Show resolved
Hide resolved
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Show resolved
Hide resolved
Signed-off-by: zjgarvey <[email protected]>
The op See the output tensor indexing map from the initial PR comment: #map4 = affine_map<(d0, d1, d2, d3, d4, d5) -> (d0, d3, d1, d2)> Did this answer your question? I also did verify the depthwise conv numerics are fixed with this change using the SHARK-TestSuite. |
compiler/src/iree/compiler/GlobalOptimization/DetachElementwiseFromNamedOps.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: zjgarvey <[email protected]>
Nice, this fixed mobilenet through onnx too: https://github.com/iree-org/iree/actions/runs/12166990284/job/33934898182#step:8:381
(was xfail before this PR/commit: https://github.com/iree-org/iree/actions/runs/12179658638/job/33972710377#step:8:123) |
Flagged by this nightly CI run: https://github.com/iree-org/iree-test-suites/actions/runs/12201314112. Fixed by iree-org/iree#19356. I linked some logs at iree-org/iree#19356 (comment).
This moves match failure checks before modifying linalg ops, and loosens the check for identity map access to the output tensor.
Context:
Specific depthwise convolution ops were encountering numeric failures. See #18600 and #19339. I noticed that the bias was not affecting the output values, and tracked down where the bias was getting deleted.
The issue is that the pass
DetatchElementwiseFromNamedOps
was modifying thedepthwise_conv
op to use a zero-fill before checking for some match failures. This resulted in a partial application of the pattern where the original bias did not get added back to the modified linalg op result.The depthwise conv ops were specifically failing to have an identity map for the output tensor access.
For example:
generalizes to
For some reason, the channel dim
d3
appears after the spatial dims (d1
andd2
) for this particular op.