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

Don't construct Embed{}s for 1x1 filters in convolutions #1669

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

krzysz00
Copy link
Collaborator

@krzysz00 krzysz00 commented Oct 4, 2024

Fixes https://github.com/ROCm/rocMLIR-internal/issues/1642

The [dN] + [dN]o (that is, index in the filter (from the K dimension)

  • index in the output (from the N dimension)) embedding in our conv2gemm is needed.

However, in the case of 1x1 filters, that should simplify to just [dN]o (possibly scaled by the stride) that Embed{} operation was throwing off collapseContiguousMerges(), leading to inefficient codegen compared to the mathematically equivalent GEMM operation as described in the ticket.

This commit resolves the issue and adds tests.

Fixes ROCm/rocMLIR-internal#1642

The [dN] + [dN]o (that is, index in the filter (from the K dimension)
+ index in the output (from the N dimension)) embedding in our
conv2gemm is needed.

However, in the case of 1x1 filters, that should simplify to just
[dN]o (possibly scaled by the stride) that Embed{} operation was
throwing off collapseContiguousMerges(), leading to inefficient
codegen compared to the mathematically equivalent GEMM operation as
described in the ticket.

This commit resolves the issue and adds tests.
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 67.85714% with 9 lines in your changes missing coverage. Please review.

Project coverage is 78.01%. Comparing base (3d9ae0e) to head (d82d211).
Report is 39 commits behind head on develop.

Files with missing lines Patch % Lines
mlir/lib/Dialect/Rock/Transforms/ConvToGemm.cpp 72.72% 2 Missing and 4 partials ⚠️
mlir/lib/Dialect/Rock/IR/TransformMapBuilder.cpp 50.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1669      +/-   ##
===========================================
- Coverage    83.69%   78.01%   -5.69%     
===========================================
  Files           97       98       +1     
  Lines        26445    26501      +56     
  Branches      3796     3809      +13     
===========================================
- Hits         22134    20674    -1460     
- Misses        4276     4294      +18     
- Partials        35     1533    +1498     
Flag Coverage Δ
mfma 78.01% <67.85%> (-5.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant