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

End to End implementation of ttnn.prod op #1792

Merged
merged 9 commits into from
Jan 23, 2025
Merged

Conversation

mmanzoorTT
Copy link
Contributor

@mmanzoorTT mmanzoorTT commented Jan 15, 2025

closes #1790 #1791

@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch 3 times, most recently from 1dd7293 to 54d4cbe Compare January 16, 2025 14:12
@mmanzoorTT mmanzoorTT changed the title reduce prod op End to End implementation of ttnn.prod op Jan 16, 2025
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch from 54d4cbe to f80c046 Compare January 16, 2025 15:18
@mmanzoorTT mmanzoorTT marked this pull request as ready for review January 16, 2025 15:18
Copy link
Contributor

@sdjordjevicTT sdjordjevicTT left a comment

Choose a reason for hiding this comment

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

It looks good. Please update and elaborate more on the new operation description in the dialect definitions.

include/ttmlir/Dialect/TTIR/IR/TTIROps.td Show resolved Hide resolved
lib/Dialect/TTIR/IR/TTIROps.cpp Outdated Show resolved Hide resolved
lib/Dialect/TTIR/IR/TTIROps.cpp Outdated Show resolved Hide resolved
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch from f80c046 to 34a2156 Compare January 17, 2025 14:27
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.

I have some concerns regarding restrictions imposed on much higher level of abstraction than the place where they belong to. We shouldn't make a StableHLO depend on TTNN, it's a very live project that changes every day, so even when some of those things get fixed we are still left with an unnecessary restrictions. On top of that we now have an infrastructure set in place to circumvent most (if not all) of those restrictions, so we should use it.

lib/Conversion/StableHLOToTTIR/StableHLOToTTIRPatterns.cpp Outdated Show resolved Hide resolved
lib/Conversion/StableHLOToTTIR/StableHLOToTTIRPatterns.cpp Outdated Show resolved Hide resolved
lib/Conversion/StableHLOToTTIR/StableHLOToTTIRPatterns.cpp Outdated Show resolved Hide resolved
lib/Dialect/TTIR/IR/TTIROps.cpp Outdated Show resolved Hide resolved
lib/Dialect/TTIR/IR/TTIROps.cpp Outdated Show resolved Hide resolved
runtime/lib/ttnn/operations/reduction/reduction.cpp Outdated Show resolved Hide resolved
runtime/lib/ttnn/operations/reduction/reduction.cpp Outdated Show resolved Hide resolved
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch 5 times, most recently from c2e90ee to 46984d0 Compare January 18, 2025 15:53
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.

This looks much better, but TTNN modelling is still an issue.

What's your opinion on this, to be quite honest this one

    static Tensor invoke(
        const Tensor& input,
        bool all_dimensions = false,
        int64_t dim = 0,
        const bool keepdim = false,
        const std::optional<MemoryConfig>& memory_config = std::nullopt);

looks terrible to me because of this part

        bool all_dimensions = false,
        int64_t dim = 0

but the second one lacks keepdim (and is also a DPS).

include/ttmlir/Target/TTNN/program.fbs Show resolved Hide resolved
lib/Dialect/TTNN/IR/TTNNOps.cpp Show resolved Hide resolved
runtime/lib/ttnn/operations/reduction/prod.cpp Outdated Show resolved Hide resolved
test/ttmlir/Silicon/StableHLO/reduction/reduce_add_op.mlir Outdated Show resolved Hide resolved
lib/Target/TTNN/TTNNToFlatbuffer.cpp Outdated Show resolved Hide resolved
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch from c7bf20d to ca49a91 Compare January 21, 2025 00:08
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch 2 times, most recently from 81b036b to 59a1b7d Compare January 21, 2025 21:10
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 much better now, I left a few comments that should be addressed, but nothing critical.

lib/Target/TTNN/TTNNToFlatbuffer.cpp Outdated Show resolved Hide resolved
lib/Target/TTNN/TTNNToFlatbuffer.cpp Outdated Show resolved Hide resolved
runtime/lib/ttnn/operations/reduction/prod.cpp Outdated Show resolved Hide resolved
@mmanzoorTT mmanzoorTT force-pushed the mmanzoor/reduce-prod-op branch from b184707 to b633e89 Compare January 23, 2025 19:03
@mmanzoorTT mmanzoorTT enabled auto-merge (squash) January 23, 2025 20:18
@mmanzoorTT mmanzoorTT merged commit d5b4d1a into main Jan 23, 2025
23 checks passed
@mmanzoorTT mmanzoorTT deleted the mmanzoor/reduce-prod-op branch January 23, 2025 20:34
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.

[Ops] Add support for ttnn.prod op
5 participants