Skip to content

Add 2026 spring T3-1-1 skill submission for qhl18#175

Open
qhl18 wants to merge 1 commit into
InfiniTensor:masterfrom
qhl18:2026-spring-qhl18-t3-1-1
Open

Add 2026 spring T3-1-1 skill submission for qhl18#175
qhl18 wants to merge 1 commit into
InfiniTensor:masterfrom
qhl18:2026-spring-qhl18-t3-1-1

Conversation

@qhl18

@qhl18 qhl18 commented Jul 11, 2026

Copy link
Copy Markdown

pytest output:

## Competition

- Track: T3-1-1 NineToothed .skill Innovation
- Participant: 钱泓林
- GitHub ID: qhl18
- Branch: 2026-spring-qhl18-t3-1-1
- Skill path: `skills/competition/ninetoothed-operator-skill/`

## Summary

- 指导 AI 智能体按固定流程完成 NineToothed 算子开发、测试、benchmark、调试和 PR 集成,避免凭零散经验写代码
- 覆盖 elementwise/broadcast、reduction/block、layout-sensitive、benchmark/debug 四类算子任务
- 核心工作流:需求理解 → 选择 DSL 表达 → 实现 → PyTorch reference 测试 → benchmark → generated source/AOT 检查 → 失败诊断 → PR 集成

## Scope and limitations

- Applicable tasks: elementwise/broadcast (add)、reduction/block (softmax)、layout-sensitive with non-contiguous/stride/offset (transpose_add)、benchmark/generated source/failing test 诊断
- Out of scope: 动态 shape、bfloat16/float64、修改 NineToothed 编译器核心、多 GPU/分布式

## Installation and usage

```bash
git clone https://github.com/InfiniTensor/ninetoothed.git
cd ninetoothed
pip install -e .
# 在 AI 编程工具中让 agent 读取 skills/competition/ninetoothed-operator-skill/SKILL.md
# 运行自测:
cd skills/competition/ninetoothed-operator-skill
pytest examples/task-01/test_add.py examples/task-02/test_softmax.py examples/task-03/test_transpose_add.py -v

Pytest output

Commands executed:

pytest skills/competition/ninetoothed-operator-skill/examples/task-01/test_add.py -v
pytest skills/competition/ninetoothed-operator-skill/examples/task-02/test_softmax.py -v
pytest skills/competition/ninetoothed-operator-skill/examples/task-03/test_transpose_add.py -v
ruff check skills/competition/ninetoothed-operator-skill/
ruff format --check skills/competition/ninetoothed-operator-skill/
python scripts/check_contributing_style.py

Observed results:

--- task-01/test_add.py ---
test_add_1d_same_shape[98432-dtype0-cuda] PASSED [ 20%]
test_add_2d_same_shape[512-512-dtype0-cuda] PASSED [ 40%]
test_add_2d_1d_broadcast[512-512-dtype0-cuda] PASSED [ 60%]
test_add_2d_row_broadcast[512-512-dtype0-cuda] PASSED [ 80%]
test_add_col_broadcast[512-512-dtype0-cuda] PASSED [100%]
============================== 5 passed in 9.55s ==============================

--- task-02/test_softmax.py ---
test_softmax_matches_pytorch[1823-781-dtype0-cuda] PASSED [ 20%]
test_softmax_matches_pytorch[37-129-dtype0-cuda] PASSED [ 40%]
test_softmax_matches_pytorch[4-1024-dtype0-cuda] PASSED [ 60%]
test_softmax_is_numerically_stable[dtype0-cuda] PASSED [ 80%]
test_softmax_rejects_non_2d[cuda] PASSED [100%]
============================== 5 passed in 1.94s ==============================

--- task-03/test_transpose_add.py ---
test_transpose_add_contiguous[257-129-dtype0-cuda] PASSED [ 20%]
test_transpose_add_contiguous[64-512-dtype0-cuda] PASSED [ 40%]
test_transpose_add_non_contiguous_input[dtype0-cuda] PASSED [ 60%]
test_transpose_add_empty_strided_input[dtype0-cuda] PASSED [ 80%]
test_transpose_add_rejects_bad_bias_shape[cuda] PASSED [100%]
============================== 5 passed in 10.73s =============================

Total: 15/15 passed

ruff check: All checks passed!
ruff format --check: 10 files already formatted
check_contributing_style.py: passed

说明:以上输出来自最终 commit a1902d5,全部测试在 GPU 上真实运行通过,无 skip、无失败。

Environment:

  • OS: Windows 11
  • GPU: NVIDIA GeForce RTX 5060 Laptop GPU (8GB)
  • CUDA: 12.8
  • Python: 3.12.13
  • NineToothed commit/version: 0.26.0

Self-test coverage

  • Elementwise/broadcast: add with broadcast,5/5 PASSED,覆盖 1D/2D same shape、2D+1D broadcast、row/column broadcast
  • Reduction/block: softmax,5/5 PASSED,覆盖非 2 的幂长度 (781,129)、长 block (1024)、数值稳定性、非 2D 拒绝
  • Layout-sensitive: transpose_add,5/5 PASSED,覆盖 contiguous、slicing non-contiguous、empty_strided 自定义 stride、错误 bias shape 异常
  • Performance/diagnosis: add benchmark same/vector/row 三档 + row broadcast 未 expand 导致 arrangement shape 不一致的失败诊断与修复闭环

With-skill vs no-skill comparison

  • Protocol: 同一 AI agent、同一 NineToothed 仓库、同类算子任务和相同时间预算下,对比安装 skill 前后的表现
  • No-skill result: 测试常遗漏或写法不规范、常只测 contiguous、benchmark 常缺失、失败时大改无记录、合规披露易遗漏
  • With-skill result: 固定 PyTorch reference + GPU 验证、强制 non-contiguous/stride/offset 测试、固定 warmup/sync/baseline/ratio benchmark 框架、分类排查 + 文档化诊断闭环、REFERENCE + HONOR_CODE 模板
  • Conclusion and limitations: skill 显著提升测试覆盖率、性能意识和合规性;局限在于 softmax 仍为 naive 实现 (ratio=1187x),性能优化空间较大

Signed disclosures

  • HONOR_CODE.md: skills/competition/ninetoothed-operator-skill/HONOR_CODE.md (signed by 钱泓林, 2026-07-07)
  • REFERENCE.md: skills/competition/ninetoothed-operator-skill/REFERENCE.md (官方资料、外部代码、AI 辅助范围均已披露)

Proposal and final report

  • Proposal: 初赛阶段已提交,如有公开链接将补充
  • Final report: skills/competition/ninetoothed-operator-skill/reports/钱泓林_九齿skill创新挑战_T3-1-1_赛题报告.pdf
  • Evidence/self-test material: 真实 pytest/benchmark 输出已贴入上方 Pytest output;原始日志本地保留

Compliance

  • No API keys or credentials
  • No hidden answers or hard-coded evaluation task names
  • No deleted, weakened, or bypassed tests
  • No fabricated benchmark results
  • References and AI assistance are disclosed

Known limitations

  • 不覆盖动态 shape(需 shape guard,超出固定 tile 模式)
  • 未完整验证 bfloat16/float64
  • softmax (T2) 为 naive 实现,ratio=1187x,有较大优化空间
  • 自测为单 GPU 环境,未覆盖多 GPU/分布式

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.

1 participant