Fix #249: subset valid-shape inference with dynamic offsets#257
Fix #249: subset valid-shape inference with dynamic offsets#257TaoTao-real wants to merge 1 commit intozhangstevenunity:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0733a11f2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else { | ||
| vdim = kDynamicValidDim; | ||
| } | ||
| vdim = std::min<int64_t>(sizeDim, pv); |
There was a problem hiding this comment.
Preserve static-offset clipping in subset valid-shape inference
The new inference path ignores subset offsets entirely and always uses min(size, parentValid), which regresses constant-offset cases where the valid region should shrink. For example, with parent v_col=32, sizes=[...,32], and a static col offset of 16, this now infers v_col=32 instead of 16; that overstates validity and diverges from the lowering path (computeSubsetValidDim in PTOViewToMemref) that still applies offset-based clipping. This can make earlier IR passes treat padded elements as valid and produce inconsistent metadata across the pipeline.
Useful? React with 👍 / 👎.
Summary
pto.subsetreturn type inference so valid-shape inference does not depend on subset offsets.test/basic/subset_infer_dynamic_offset.mlirto cover dynamic offset + static result type.Motivation
Design
SubsetOp::inferReturnTypes, derive resultvalidShapeonly from:sizesvalidShapeTesting
/tmp/PTOAS_upstream_compare_20260312_165206/build/tools/ptoas/ptoas test/basic/subset_infer_dynamic_offset.mlir(pass)101.245.68.6(2026-03-12):mainbaseline:OK=150 FAIL=3 SKIP=7main + this fix:OK=150 FAIL=3 SKIP=7plan_memory_scopes_independent,prelu,print), no new regressions.Risk / Rollback
Review Focus
SubsetOp::inferReturnTypesno longer uses offsets to derive valid dims.