Skip to content

fix(vmi): allow PtrType sources through contiguous load preflight check - #1475

Closed
TelGome wants to merge 10 commits into
hw-native-sys:masterfrom
TelGome:issue_1374
Closed

TelGome wants to merge 10 commits into
hw-native-sys:masterfrom
TelGome:issue_1374

Conversation

@TelGome

@TelGome TelGome commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

剩余24 cases 的整数 simulator RV_VMULA/type.S8 失败属于独立的 simulator 能力问题
fix #1374

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning: @TelGome, ci-sim exceeded its soft runtime budget.

  • vpto-sim-validation runtime: 4h 51m 7s
  • Soft budget: 1h 30m
  • Job conclusion: failure
  • Workflow run

This warning is advisory only and does not affect required checks. Please inspect the step timings for an unexpected regression.

@github-actions github-actions Bot added the ci-slow this pr make ci too slow, makesure your pr doesn't cause this label Sep 17, 2026
@TelGome TelGome changed the title fix(vmi): fix VMI vmula layout and masked lowering fix(vmi): allow PtrType sources through contiguous load preflight check Sep 17, 2026
yexiaosu and others added 10 commits September 17, 2026 21:03
…ries

Co-authored-by: yexiaosu<yexiaosu0313@gmail.com>



# message auto-generated for no-merge-commit merge:
!188 merge codex/reduce-transforms-dir-nodes into master

refactor(transforms): group Transforms sources into module subdirectories

Created-by: yexiaosu
Commit-by: yexiaosu
Merged-by: cann-robot
Description: 
<!-- 感谢您的合入申请! -->

### 当前PR是否有AI参与:   
[x]  否     

[ ]  是   
__1.  AI Agent 平台:    
__2.  AI 模型:  
__3.  Prompt上下文 : 


### PR功能描述 / 为什么需要这个合入**:  
<!-- 本 PR 做了什么,为什么需要 / What does this PR do and why -->     
       
    
### 该PR关联的issue   
*(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes #

### 希望检视人员了解:


## 改动类型 / Change Type

- [ ] Bug 修复 / Bug Fix
- [ ] 新功能 / New Feature
- [ ] 性能优化 / Performance
- [ ] 代码重构 / Refactoring
- [ ] 文档更新 / Documentation
- [ ] 测试相关 / Test
- [ ] 其它 / Other


## 测试信息 / Testing

<!-- 简要测试说明或关键结果 / Brief test description or key results -->

- [ ] 单元测试通过 / UT passed
- [ ] 集成测试通过 / ST passed
- [ ] 人工验证通过 / Manual verified

## 检查清单 / Checklist

- [ ] 代码符合规范 / Code follows style guide
- [ ] 测试添加并通过 / Tests added and passed
- [ ] 文档已更新 / Docs updated if needed
- [ ] 无硬编码敏感信息 / No secrets hardcoded
- [ ] 提交信息符合规范 / Commit message follows convention

See merge request: cann/pto-as!188
Co-authored-by: cui_jiahao<cuijiahao5@h-partners.com>



# message auto-generated for no-merge-commit merge:
!196 merge master into master

切换gcc15

Created-by: cui_jiahao
Commit-by: cui_jiahao
Merged-by: cann-robot
Description: 
<!-- 感谢您的合入申请! -->

### 当前PR是否有AI参与:   
[x]  否     

[ ]  是   
__1.  AI Agent 平台:    
__2.  AI 模型:  
__3.  Prompt上下文 : 


### PR功能描述 / 为什么需要这个合入**:  
<!-- 本 PR 做了什么,为什么需要 / What does this PR do and why -->     
       
    
### 该PR关联的issue   
*(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes #

### 希望检视人员了解:


## 改动类型 / Change Type

- [ ] Bug 修复 / Bug Fix
- [ ] 新功能 / New Feature
- [ ] 性能优化 / Performance
- [ ] 代码重构 / Refactoring
- [ ] 文档更新 / Documentation
- [ ] 测试相关 / Test
- [ ] 其它 / Other


## 测试信息 / Testing

<!-- 简要测试说明或关键结果 / Brief test description or key results -->

- [ ] 单元测试通过 / UT passed
- [ ] 集成测试通过 / ST passed
- [ ] 人工验证通过 / Manual verified

## 检查清单 / Checklist

- [ ] 代码符合规范 / Code follows style guide
- [ ] 测试添加并通过 / Tests added and passed
- [ ] 文档已更新 / Docs updated if needed
- [ ] 无硬编码敏感信息 / No secrets hardcoded
- [ ] 提交信息符合规范 / Commit message follows convention

See merge request: cann/pto-as!196
Co-authored-by: HecreReed<zhangstevenunity@sina.com>



# message auto-generated for no-merge-commit merge:
!195 merge codex/issue1546-public-interfaces into master

fix(emitc): use public synchronization interfaces (hw-native-sys#1546)

Created-by: zhongxuan1
Commit-by: HecreReed
Merged-by: cann-robot
Description: Generated C++ for cross-core synchronization uses private CCE entry points and fails to compile with downstream public headers. Emit ffts_cross_core_sync and wait_flag_dev for static/dynamic and named/direct operations; use public set_intra_block/wait_intra_block on A5. Match A5's two-argument wait contract and encode its FFTS mode without the unavailable FFTS_MODE_VAL macro. Add regressions and a generated-interface inventory in docs/designs/generated-public-interface-audit.md.

Validation: full lit suite 1931 passed, 1 unsupported; DSL CTest 45 passed; 18 public-declaration-only synchronization consumers compiled and 18 other generated sources audited; 12 paired CPU ISA FFTS tests passed with private declarations poisoned; six real CANN 9.0-beta1 CCE compilations covered A2/A3/A5 cube/vector; equivalent public/private probes produced identical instruction bytes. General scalar builtins remain covered. Full textual suites ran without ASCEND_HOME_PATH because this installed CANN beta1 does not support current VPTO beta2 ABI.

Draft: downstream model acceptance remains open. Pinned PyPTO emits obsolete pto.load_scalar/pto.store_scalar and cannot compile unchanged; derived IR with only scalar-op syntax migration compiles with public synchronization calls. Separate downstream SyncAll CPU runs encounter a hard-case failure and cleanup segmentation fault. These failures are not established as caused or fixed by this change, and no end-to-end model numerical pass is claimed. Dependency pins, toolchain differences, and evidence are recorded in the audit document.

Refs hw-native-sys#1546

See merge request: cann/pto-as!195
Co-authored-by: andodo<sunkexin3@huawei.com>



# message auto-generated for no-merge-commit merge:
!208 merge cleancode-260918 into master

Cleancode - onetrack 20+6.

Created-by: andodo
Commit-by: andodo
Merged-by: cann-robot
Description: 
<!-- 感谢您的合入申请! -->

### 当前PR是否有AI参与:   
[x]  否     

[ ]  是   
__1.  AI Agent 平台:    
__2.  AI 模型:  
__3.  Prompt上下文 : 


### PR功能描述 / 为什么需要这个合入**:  
<!-- 本 PR 做了什么,为什么需要 / What does this PR do and why -->     
       
    
### 该PR关联的issue   
*(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes #

### 希望检视人员了解:


## 改动类型 / Change Type

- [ ] Bug 修复 / Bug Fix
- [ ] 新功能 / New Feature
- [ ] 性能优化 / Performance
- [ ] 代码重构 / Refactoring
- [ ] 文档更新 / Documentation
- [ ] 测试相关 / Test
- [ ] 其它 / Other


## 测试信息 / Testing

<!-- 简要测试说明或关键结果 / Brief test description or key results -->

- [ ] 单元测试通过 / UT passed
- [ ] 集成测试通过 / ST passed
- [ ] 人工验证通过 / Manual verified

## 检查清单 / Checklist

- [ ] 代码符合规范 / Code follows style guide
- [ ] 测试添加并通过 / Tests added and passed
- [ ] 文档已更新 / Docs updated if needed
- [ ] 无硬编码敏感信息 / No secrets hardcoded
- [ ] 提交信息符合规范 / Commit message follows convention

See merge request: cann/pto-as!208
Co-authored-by: HecreReed<zhangstevenunity@sina.com>



# message auto-generated for no-merge-commit merge:
!197 merge codex/tload-bypass-offset into master

fix: apply tload L2 bypass offsets in EmitC

Created-by: zhongxuan1
Commit-by: HecreReed
Merged-by: cann-robot
Description: ### 当前 PR 是否有 AI 参与

- [x] 否
- [ ] 是
1. AI Agent 平台:OpenAI Codex。
2. AI 模型:当前 Codex 会话未提供可核验的具体模型标识。
3. Prompt 上下文:为 tload IR 增加可选 offset;l2_bypass 时由 PTOAS 修正 addr + offset 后调用普通 PTO ISA load;仅关注 EmitC 路径并提交 PR。

### PR 功能描述 / 为什么需要这个合入

EmitC 原先将 L2 bypass 转发为 PTO ISA 的 TLoadL2Hint 模板参数。本次在 pto.tload 中增加可选字节偏移 offset,由 PTOAS 在 EmitC 转换时修正源地址,然后调用普通 TLOAD,避免依赖 PTO ISA 的 bypass load 重载。

offset 支持 i64 或 index,默认 0,仅在 cache_policy = l2_bypass 时生效。修正使用源 GlobalTensor 描述符的副本,保留 shape、stride 和 layout,让同一源后续的普通加载继续使用原地址。

### 该 PR 关联的 issue

无。

### 希望检视人员了解

- 省略 offset 或传 0 时,加载地址不变;普通缓存策略忽略 offset。
- 同步更新 IR 构造调用、Python 接口回归和指令说明。
- 回归覆盖动态偏移、64 位大偏移、零偏移、非法类型以及源视图复用。

## 改动类型 / Change Type

- [x] Bug 修复 / Bug Fix
- [x] 新功能 / New Feature
- [ ] 性能优化 / Performance
- [ ] 代码重构 / Refactoring
- [x] 文档更新 / Documentation
- [x] 测试相关 / Test
- [ ] 其它 / Other

## 测试信息 / Testing

- PTOASPythonPackage 完整构建通过。
- 13 项相关 lit 回归通过,包括新增 3 项及现有 10 项。
- pto_tload_cache_policy_bindings Python 接口测试通过。
- A3/A5 的 level2、level3 生成 C++ 均通过 Bisheng aicore 编译;A5 使用本地已有固定版 PTO ISA 头文件。
- 代码合规检查:5 个文件,0 errors,0 warnings;git diff --check 通过。

- [x] 单元测试通过 / UT passed
- [ ] 集成测试通过 / ST passed
- [x] 人工验证通过 / Manual verified

## 检查清单 / Checklist

- [x] 代码符合规范 / Code follows style guide
- [x] 测试添加并通过 / Tests added and passed
- [x] 文档已更新 / Docs updated if needed
- [x] 无硬编码敏感信息 / No secrets hardcoded
- [x] 提交信息符合规范 / Commit message follows convention


See merge request: cann/pto-as!197
…#1533)

Co-authored-by: hecrereed<821896444@qq.com>



# message auto-generated for no-merge-commit merge:
!171 merge feature/remove-memref-copy-legacy-path into master

fix: retire unused convert-to-pto-op pass (GitHub issue hw-native-sys#1533)

Created-by: hecrereed
Commit-by: hecrereed
Merged-by: cann-robot
Description: `convert-to-pto-op` 对合法的 rank-0 `memref.subview` 输入会在旧 `memref.copy` lowering 中索引空 offsets,触发断言并终止进程(GitHub issue [hw-native-sys#1533](https://github.com/hw-native-sys/PTOAS/issues/1533))。本次完整移除该遗留 pass;`pto-test-opt --help` 不再列出它,显式使用旧参数或在 `--pass-pipeline` 中指定它会返回明确诊断和非零退出码。

## 删除依据

- 当前正常 `ptoas` 编译流水线不调用 `createConvertToPTOOpPass`;仓库内没有依赖它的业务调用。
- `memref.copy` 转换直接将 memref 操作数传给 PTO 搬运操作,已不满足当前类型约束。
- 剩余 `bufferization.materialize_in_destination` 转换同样直接传递 tensor/memref 操作数,而当前 `TStoreOp` 自定义 verifier 要求源为 `tile_buf`、目标为 `partition_tensor_view`,因此也不再是有效转换路径。

## 改动

- 删除整个 `ConvertToPTOOp.cpp`,移除 CMake 源文件条目、`Passes.h` factory 声明和 `Passes.td` 定义/生成注册入口。
- 在发布说明中记录 pass 和 factory 的移除。
- 新增 lit 回归,保留 issue hw-native-sys#1533 的 rank-0 输入,验证帮助列表不包含旧 pass、直接参数和 pipeline 名称均被拒绝、原合法 IR 仍可正常解析。

## 验证

在独立远端 aarch64 工作区使用 LLVM 19.1.7、GCC 12.3 完成:

- 全新构建 `pto-test-opt`、`ptoas_runtime_deps` 和 `pto-vpto-scheduler-tracker-test` 通过。
- 新增 `issue1533_convert_to_pto_op_removed.pto` 回归通过(4 条 RUN)。
- 5 个相关 lit 测试通过:retired memref bridge、tassign memref 拒绝、tile 内存规划、tload cache policy、tstore EmitC forms。
- `VectorAddition/vadd.pto` 分别以 A3/A5 EmitC 生成 C++ 成功,输出包含 `TLOAD/TADD/TSTORE`。
- changed-code 检查:0 errors / 0 warnings;`git diff --check` 通过。

构建告警位于外部 LLVM Python bindings 的 `IRModule.h`(`-Waddress`)及 LTO 串行任务提示;本次修改的源码未产生编译告警。以上为主机端构建、lit 和代码生成验证,未运行板测。


See merge request: cann/pto-as!171
checkSupportedContiguousLoadAddress rejected non-aligned PtrType sources
because computeSafeStatefulReadProof only handles MemRefType and returns
a failure proof.  However, materializeUnalignedContiguousParts (introduced
by 5eb87c2) handles PtrType via materializeBufferPointer and needs no
static extent proof -- it resolves alignment at runtime via the vldas+vldus
stateful stream.

Add an early-success return for PtrType sources so that the stateful
fallback path introduced by 5eb87c2 is actually reachable for these loads.
Update the alignment lit tests to reflect the new behavior: PtrType
non-aligned loads now lower to vldas+vldus instead of being rejected.

Fixes: 54 sim test failures in vmi_vmula for small VL (vl=2/4/8) across
bf16/f16/f32/i16/i32/i8 where UB offsets were not provably 32B-aligned.
343742b allowed PtrType sources to pass the contiguous load preflight
check and use the vldas+vldus stateful fallback instead of being rejected.
Two tests still expected the old failure behaviour:

- vmi_short_vector_load_over_block_f32_invalid.pto: drop `not`, verify
  the stateful lowering emits vldas+vldus and no vsldb.
- check_histogram_scatter_lanes.py: the 33-byte case (no valid lowering)
  keeps succeeds=False; the three PtrType misaligned cases now succeed via
  the stateful path and are updated accordingly.
@TelGome TelGome closed this Sep 18, 2026
@TelGome
TelGome deleted the issue_1374 branch September 18, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-slow this pr make ci too slow, makesure your pr doesn't cause this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PTODSL-vmi,vmula 的 accumulator 操作数错误绑定为 rhs

4 participants