Skip to content

fix: upgrade legacy operator register contracts - #21

Closed
TruNcat3 wants to merge 1 commit into
mainfrom
fix/issue-19-register-signatures
Closed

TruNcat3 wants to merge 1 commit into
mainfrom
fix/issue-19-register-signatures

Conversation

@TruNcat3

@TruNcat3 TruNcat3 commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

自查

  • 核心八件齐全: README / REPORT / __init__.py(包化入口) / reference / register / example / kernel/ / test/(不新增算子;只升级既有 register)
  • 三层测试绿: test/{kernel,op,framework}_level.py(本环境无 Cambricon MLU;新增 CPU 单元契约测试 + 包化/脚本态导入回归)
  • 性能对照: script/bench_perf.py(native 参照)+ reports/ 更新(注册签名修复无 kernel 语义变化,不重采性能)
  • 黄金绿: goldendata/ + script/check_accuracy.py(无算子语义变化)
  • 包化回归绿: python3 ops/test_packaging.py(全算子导入扫描)
  • 多平台变更时: PLATFORM.md / MERGE.md 已同步(仍为单平台;chore: PR#5 的 13 个算子按新库约定补两项——register 签名升级 + 多平台文档(平台扩展前) #19 明确第二平台前可欠)
  • 署名一致: wt-YYYY-MM-DD-fix + # wt <邮箱>,commit 作者相同(本 PR 为库级修复,无新算法文件署名块)

说明

Fixes #19.

register contract

All 13 legacy Cambricon operators now expose:

register_a1(
    dispatch_key="AutogradPrivateUse1",
    counter: dict | None = None,
    platform: str | None = None,
)
  • optional counter["n"] increments at every intercepted aten call
  • explicit platform="cambricon" / "mlu" / "mlu590" is validated
  • supported dispatch keys are validated before creating a torch library
  • detach_, empty, and result_type intentionally remain non-registerable while accepting the new contract
  • kernel imports now use package-relative imports first and preserve standalone single-operator script mode fallback

CI repair

The newly added ops-packaging job is retained, and the truncated docs-and-syntax script is restored. Markdown links, Python syntax, YAML, intake manifest, and perf-baseline structure checks are active again.

验证

pytest tests/unit -q                 24 passed
ops package import scan              16/16
standalone register import           13/13
Markdown link check                  0 errors
Python syntax                        0 errors
YAML / intake / perf baseline        PASS
git diff --check                     PASS

No Cambricon MLU device is present in this execution environment, so hardware kernel/op/framework reruns were not possible. The change is registration-only and adds CPU-visible contract tests that fake the torch library to verify interception counters without globally registering aten ops.

@TruNcat3

TruNcat3 commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

误处理了:#19 属于 PR #5 的 13 个 Cambricon 算子维护者,不属于我们当前负责的三个计算算子范围。关闭此 PR,避免混淆 issue 范围。

@TruNcat3
TruNcat3 deleted the fix/issue-19-register-signatures branch October 7, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: PR#5 的 13 个算子按新库约定补两项——register 签名升级 + 多平台文档(平台扩展前)

1 participant