-
Notifications
You must be signed in to change notification settings - Fork 152
0D/1D support for generic reduce #16623
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
Labels
Comments
Directory: ttnn/cpp/ttnn/operations/reduction |
This was referenced Mar 21, 2025
7 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 25, 2025
### Ticket [Link to Github Issue](#16623) ### Problem description Currently, generic reduction operations only support non-zero volume tensors and tensors with rank >=2. [This](#19480) and [this](#19478) impact 1D std/var and min/max as well. To be taken up separately. ### What's changed This PR adds the following: 1. Support 0D and 1D tensors for all generic ops 2. Support zero volume tensors of any rank (0-4) 4. Add a sweep to test all generic reduction ops across all zero and non zero volume tensors for ranks 0-4. 5. Add unit tests for handpicked cases from above 6. Allow "scalar" to propagate to all generic reduce ops. | Reduce Op | All ranks supported | Zero volume supported? | Matches Torch? | |-----------|----------------------|------------------------|-----------------| | `sum` | Y | Y | Y | | `mean` | Y | Y | Y | | `max` | Y | Y | Y | | `min` | Y | Y | Y | | `std` | Y | Y | N | | `var` | Y | Y | N | #### Review hint: `f3f2be19bb8349a530d6263aa7d44a012e907ad4` cleans up existing sweeps. Rest adds new features. ### Checklist - [x] [All post commit](https://github.com/tenstorrent/tt-metal/actions/workflows/all-post-commit-workflows.yaml) [CI 28265 passing ](https://github.com/tenstorrent/tt-metal/actions/runs/14041777945) - [ ] [Blackhole Post commit](https://github.com/tenstorrent/tt-metal/actions/workflows/blackhole-post-commit.yaml) CI passes (if applicable) - [ ] [Model regression](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-models.yaml) CI passes (if applicable) - [ ] [Device performance regression](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-device-models.yaml) CI passes (if applicable) - [ ] **(For models and ops writers)** Full [new models tests](https://github.com/tenstorrent/tt-metal/actions/workflows/full-new-models-suite.yaml) CI passes (if applicable) - [x] New/Existing tests provide coverage for changes - [x] [ttnn - Run sweeps #2457](https://github.com/tenstorrent/tt-metal/actions/runs/14041766008)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From @ayerofieiev-tt
There is probably also a bug for 1D tensors in ops like Sum
If user specifies a dimension over which to make a reduction and an input tensor is 1D...
0 dim will actually mean 1 dim
Will need to look into this once 0D/1D tiled tensor support is fully in.
Would also be good to look at 0 volume tensors (one dimension has size 0). E.g. for 2D and 4D.
The text was updated successfully, but these errors were encountered: