Problem
pto.subset is described as a strided view inheriting source strides, but lowering rewrites result strides to contiguous [child_width, 1].
Evidence
- ODS description says inherited strides:
include/PTO/IR/PTOOps.td:168
- Lowering hardcodes child strides:
lib/PTO/Transforms/PTOViewToMemref.cpp:527
lib/PTO/Transforms/PTOViewToMemref.cpp:533
lib/PTO/Transforms/PTOViewToMemref.cpp:542
Repro
build/tools/ptoas/ptoas test/samples/_out/Subset/subset-pto-ir.pto
Observed lowering output includes:
- parent:
memref<32x64xf32, strided<[64, 1], ...>
- child subset:
to memref<32x32xf32, strided<[32, 1], ...>
Why this is risky
For parent 32x64 and child 32x32, row step changes from 64 to 32, so address formula changes for rows > 0.
Expected behavior
Either:
- Preserve view semantics by keeping source-compatible strides, or
- Explicitly materialize contiguous memory (alloc+copy) if contiguous child layout is intended.
Acceptance criteria
- Decide and document canonical subset semantics.
- Align ODS docs + lowering implementation.
- Add regression test proving row-stride correctness for
32x64 -> subset 32x32.