Commit 927a540
authored
### Ticket
#33349
### Problem description
TopK produced wrong results for some shapes from Qwen3-32b. Some of the
functionality like - `indices_tensor` parameter were available only in
Multicore version.
### What's changed
- General code cleanup and refactor,
- Unification of functionality in both program factories (some were
available only to one or the other),
- Possibility to utilize the full number of cores for SingleCore
approach processing - parallelization over Ht,
- Allowing the use of all tensor shapes and dim,
- Resolved issue with accuracy drop with Owen-32b shapes,
- Updated implementation docs,
- Removed redundant kernel.
### Checklist
- [x] [](https://github.com/tenstorrent/tt-metal/actions/workflows/all-post-commit-workflows.yaml?query=branch:mgajewskiTT/33349-topk-slight-accuracy-drop-with-qwen3-32b-shapes)
- [x] [](https://github.com/tenstorrent/tt-metal/actions/workflows/blackhole-post-commit.yaml?query=branch:mgajewskiTT/33349-topk-slight-accuracy-drop-with-qwen3-32b-shapes)
- OK, eltwise test fail not connected to this PR
- [ ]
[](https://github.com/tenstorrent/tt-metal/actions/workflows/tt-metal-l2-nightly.yaml?query=branch:mgajewskiTT/33349-topk-slight-accuracy-drop-with-qwen3-32b-shapes)
- [x] New/Existing tests provide coverage for changes
<img width="867" height="537" alt="New implementation and Current
implementation"
src="https://github.com/user-attachments/assets/913fc106-613b-44bb-90a0-23aad0dfe11a"
/>
#### Discovered issues
#36329
#### Model tests
If your changes cover model-related code, you should run tests
corresponding to affected models and platforms (Single card, T3K,
Galaxy). "Choose your pipeline" workflows facilitate running multiple
kinds of tests in a single run. Each offers `models-mandatory` and
`models-extended` presets.
The former includes a minimal set of tests, to be run always. The latter
extends that with additional ones - use your best judgement in deciding
which is the most appropriate for your PR.
- [ ] [](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select.yaml?query=branch:mgajewskiTT/33349-topk-slight-accuracy-drop-with-qwen3-32b-shapes)
- [ ] `models-mandatory` preset (runs: [Device perf
regressions](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-device-models.yaml)
and [Frequent model and ttnn
tests](https://github.com/tenstorrent/tt-metal/actions/workflows/fast-dispatch-full-regressions-and-models.yaml))
- [ ] `models-extended` preset (runs: the mandatory tests, plus
[Demo](https://github.com/tenstorrent/tt-metal/actions/workflows/single-card-demo-tests.yaml)
and [Model
perf](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-models.yaml)
tests)
- [ ] other selection - specify runs
- [ ] [](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select-t3k.yaml?query=branch:mgajewskiTT/33349-topk-slight-accuracy-drop-with-qwen3-32b-shapes)
- [ ] `models-mandatory` preset (runs: [Unit
tests](https://github.com/tenstorrent/tt-metal/actions/workflows/t3000-unit-tests.yaml))
- [ ] `models-extended` preset (runs: the mandatory tests, plus
[Demo](https://github.com/tenstorrent/tt-metal/actions/workflows/t3000-demo-tests.yaml)
and [Model
perf](https://github.com/tenstorrent/tt-metal/actions/workflows/t3000-model-perf-tests.yaml)
tests)
- [ ] other selection - specify runs
- [ ] [](https://github.com/tenstorrent/tt-metal/actions/workflows/pipeline-select-galaxy.yaml?query=branch:mgajewskiTT/33349-topk-slight-accuracy-drop-with-qwen3-32b-shapes)
- [ ] `models-mandatory` preset (runs: [Quick
tests](https://github.com/tenstorrent/tt-metal/actions/workflows/galaxy-quick.yaml))
- [ ] `models-extended` preset (runs: the mandatory tests, plus
[Demo](https://github.com/tenstorrent/tt-metal/actions/workflows/galaxy-demo-tests.yaml)
and [Model
perf](https://github.com/tenstorrent/tt-metal/actions/workflows/galaxy-model-perf-tests.yaml)
tests)
- [ ] other selection - specify runs
1 parent 5eac985 commit 927a540
File tree
28 files changed
+1831
-1071
lines changed- models/demos/deepseek_v3/tests/unit
- tests/ttnn/unit_tests/operations/reduce
- ttnn/cpp/ttnn/operations/reduction/topk
- device
- kernels
- compute
- dataflow
- docs
28 files changed
+1831
-1071
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | | - | |
20 | 25 | | |
21 | 26 | | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | | - | |
| 30 | + | |
24 | 31 | | |
25 | 32 | | |
26 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
27 | 36 | | |
28 | 37 | | |
29 | 38 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
| 53 | + | |
43 | 54 | | |
44 | 55 | | |
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
48 | | - | |
49 | | - | |
| 59 | + | |
50 | 60 | | |
51 | | - | |
| 61 | + | |
52 | 62 | | |
53 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| |||
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
67 | | - | |
68 | | - | |
69 | 79 | | |
70 | 80 | | |
71 | 81 | | |
| |||
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
96 | 109 | | |
97 | 110 | | |
98 | 111 | | |
| |||
116 | 129 | | |
117 | 130 | | |
118 | 131 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
| |||
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
189 | | - | |
190 | | - | |
| 196 | + | |
| 197 | + | |
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
| |||
0 commit comments