8000 TTIR decomposition of ttir.prod op by mmanzoorTT · Pull Request #3694 · tenstorrent/tt-mlir · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TTIR decomposition of ttir.prod op #3694

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

Merged
merged 1 commit into from
Jun 10, 2025
Merged

Conversation

mmanzoorTT
Copy link
Contributor

Ticket

closes #1861

Problem description

tt-metal supports product reduction along one or all dimensions.

What's changed

TTIR->TTIR decomposition is added to transform product reduction op to
multiple reduction ops. Each op will perform reduction along one dimension only.

Checklist

  • New/Existing tests provide coverage for changes

@codecov-commenter
Copy link
codecov-commenter commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Project coverage is 72.61%. Comparing base (50d7cf2) to head (4124567).

Files with missing lines Patch % Lines
...TIRToTTIRDecomposition/TTIRToTTIRDecomposition.cpp 93.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3694      +/-   ##
==========================================
- Coverage   72.62%   72.61%   -0.01%     
==========================================
  Files         213      213              
  Lines       29310    29346      +36     
==========================================
+ Hits        21286    21311      +25     
- Misses       8024     8035      +11     

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

Copy link
Contributor
@azecevicTT azecevicTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite patterns looks good, but I would move it to TTNN workarounds patterns. We should leave TTIRToTTIR decompositions for ops that don't exist in TTNN and there is no plan to introduce them in the near future.

@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/ttnn-prod-decompose branch from 645a2f6 to f4eb822 Compare June 10, 2025 14:34
@mmanzoorTT
Copy link
Contributor Author

Rewrite patterns looks good, but I would move it to TTNN workarounds patterns. We should leave TTIRToTTIR decompositions for ops that don't exist in TTNN and there is no plan to introduce them in the near future.

PyTorch support reduce produce for either one dimension or all dimensions. However, Jax can also perform reduce product for multiple dimensions (so does stablehlo). I don't think that tt-metal will support ttnn.prod for multiple dimensions as it follows the same structure/function as PyTorch.

I added it as TTIR->TTIR decomposition due to following two reasons

  1. My understanding is that we add TTNN workaround if some feature is missing or there is a bug in tt-metal and it will be fixed sooner or later. So the workarounds are temporary measures and will be removed once tt-metal fixes the issue. This is not the case here.
  2. If we implement it as TTNN workaround then TTNN dialect will need a vector for dim_arg to hold multiple dimensions (currently it is optional i64) and we will deviate from tt-metal implementation.

@azecevicTT
Copy link
Contributor

If we implement it as TTNN workaround then TTNN dialect will need a vector for dim_arg to hold multiple dimensions (currently it is optional i64) and we will deviate from tt-metal implementation.

Good point, didn't check that. In that case, I agree that this should stay as TTIR->TTIR decomp.

Copy link
Contributor
@azecevicTT azecevicTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/ttnn-prod-decompose branch from f4eb822 to 4124567 Compare June 10, 2025 17:51
@mmanzoorTT mmanzoorTT enabled auto-merge (squash) June 10, 2025 17:52
@mmanzoorTT mmanzoorTT merged commit bcc5940 into main Jun 10, 2025
61 checks passed
@mmanzoorTT mmanzoorTT deleted the mmanzoor/ttnn-prod-decompose branch June 10, 2025 19:04
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.

[TTNN] Decomposition of ttnn.prod op
3 participants
0