Fix: 修正单元素维 stride 的连续性判定 - #2146
Conversation
shape=(64, 1)、stride=(1, 64) 是合法连续列向量,但上游将 单元素维的 stride 与行主序期望值比较,导致 ChipTensor 及 HBG/TMR Tensor 误判为不连续,零拷贝 reshape 随之触发断言。 - 公共 ChipTensor 和 HBG/TMR 派生缓存统一忽略 size=1 维的 stride;其他维度继续严格检查,保持存储跨度与 ABI 不变。 - HBG 图元数据校验使用相同规则,继续拒绝伪造连续标志、 跨步存储的错误标志及错误 extent,避免合法图记录被拒绝。 - 增加 10 项 C++ 回归,覆盖外部参数转换、转置列向量、 零拷贝 reshape、真实空隙拒绝及图元数据校验;更新 ABI 文档。 上游验证: - PyPTO 747e1e4 固定 runtime 4e4d3a4 与 simpler 主线 d79c88c 均能复现:新增 10 项用例中 6 项失败、4 项通过。 - 修复后新增 10 项全部通过;同时运行既有 buffer 和 child_memory 的 23 项用例,总计 33 项通过。 - 使用当前独立工作树重新编译 CPU C++ 测试,无需 NPU。 本分支未执行 A5 真机、Python 套件或完整系统回归。 这是 0b852b1 修复语义在上游重构后的 Tensor 架构上的适配。 分支直接基于上游主线,不包含 fork 中其他 A5 L1 功能修改。
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change aligns tensor contiguity checks across runtime types and graph validation. Singleton dimensions no longer constrain strides. New tests cover storage extent, zero-copy reshape, wire validation, and rejection of gapped storage. ChangesContiguity rule alignment
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Singleton-stride tensor views now use the intended contiguity semantics without changing storage layout or ABI. Covered runtime, reshape, extent, and graph-validation cases show no remaining merge-blocking risk. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 6 files. (2 skipped: 2 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
shape=(64, 1)、stride=(1, 64) 是合法连续列向量,但上游将
单元素维的 stride 与行主序期望值比较,导致 ChipTensor 及
HBG/TMR Tensor 误判为不连续,零拷贝 reshape 随之触发断言。
上游验证:
这是 0b852b1 修复语义在上游重构后的 Tensor 架构上的适配。
分支直接基于上游主线,不包含 fork 中其他 A5 L1 功能修改。