Pull Request has been successfully merged by CANN-robot.
(Thank you for zhengyaoff12's contribution.)变更摘要
本 PR 修复 sanitizer pass 对内核入口函数的识别方式。原先 SanitizerInstrumenter::Instrument 通过 func->name_ != program->name_ 判断入口,当 @pl.jit(name=...) 指定的名字与内核函数名不一致时无法匹配任何函数,导致插桩被静默跳过、隐藏的 sanitizer_log 与 sanitizer_log_capacity 参数未追加,而启动侧仍按新 ABI 传参,最终抛出误导性的 InvalidType: Expected 2 args, got 4。改动改为按函数类型结构性识别入口(前端为内核主体构建的 Opaque 函数),并新增入口唯一性校验与回归测试。
主要改动
- 入口识别改为按函数类型判定:
sanitizer_pass.cpp中将入口条件由func->name_ != program->name_(并显式排除SIMT_VF/SIMT_CALLEE)改为func->funcType_ != FunctionType::OPAQUE,使插桩入口与宿主侧定位内核入口的判据一致,避免因命名不一致而跳过插桩、破坏启动 ABI。 - 新增入口数量内部校验: 在
Instrument中累加entry_count,并通过PRO_PASS_INTERNAL_CHECK断言程序必须恰好包含一个Opaque入口函数,使插桩被跳过时不再静默。 - 补充命名内核回归测试:
test_sanitizer.py新增named_clean_kernel(@pl.jit(sanitizer=True, auto_mutex=True, name="sanitizer_named_entry_kernel"))与test_named_kernel_sanitizer_instrumented,验证name=与函数名不一致时仍能完成插桩并正常启动、结果正确。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| 9.2.0 | ✅ gcw_kUomxQ2l, gaoxiang618 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zhengyaoff12, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve
/lgtm


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/approve: gaoxiang618


The sanitizer pass identified the kernel entry function by comparing
func->name_withprogram->name_. When@pl.jit(name=...)differs from the kernel function name (e.g.@pl.jit(sanitizer=True, name="foo")decoratingdef kern(...)), no function in the program ever matched, and:block.sanitizer_logrecords were injected;sanitizer_log/sanitizer_log_capacityparameters were not appended to the kernel signature, while the launcher still passed them on every launch;InvalidType: Expected 2 args, got 4.Changes:
_get_kernel_ir_function), so the pass and the launch ABI can no longer disagreetest_named_kernel_sanitizer_instrumented) that launches a named@pl.jit(sanitizer=True)kernel whose name differs from the function nameVerification on Ascend950PR, full
python/tests/st/pypto_pro/frontend/sanitizer/test_sanitizer.py:InvalidType: Expected 2 args, got 4https://gitcode.com/cann/pypto/issues/3484