Human Notes:
Previously all datapaths use runtime trip counts, which allows a single kernel to
service all N values without recompile. We will be adding in fixed-ordering (inner-tree)
reductions which instead will require compile-time trip counts. This functionality is
added as an optional thing when required.
Codex:
Add an opt-in reduction order whose addition DAG depends only on N and
reproduces the existing ATen inner-tree sum/prod bits. Static fragments,
streaming carries, ascending lane butterflies, and N-specific launch plans
preserve that DAG while reusing the shared load, projection, and store body.
This fixed order is the stack's basis for eager/Inductor bitwise parity.
The default rolled folds remain runtime-shaped and continue sharing kernels
by vector class. The fixed order compiles per N, covers all reference plan
shapes, and rejects explicit requests it cannot honor rather than silently
using another order. Golden hashes and differential tests pin all plan
shapes, four dtypes, sum/prod, signed zero, batch independence, routing, and
multi-field traits.
Review the static datapath in `tile.py`, the plans in `kernel_rowtile.py`,
then the host and device tests.
Test Plan:
```
spin quicklint
python test/python_native/test_tile_datapath.py
python test/python_native/test_inner_tree_order.py
python test/python_native/test_kernel_rowtile.py
```
Authored with assistance from an AI coding agent.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/195059
Approved by: https://github.com/ngimel
ghstack dependencies: #195052, #195056, #195051