1 Commits
Author SHA1 Message Date
Simon Layton b1e0adad7e [_native][5/8] Add general, column, and cross-CTA reductions (#195051)
Human Notes:

Complete axis coverage and add the multi-CTA path for large rows.

Codex:

Complete axis coverage on the shared reduction body. The general driver
represents TensorIterator geometry as runtime extent/stride pairs, allowing
one structural kernel to serve arbitrary dimensions and layouts. The column
driver vectorizes kept-axis outputs and splits tall reduced axes into
partials.

The cross-CTA driver serves few-row, large-N reductions with two fused
launches. Exact divisor splits use the optimized row body; the general
ragged split preserves coverage and global indices for prime lengths. The
dispatcher now routes row, column, cross-CTA, reduce-all, and arbitrary-axis
cases without adding a second general device kernel.

Review `tile.py` and `kernel_general.py` before `kernel_coltile.py` and
`kernel_xcta.py`.

Test Plan:

```
spin quicklint
python test/python_native/test_kernel_general.py
python test/python_native/test_kernel_xcta.py
python test/python_native/test_kernel_rowtile.py
python test/python_native/test_kernel_coltile.py
```

Authored with assistance from an AI coding agent.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/195051
Approved by: https://github.com/drisspg
ghstack dependencies: #195052, #195056
2026-10-02 11:24:18 +00:00