ops-tune-workbench-plugin 0.0.0-stage → 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +14 -0
- package/README.md +39 -2
- package/cordis.patch.yml +20 -0
- package/lib/client.js +4253 -0
- package/lib/host.js +2518 -0
- package/package.json +53 -4
- package/skills/tool-ops-tune/INSTALL.md +52 -0
- package/skills/tool-ops-tune/README.md +167 -0
- package/skills/tool-ops-tune/SKILL.md +93 -0
- package/skills/tool-ops-tune/agent/AGENTS.md +195 -0
- package/skills/tool-ops-tune/agent/agents/perf-implementer.md +68 -0
- package/skills/tool-ops-tune/agent/agents/perf-reviewer.md +86 -0
- package/skills/tool-ops-tune/agent/workflows/task-prompts.md +362 -0
- package/skills/tool-ops-tune/agent/workflows/troubleshooting.md +43 -0
- package/skills/tool-ops-tune/docs/figures/opstune-architecture.png +0 -0
- package/skills/tool-ops-tune/docs/figures/opstune-architecture.svg +253 -0
- package/skills/tool-ops-tune/docs/ops-tune-design.md +404 -0
- package/skills/tool-ops-tune/docs//347/224/250/344/276/213/346/236/204/345/273/272.md +714 -0
- package/skills/tool-ops-tune/docs//347/237/245/350/257/206/345/272/223/350/247/204/350/214/203.md +103 -0
- package/skills/tool-ops-tune/evals/evals.json +242 -0
- package/skills/tool-ops-tune/ops-collect/SKILL.md +146 -0
- package/skills/tool-ops-tune/ops-collect/references/tool-routing.md +86 -0
- package/skills/tool-ops-tune/ops-collect/scripts/collect_board.sh +444 -0
- package/skills/tool-ops-tune/ops-collect/scripts/collect_cases.py +368 -0
- package/skills/tool-ops-tune/ops-collect/scripts/collect_sim.sh +134 -0
- package/skills/tool-ops-tune/ops-collect/scripts/csv_to_db.py +314 -0
- package/skills/tool-ops-tune/ops-collect/scripts/db_bench.py +545 -0
- package/skills/tool-ops-tune/ops-collect/scripts/facts_bridge.py +1063 -0
- package/skills/tool-ops-tune/ops-collect/scripts/isolation_test.py +454 -0
- package/skills/tool-ops-tune/ops-collect/scripts/jsonl_to_cases.py +163 -0
- package/skills/tool-ops-tune/ops-family/SKILL.md +76 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/advanced_tiling.md +92 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/broadcast_design.md +160 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/code/broadcast_add_kernel.cpp +126 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/code/broadcast_add_tiling.cpp +144 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/code/broadcast_tiling_common.h +401 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/code/onedim_add_kernel.cpp +107 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/code/onedim_add_tiling.cpp +64 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/datacopypad_design.md +46 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/guide.md +14 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/nddma_design.md +53 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/onedim_design.md +114 -0
- package/skills/tool-ops-tune/ops-family/references/broadcast/ub_broadcast_design.md +67 -0
- package/skills/tool-ops-tune/ops-family/references/common/datacopy_optimization_design.md +351 -0
- package/skills/tool-ops-tune/ops-family/references/common/index.md +9 -0
- package/skills/tool-ops-tune/ops-family/references/common/tail_block_design.md +268 -0
- package/skills/tool-ops-tune/ops-family/references/common/timing_harness/index.md +38 -0
- package/skills/tool-ops-tune/ops-family/references/common/timing_harness/timing_harness_aclrt_event.cpp +199 -0
- package/skills/tool-ops-tune/ops-family/references/common/timing_harness/timing_harness_torch_event.py +130 -0
- package/skills/tool-ops-tune/ops-family/references/common/ub_resident_design.md +342 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/guide.md +69 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/index.md +4 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_base.template +81 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_big_dim.template +217 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_cut_one_axis.template +336 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_cut_two_axis.template +781 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_n_last.template +340 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_small_shape.template +321 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_tensor_move.template +102 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_transdata_5hd.template +480 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_transdata_5hd_021axis.template +533 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_with_gather.template +688 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/templates/transpose_tiling_data.template +192 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_big_dim.md +220 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_cut_one_axis.md +175 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_cut_two_axis.md +177 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_fusion_design.md +398 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_gather.md +191 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_n_last.md +276 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_small_shape.md +315 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_tensor_move.md +203 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_tiling_data.md +176 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_vconv_021.md +206 -0
- package/skills/tool-ops-tune/ops-family/references/conversion/transpose_vconv_5hd.md +179 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/double_buffer_design.md +288 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/guide.md +46 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/index.md +10 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/CMakeLists.txt +131 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/README.md +55 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_extension/add_custom_torch.cpp +80 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_extension/ops.h +23 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_extension/register.cpp +30 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_host/add_custom.asc +149 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_host/data_utils.h +97 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_kernel/add_custom_kernel.asc +136 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_kernel/add_custom_tiling.h +31 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/run.sh +86 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/gen_data.py +70 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/golden.py +34 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/test_torch.py +99 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/verify_result.py +56 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/templates/usage_guide.md +61 -0
- package/skills/tool-ops-tune/ops-family/references/elementwise/vector_efficiency_design.md +203 -0
- package/skills/tool-ops-tune/ops-family/references/fa/fa_mixed_kernel_design.md +174 -0
- package/skills/tool-ops-tune/ops-family/references/fa/fa_roofline_design.md +141 -0
- package/skills/tool-ops-tune/ops-family/references/fa/guide.md +87 -0
- package/skills/tool-ops-tune/ops-family/references/knowledge_gaps.json +56 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/best-practices-guide.md +14 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/fullload_design.md +344 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/guide.md +52 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/mte2_preload_design.md +320 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/pingpong_design.md +254 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/scale_coalescing_design.md +282 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/streamk_design.md +374 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/swat_design.md +423 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/templates/matmul_basic_blaze.template +165 -0
- package/skills/tool-ops-tune/ops-family/references/matmul/templates/usage_guide.md +29 -0
- package/skills/tool-ops-tune/ops-family/references/mc2/best-practices-guide.md +43 -0
- package/skills/tool-ops-tune/ops-family/references/mc2/guide.md +42 -0
- package/skills/tool-ops-tune/ops-family/references/mc2/local_matmul_design.md +130 -0
- package/skills/tool-ops-tune/ops-family/references/mc2/pipeline_balancing_design.md +502 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/guide.md +178 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/kernel_utils.template +75 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ar_full_load.template +429 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ar_recompute.template +485 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ar_small_r.template +348 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ara_full_load.template +574 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ara_online.template +324 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ara_recompute.template +436 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_base.template +950 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/fused_attention_online_softmax_design.md +428 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ar_full_load.md +137 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ar_recompute.md +135 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ar_small_r.md +122 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ara_full_load.md +144 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ara_online.md +185 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ara_recompute.md +163 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_tiling.template +460 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_tiling_data.template +278 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/state_resident_design.md +337 -0
- package/skills/tool-ops-tune/ops-family/references/reduce/templates/usage_guide.md +253 -0
- package/skills/tool-ops-tune/ops-family/references/scalar/coding_principles.md +476 -0
- package/skills/tool-ops-tune/ops-family/references/scalar/conv_scalar.md +163 -0
- package/skills/tool-ops-tune/ops-family/references/scalar/guide.md +30 -0
- package/skills/tool-ops-tune/ops-family/references/simt/guide.md +91 -0
- package/skills/tool-ops-tune/ops-family/references/simt/optimization-guide.md +110 -0
- package/skills/tool-ops-tune/ops-family/references/sort/guide.md +83 -0
- package/skills/tool-ops-tune/ops-family/references/sort/radix_sort.md +354 -0
- package/skills/tool-ops-tune/ops-family/scripts/family_asset_audit.py +68 -0
- package/skills/tool-ops-tune/ops-family/scripts/tiling_candidates.py +419 -0
- package/skills/tool-ops-tune/ops-mechanism/SKILL.md +23 -0
- package/skills/tool-ops-tune/ops-mechanism/cases/ascendc/case_groupedmatmul_pipeline.md +23 -0
- package/skills/tool-ops-tune/ops-mechanism/cases/ascendc/case_triton_atomic_revert.md +19 -0
- package/skills/tool-ops-tune/ops-mechanism/cases/mc2/case_mc2_fusion.md +19 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/api-usage.md +70 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/ascendc-regbase-vf.md +45 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/ascendc-tiling.md +51 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/data-copy.md +67 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/index.md +45 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/mc2-balancing.md +77 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/mc2.md +103 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/memory-hierarchy.md +40 -0
- package/skills/tool-ops-tune/ops-mechanism/references/optimize/pipeline.md +95 -0
- package/skills/tool-ops-tune/ops-mechanism/scripts/case_backfill.py +170 -0
- package/skills/tool-ops-tune/ops-mechanism/scripts/log_gap.py +145 -0
- package/skills/tool-ops-tune/ops-mechanism/scripts/mc2_search.py +367 -0
- package/skills/tool-ops-tune/ops-report/SKILL.md +77 -0
- package/skills/tool-ops-tune/ops-verdict/evals/run_evals.py +837 -0
- package/skills/tool-ops-tune/ops-verdict/evals/smoke/install-hooks.sh +65 -0
- package/skills/tool-ops-tune/ops-verdict/evals/smoke/run_smoke.sh +405 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/core_tail_a5.csv +25 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/few_cores_a5.csv +5 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/mte2_bound_a2.csv +17 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/multi_kernel_mix_a5.csv +7 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/no_bound_a5.csv +9 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/serial_no_overlap_a2.csv +9 -0
- package/skills/tool-ops-tune/ops-verdict/fixtures/vec_bound_a5.csv +9 -0
- package/skills/tool-ops-tune/ops-verdict/references/io-contracts.md +94 -0
- package/skills/tool-ops-tune/ops-verdict/references/rule-schema.md +130 -0
- package/skills/tool-ops-tune/ops-verdict/references/scope-schema.md +61 -0
- package/skills/tool-ops-tune/ops-verdict/references/soc-spec.yaml +140 -0
- package/skills/tool-ops-tune/ops-verdict/rules/L0-instruction.yaml +67 -0
- package/skills/tool-ops-tune/ops-verdict/rules/L1-single-core.yaml +316 -0
- package/skills/tool-ops-tune/ops-verdict/rules/L2-inter-core.yaml +173 -0
- package/skills/tool-ops-tune/ops-verdict/rules/L3-inter-card.yaml +156 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/batch_pipeline.py +444 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/calibrate.py +249 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/delta_compare.py +244 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/render_html.py +274 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/snapshot.py +200 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/trace_bubble.py +331 -0
- package/skills/tool-ops-tune/ops-verdict/scripts/verdict.py +1072 -0
- package/skills/tool-ops-tune/scripts/diff_audit.py +281 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-reviewer
|
|
3
|
+
description: 调优实施独立审查者。对 perf-implementer 的优化副本做独立构建验证、单变量符合性审查(消费 diff_audit.json)、模板保真检查(MicroAPI VF 降级检测)与精度复核。多 KEEP 仲裁前必须通过。不做性能采集(主 agent 垄断)、不做判定(ops-verdict 垄断)。
|
|
4
|
+
mode: subagent
|
|
5
|
+
skills:
|
|
6
|
+
- ops-family
|
|
7
|
+
- ops-verdict
|
|
8
|
+
permission:
|
|
9
|
+
bash: allow
|
|
10
|
+
read: allow
|
|
11
|
+
write: allow
|
|
12
|
+
external_directory: allow
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# 调优实施独立审查者(perf-reviewer)
|
|
16
|
+
|
|
17
|
+
## 身份
|
|
18
|
+
|
|
19
|
+
对 perf-implementer 交付的**单个优化副本**做独立审查:构建验证、单变量符合性、
|
|
20
|
+
模板保真、精度复核。对齐代码审查独立评审裁位、聚焦调优域——**审查对象是
|
|
21
|
+
「这一轮改动是否只做了方案卡声明的这一件事、且做对了」**,不是全面代码评审。
|
|
22
|
+
|
|
23
|
+
独立性纪律:不与 perf-implementer 对话协商结论;发现问题直接写进审查报告,
|
|
24
|
+
由主 agent 仲裁。审查结论四档:PASS / PASS WITH NOTES(记录但不阻塞)/
|
|
25
|
+
FAIL(该轮必须处置后才可进对比)/ UNATTRIBUTABLE(diff 越界,该轮收益
|
|
26
|
+
禁止进 KEEP 仲裁——消费 diff_audit 的机器判定,不推翻)。
|
|
27
|
+
|
|
28
|
+
## 输入
|
|
29
|
+
|
|
30
|
+
- 方案卡条目(mechanism / target_rule / diff_sketch / diff_sketch_files /
|
|
31
|
+
semantic_risk / precision_plan / rollback_if / template)
|
|
32
|
+
- 基线源码目录 + 优化副本目录
|
|
33
|
+
- diff_audit.json(主 agent 在审查前运行 `scripts/diff_audit.py` 产出)
|
|
34
|
+
- cases.csv(全量精度复核范围)
|
|
35
|
+
|
|
36
|
+
## 输出
|
|
37
|
+
|
|
38
|
+
`{output_dir}/review/{mechanism}.md` 审查报告,固定六段:
|
|
39
|
+
|
|
40
|
+
1. **构建验证**(独立重编,不复用 implementer 的构建产物)
|
|
41
|
+
2. **单变量符合性**(diff_audit.json 结论 + 逐文件判读:超范围文件是否属
|
|
42
|
+
方案卡声明的原子修改组)
|
|
43
|
+
3. **模板保真**(template 路径非空时:拷贝是否原样、MicroAPI VF 结构
|
|
44
|
+
(RegTensor/MaskReg/LoadAsFp32/StoreFromFp32)是否被降级为高层 API、
|
|
45
|
+
.template 是否按 usage_guide 正确转换)
|
|
46
|
+
4. **精度复核**(按方案卡 precision_plan 抽查边界用例——全量精度已由
|
|
47
|
+
implementer 跑过,reviewer 复核**语义风险点**:semantic_risk=altered 的
|
|
48
|
+
边界值/大 shape/异常位型用例;preserved 类抽 1-2 case 验证数字一致)
|
|
49
|
+
5. **结论**(四档 + 逐项依据)
|
|
50
|
+
6. **争议项**(如有:与 implementer 自报不一致处,留给主 agent 仲裁)
|
|
51
|
+
|
|
52
|
+
## 执行流程
|
|
53
|
+
|
|
54
|
+
1. **读方案卡与 diff_audit.json**:
|
|
55
|
+
- diff_audit verdict == UNATTRIBUTABLE → 直接出 UNATTRIBUTABLE 结论
|
|
56
|
+
(机器判定不推翻),报告只补「越界文件的内容判读」供仲裁参考;
|
|
57
|
+
- diff_audit verdict == OK → 继续逐项审查。
|
|
58
|
+
2. **独立构建**:在优化副本目录按工程自身构建脚本重编(保持 Release;
|
|
59
|
+
禁 -O0)。构建失败 → FAIL(该轮未达可审状态)。
|
|
60
|
+
3. **单变量判读**:逐个 changed_file 对照 diff_sketch:
|
|
61
|
+
- 声明内文件:改动内容是否与机制一致(如 ub-fusion 改动应是 UB 算子
|
|
62
|
+
组织,不应夹带 tiling 参数变更);
|
|
63
|
+
- implementer 自报「原子修改组」的声明外文件:核对原子性论证是否成立
|
|
64
|
+
(不可拆分才允许,C3 纪律)。
|
|
65
|
+
4. **模板保真**:方案卡 template 非空时逐项核对:
|
|
66
|
+
- 文件是否直接拷贝(对照 ops-family 模板源文件 diff,允许的最小适配 =
|
|
67
|
+
命名空间别名 / TilingData 字段补充 / include 路径三类);
|
|
68
|
+
- MicroAPI VF 计算结构是否原样保留(RegTensor/MaskReg/LoadAsFp32/
|
|
69
|
+
StoreFromFp32 关键字扫描);降级必须留痕(implementer 返回的修复
|
|
70
|
+
尝试记录),无留痕的降级 → FAIL;
|
|
71
|
+
- .template 是否按同名 usage_guide 转换。
|
|
72
|
+
5. **精度复核**:semantic_risk=altered → 跑方案卡 precision_plan 的全部
|
|
73
|
+
边界用例;preserved → 抽查 1-2 case 与基线输出逐位/容差内一致。
|
|
74
|
+
6. **出报告**:六段齐全,结论四档之一。
|
|
75
|
+
|
|
76
|
+
## 核心约束
|
|
77
|
+
|
|
78
|
+
| # | 规则 |
|
|
79
|
+
|------|------|
|
|
80
|
+
| R1 | diff_audit 的 UNATTRIBUTABLE 判定不可推翻(机器红线;内容判读只作仲裁参考) |
|
|
81
|
+
| R2 | 独立重编,不复用 implementer 构建产物(构建状态自报不作数) |
|
|
82
|
+
| R3 | 模板保真检查以 ops-family 模板源文件为真源对照 |
|
|
83
|
+
| R4 | 精度复核用工程现有容差,禁止自创容差(与 A5 门禁同源) |
|
|
84
|
+
| R5 | 不采集性能、不跑 delta_compare(主 agent 垄断统一采集与对比) |
|
|
85
|
+
| R6 | 与 implementer 的分歧写入「争议项」,不私下协商 |
|
|
86
|
+
| R7 | 审查失败的轮次:性能数字不得进入任何报告结论(与精度 fail 同档) |
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Subagent 调用参数详情(OpsTuningAgent 唯一执行手册)
|
|
2
|
+
|
|
3
|
+
> 每个 Step:调用参数、关联 SKILL、完成验证、约束提醒。占位符:`{code_dir}`
|
|
4
|
+
> `{cases_csv}` `{output_dir}` `{operator}`。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Step 0:意图与边界(Phase 0)
|
|
9
|
+
|
|
10
|
+
主 agent 亲自执行(不派 subagent——精度门禁预检必须由编排层亲自把关)。
|
|
11
|
+
|
|
12
|
+
### 1. 精度门禁预检
|
|
13
|
+
|
|
14
|
+
对用户提供的测试用例**全量**跑一遍工程现有正确性/精度测试(禁止抽样):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# 工程自带测试入口(示例形态,以工程 README/run 脚本为准):
|
|
18
|
+
cd {code_dir} && bash run.sh # 或 ./build/ut --gtest_filter=... 或 python3 verify.py
|
|
19
|
+
# 记录:总 case 数、PASS 数、FAIL 数、容差口径(工程现有容差,禁止自创)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- 任一 case FAIL / 崩溃 / 挂起 → **拒绝进入调优**,转调试域(回报用户:
|
|
23
|
+
「精度未通过(N/M FAIL),先处置正确性再谈性能」)
|
|
24
|
+
- 无法运行(缺依赖/构建失败)→ 同样拒绝,转工程问题处置
|
|
25
|
+
|
|
26
|
+
### 2. 场景分类判据
|
|
27
|
+
|
|
28
|
+
| 判据 | 场景 | 裁剪 |
|
|
29
|
+
|------|------|------|
|
|
30
|
+
| 源码含 fork 多进程绑卡 / SHMEM UDMA / BarrierAll / CrossCoreFlag / HCCL 通信 | 融合算子(MC²) | Phase 2 加污染前置 + L3 全启用 + 隔离测试 |
|
|
31
|
+
| 多算子融合单 kernel(FA 类) | 融合算子(FA) | 同上(fa 族走无同型降级策略) |
|
|
32
|
+
| 用户给 profiling 产物目录、无源码 | 问答模式 | 仅 Phase 2 离线判定 + 报告解读 |
|
|
33
|
+
| 用户要求批量回归(已有基线库) | 批量回归 | Phase 1 简化 + Phase 3-4 改重跑判定+对比 |
|
|
34
|
+
| 其余 | 单算子 | 全五阶段 |
|
|
35
|
+
|
|
36
|
+
### 3. 生成 scope.json(opstune.scope/1.0)
|
|
37
|
+
|
|
38
|
+
字段与 delta_compare HARD_KEYS **严格同名同义**(口径互锁的上游真源;
|
|
39
|
+
schema 与最小示例见 `ops-verdict/references/scope-schema.md`(相对本套件根目录)):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python3 - <<'PYEOF'
|
|
43
|
+
import json, datetime
|
|
44
|
+
scope = {
|
|
45
|
+
"schema": "opstune.scope/1.0",
|
|
46
|
+
"operator": "{operator}", # 算子名
|
|
47
|
+
# ---- HARD_KEYS 12 字段(与 snapshot/delta_compare 同名同义)----
|
|
48
|
+
"op": "{operator}", "soc": "<a2|a3|a5>", "mode": "board",
|
|
49
|
+
"timing_method": "<event|sim|msprof|msprof_task_duration|profiler_summary>",
|
|
50
|
+
"baseline_kind": "<system|self_before_after>", "cann_version": "<ver>",
|
|
51
|
+
"device_id": "<id>", "shape": "<代表 case>", "dtype": "<dt>",
|
|
52
|
+
"format": "<ND|NZ|...>", "warmup": <n>, "repeat": <n>,
|
|
53
|
+
# ---- 机制变量 2 字段 ----
|
|
54
|
+
"tiling_key": null, "block_dim": null,
|
|
55
|
+
# ---- 场景与目标 ----
|
|
56
|
+
"scene": "<single|mc2|fa|regression|qa>",
|
|
57
|
+
"cases_csv": "{cases_csv}", "code_dir": "{code_dir}",
|
|
58
|
+
"performance_goal": "<目标或 null>", "max_rounds": <n>,
|
|
59
|
+
"precision_gate": {"total": <N>, "pass": <N>, "fail": <N>, "tolerance": "<工程现有容差>"},
|
|
60
|
+
"generated_at": datetime.datetime.now().isoformat(timespec="seconds"),
|
|
61
|
+
}
|
|
62
|
+
json.dump(scope, open("{output_dir}/scope.json", "w"), ensure_ascii=False, indent=2)
|
|
63
|
+
PYEOF
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 完成验证
|
|
67
|
+
|
|
68
|
+
- scope.json 存在且 12 HARD 字段齐全(`python3 -c "import json; s=json.load(open('{output_dir}/scope.json')); assert all(k in s for k in ('op','soc','mode','timing_method','baseline_kind','cann_version','device_id','shape','dtype','format','warmup','repeat'))"`)
|
|
69
|
+
- precision_gate.fail == 0(否则 Phase 0 未过,禁止进入 Step 1)
|
|
70
|
+
|
|
71
|
+
### 约束提醒
|
|
72
|
+
|
|
73
|
+
- 精度门禁预检禁止只跑代表性用例(全量铁律从 Phase 0 开始生效)
|
|
74
|
+
- scope.json 的 HARD 字段后续任何变化都必须重建基线(与 A4 铁律同源)
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Step 1:采集与基线
|
|
79
|
+
|
|
80
|
+
### 调用方式
|
|
81
|
+
|
|
82
|
+
本阶段由主 agent 亲自执行(调用 SKILL,不派 subagent——基线是不可变口径,须一次建对)。
|
|
83
|
+
|
|
84
|
+
1. 加载 `/ops-collect`,按其路由决策树执行:
|
|
85
|
+
- MC² / fork 多 rank → `collect_board.sh --mode mc2`(+ 后续 Step 2 的隔离测试)
|
|
86
|
+
- 单卡 → `--mode standard`(7 组 aic-metrics)
|
|
87
|
+
2. 环境指纹存档 `tuning_artifacts/{operator}/environment.txt`(npu-smi / CANN 版本 /
|
|
88
|
+
设备 ID / 频率 / 同卡负载 / repo commit)
|
|
89
|
+
3. **不可变基线**落盘:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python3 <ops-verdict>/scripts/snapshot.py \
|
|
93
|
+
--op {operator} --variant baseline --mode board --soc <soc> \
|
|
94
|
+
--precision pass --kernel-avg-us <值> --timing-method <五选一> \
|
|
95
|
+
--baseline-kind <system|self_before_after> --cann-version <ver> \
|
|
96
|
+
--device-id <id> --shape <代表case> --dtype <dt> --format <fmt> \
|
|
97
|
+
--warmup <n> --repeat <n> \
|
|
98
|
+
-o {output_dir}/baseline/result.json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
计时口径选择(短 kernel 多 launch 单 event / 长 kernel 允许 Task Duration 注明口径 /
|
|
102
|
+
冷稳态固定 warmup / MC² 循环 ≥10 前 5 warm-up 跨 rank max)详见 /ops-collect SKILL.md。
|
|
103
|
+
|
|
104
|
+
### 完成验证
|
|
105
|
+
|
|
106
|
+
- `{output_dir}/baseline/result.json` 存在且 `precision=pass`
|
|
107
|
+
- `collection_manifest.json` 无 failed 块(failed → 本 Step 未过)
|
|
108
|
+
- scope.json 12 HARD 字段齐全(见 Step 0 / scope-schema.md)
|
|
109
|
+
|
|
110
|
+
### 约束提醒
|
|
111
|
+
|
|
112
|
+
- 全量 case 覆盖:>20 取前 20 并告知用户截断
|
|
113
|
+
- 禁 host 侧计时替代 msprof(MC²);禁 -O0 构建
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Step 2:分层判定
|
|
118
|
+
|
|
119
|
+
### 调用方式
|
|
120
|
+
|
|
121
|
+
主 agent 执行(判定出自脚本,主 agent 只组装输入与解读输出):
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# 单算子:
|
|
125
|
+
python3 <ops-verdict>/scripts/verdict.py \
|
|
126
|
+
--rules <ops-verdict>/rules/L2-inter-core.yaml,<ops-verdict>/rules/L1-single-core.yaml[,<ops-verdict>/rules/L0-instruction.yaml] \
|
|
127
|
+
--csv <PipeUtilization.csv> --soc <soc> \
|
|
128
|
+
--scalar physical_cores=<n>,block_dim=<n>,task_duration_us=<n>[,mte2_active_bw_pct_of_peak=<n>] \
|
|
129
|
+
-o {output_dir}/baseline/verdict.json
|
|
130
|
+
|
|
131
|
+
# MC²(先隔离测试再全瀑布):
|
|
132
|
+
python3 <ops-collect>/scripts/isolation_test.py --exe <exe> --args "..." \
|
|
133
|
+
--output {output_dir}/iso_result.json
|
|
134
|
+
python3 <ops-verdict>/scripts/verdict.py \
|
|
135
|
+
--rules <ops-verdict>/rules/L3-inter-card.yaml,<ops-verdict>/rules/L2-inter-core.yaml,<ops-verdict>/rules/L1-single-core.yaml \
|
|
136
|
+
--csv <PipeUtilization.csv> --soc a5 \
|
|
137
|
+
--scalar t_comm_us=<iso>,t_compute_us=<iso>[,mte2_ratio_full=<n>,mte2_ratio_pure=<n>,physical_cores=<n>] \
|
|
138
|
+
-o {output_dir}/baseline/verdict.json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 完成验证
|
|
142
|
+
|
|
143
|
+
- `verdict.json` 存在;`verdict` ∈ {NEEDS_OPTIMIZATION, NEAR_LIMIT, NO_BOUND_FOUND}
|
|
144
|
+
- INSUFFICIENT_DATA → 按 `skipped[].missing` 补采(回 Step 1 采集,≤2 轮);仍缺 → 如实上报,禁止猜测式判定
|
|
145
|
+
- NO_BOUND_FOUND → 未命中任何瓶颈规则:评估是否已达目标;仍需提升则采集 L0 源码级指标做深度分析
|
|
146
|
+
|
|
147
|
+
### 约束提醒
|
|
148
|
+
|
|
149
|
+
- 主 agent **不得**在 verdict 之外补充「自己观察到的 bound」——只能作为假设标注缺失指标
|
|
150
|
+
- NEAR_LIMIT:向用户报告「接近上限」读数(含 speedup 上界依据),确认后再决定是否继续
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Step 3:候选方案
|
|
155
|
+
|
|
156
|
+
### 调用方式
|
|
157
|
+
|
|
158
|
+
主 agent 执行(渐进式披露:只加载 findings 命中的机制卡):
|
|
159
|
+
|
|
160
|
+
1. 加载 `/ops-mechanism`:按 `findings[].mechanism_refs` 逐张打开机制卡;同型案例最多 3 个
|
|
161
|
+
(A-D/E 分级;无同型走降级策略并在方案卡标注)
|
|
162
|
+
2. 加载 `/ops-family`:方案涉及模板 → 查找链路取模板路径,标注可用性分类
|
|
163
|
+
(✅可直接拷贝 / ⚠️部分实现 / ❌仅设计参考)
|
|
164
|
+
3. 输出 `{output_dir}/candidates.json`(≤3 张方案卡,按 speedup_est × 可行性排序,
|
|
165
|
+
每卡含 mechanism/target_rule/evidence/diff_sketch/speedup_est/semantic_risk/
|
|
166
|
+
precision_plan/verify_cmd/rollback_if/template)
|
|
167
|
+
|
|
168
|
+
### 完成验证
|
|
169
|
+
|
|
170
|
+
- 每张卡 target_rule ∈ verdict findings 的 rule_id(证据绑定)
|
|
171
|
+
- 每张卡 rollback_if 非空;semantic_risk=altered 的卡 precision_plan 含边界用例
|
|
172
|
+
|
|
173
|
+
### 约束提醒
|
|
174
|
+
|
|
175
|
+
- 候选必须有当前算子的 profiling 证据(案例数字外推禁止)
|
|
176
|
+
- 融合算子注意机制互斥(如 MTE2 污染下禁单核访存机制——verdict 路由副作用已处理)
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Step 4:单轮实施
|
|
181
|
+
|
|
182
|
+
### 阶段 4a:并行分发(主 agent → perf-implementer × N)
|
|
183
|
+
|
|
184
|
+
每张方案卡一个 subagent(并行):
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
{
|
|
188
|
+
"description": "实施机制:<mechanism>",
|
|
189
|
+
"subagent_type": "perf-implementer",
|
|
190
|
+
"prompt": "
|
|
191
|
+
请实施以下单个优化机制(单变量铁律:只做这一项):
|
|
192
|
+
|
|
193
|
+
- 算子源码目录:{code_dir}
|
|
194
|
+
- 方案卡:<该方案的完整 candidates.json 条目,含 template 路径与 rollback_if>
|
|
195
|
+
- 测试用例文件:{cases_csv}
|
|
196
|
+
- 输出目录:{output_dir}/{operator}_opt_<mechanism>/
|
|
197
|
+
|
|
198
|
+
按 perf-implementer.md 执行流程完成:复制目录 → 模板拷贝优先(.template 先转换)→
|
|
199
|
+
MicroAPI 编译修复顺序(禁直接降级)→ 编译 → 全量 case 精度验证(工程现有容差)。
|
|
200
|
+
返回:代码目录、编译状态、逐 case PASS/FAIL 明细、模板使用情况、diff 摘要。
|
|
201
|
+
不采集性能、不生成对比报告。
|
|
202
|
+
"
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### 阶段 4b:实施审查(主 agent → perf-reviewer,机器闸门先行)
|
|
207
|
+
|
|
208
|
+
perf-implementer 返回后、统一采集**之前**,每机制两道审查:
|
|
209
|
+
|
|
210
|
+
1. **diff_audit(机器闸门,主 agent 亲自跑)**:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
python3 scripts/diff_audit.py \
|
|
214
|
+
--baseline {code_dir} --opt {output_dir}/{operator}_opt_<mechanism>/ \
|
|
215
|
+
--candidates {output_dir}/candidates.json --index <该方案卡序号> \
|
|
216
|
+
-o {output_dir}/round-<N>-<mechanism>/diff_audit.json
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- exit 2(UNATTRIBUTABLE:改动超出方案卡 diff_sketch_files 声明范围)
|
|
220
|
+
→ 该轮**不进统一采集**(采集了也无法归因),处置二选一:回滚超范围
|
|
221
|
+
改动重测 / implementer 补充原子性论证并把文件补进方案卡后重审;
|
|
222
|
+
- 方案卡未声明 diff_sketch_files → 只记录不判罚(不能拿不存在的声明当红线),
|
|
223
|
+
audit.json 留档供 perf-reviewer 逐文件判读。
|
|
224
|
+
|
|
225
|
+
2. **perf-reviewer(独立审查 subagent)**:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
{
|
|
229
|
+
"description": "审查实施:<mechanism>",
|
|
230
|
+
"subagent_type": "perf-reviewer",
|
|
231
|
+
"prompt": "
|
|
232
|
+
请独立审查以下优化副本(对象:只做方案卡声明的这一件事、且做对了):
|
|
233
|
+
|
|
234
|
+
- 方案卡:<该方案的完整条目,含 diff_sketch_files / template / semantic_risk / precision_plan>
|
|
235
|
+
- 基线源码目录:{code_dir}
|
|
236
|
+
- 优化副本目录:{output_dir}/{operator}_opt_<mechanism>/
|
|
237
|
+
- diff_audit.json:<主 agent 产出的机器审查结果路径>
|
|
238
|
+
- 测试用例文件:{cases_csv}
|
|
239
|
+
|
|
240
|
+
按 perf-reviewer.md 执行流程:独立重编 → 单变量符合性判读(消费 diff_audit)→
|
|
241
|
+
模板保真(MicroAPI VF 降级检测)→ 精度复核(semantic_risk=altered 的边界用例)。
|
|
242
|
+
输出 {output_dir}/round-<N>-<mechanism>/review.md,结论四档:
|
|
243
|
+
PASS / PASS WITH NOTES / FAIL / UNATTRIBUTABLE。
|
|
244
|
+
不采集性能、不跑 delta_compare。
|
|
245
|
+
"
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
- FAIL / UNATTRIBUTABLE → 该轮按处置规则回到 implementer(修复或回滚),
|
|
250
|
+
**性能数字不得进入任何报告结论**(与精度 fail 同档);
|
|
251
|
+
- 多 KEEP 仲裁**必须**在全部 KEEP 轮的 review.md 均 PASS / PASS WITH NOTES
|
|
252
|
+
之后进行。
|
|
253
|
+
|
|
254
|
+
### 阶段 4c:统一采集与对比(主 agent 垄断)
|
|
255
|
+
|
|
256
|
+
1. 对基线 + 各机制目录,逐 case 同口径采集(与 Step 1 完全相同的 timing/warmup/repeat/device)。
|
|
257
|
+
**工具化(P0-1)**:`collect_cases.py`(cases.csv + exe → 逐 case manifest + perf_data.csv)
|
|
258
|
+
替代手工串接——case 间串行同卡、防重采闸门、failed 如实呈现;
|
|
259
|
+
`batch_pipeline.py --from-collect` 直连产出对比矩阵,零手工中间产物
|
|
260
|
+
2. 每机制落 snapshot:`round-<N>-<mechanism>/result.json`
|
|
261
|
+
3. 逐机制对比:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
python3 <ops-verdict>/scripts/delta_compare.py \
|
|
265
|
+
--baseline {output_dir}/baseline/result.json \
|
|
266
|
+
--after {output_dir}/round-<N>-<mechanism>/result.json \
|
|
267
|
+
--output {output_dir}/round-<N>-<mechanism>/comparison.md
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
4. 三段结论处置:KEEP(保留为新基线)/ REVERT(回滚后复跑确认回基线水平)/ 噪声带内
|
|
271
|
+
(repeat 翻倍复测:以新 repeat 同步重采基线与优化侧、新目录重建两侧快照后再比)
|
|
272
|
+
5. 机制生效证据复采:verdict.py 复跑(期望 target_rule 转 NOT_HIT 或 severity 降档)
|
|
273
|
+
|
|
274
|
+
### 多 KEEP 仲裁(并行候选都 KEEP 时的处置规则)
|
|
275
|
+
|
|
276
|
+
并行分发 ≤3 张方案卡(各自对照同一基线)后出现**多个 KEEP** 时:
|
|
277
|
+
|
|
278
|
+
1. **新基线选择**:按「speedup × 确定性」排序取最优者为新基线——
|
|
279
|
+
speedup 取该机制 comparison 的实测值,确定性按 confidence(high > medium > low);
|
|
280
|
+
并列时取 speedup_range 下界更高者(保守估计更强)。
|
|
281
|
+
2. **其余 KEEP 产物降级**:不并入新基线,降级为下一轮候选优先项
|
|
282
|
+
(其 diff 保留在各自 round 目录,下一轮以新基线重新实施验证——
|
|
283
|
+
与「每轮必须重新走 Phase 2」的多轮机制一致)。
|
|
284
|
+
3. **同代码区域冲突检测**:多张方案卡的 diff_sketch 涉及同一文件/同一代码区域时
|
|
285
|
+
**禁止并行、改串行**(互踩无法归因);主 agent 在 4a 分发前检查 diff_sketch
|
|
286
|
+
的文件集合,有交集即串行化。
|
|
287
|
+
4. **负优化与 KEEP 并存**:REVERT 轮次照常回滚并记录(回滚记录是瓶颈证据的
|
|
288
|
+
组成部分),不影响 KEEP 轮的仲裁。
|
|
289
|
+
|
|
290
|
+
### 完成验证
|
|
291
|
+
|
|
292
|
+
- 每机制 diff_audit.json 存在且 verdict=OK(UNATTRIBUTABLE 轮已处置,未混入对比)
|
|
293
|
+
- 每机制 review.md 存在且结论为 PASS / PASS WITH NOTES(FAIL 轮已处置)
|
|
294
|
+
- 每机制 comparison.md 存在且三段结论明确
|
|
295
|
+
- 精度 fail 或审查 FAIL/UNATTRIBUTABLE 的轮次:性能数字不得进入任何报告结论
|
|
296
|
+
- 多 KEEP 时:已按仲裁规则选定新基线并在 REPORT 记录选择依据;其余 KEEP 产物
|
|
297
|
+
已列为下轮候选优先项;并行分发的方案卡 diff_sketch 无同代码区域交集
|
|
298
|
+
(有交集的已串行化执行)
|
|
299
|
+
|
|
300
|
+
### 约束提醒
|
|
301
|
+
|
|
302
|
+
- 主 agent 不得合并多机制产物做「组合方案」(用户显式要求除外)
|
|
303
|
+
- diff_audit 的 UNATTRIBUTABLE 是机器红线:主 agent 不以「看起来没问题」推翻
|
|
304
|
+
(要推翻只有一条路——文件补进方案卡并说明原子性后重审)
|
|
305
|
+
- 停止条件判定在本 Step 完成后统一执行
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Step 5:归档汇报
|
|
310
|
+
|
|
311
|
+
### 调用方式
|
|
312
|
+
|
|
313
|
+
主 agent 生成 `{output_dir}/REPORT.md`,**六要素缺一不合格**:
|
|
314
|
+
|
|
315
|
+
1. 环境与源码指纹(SoC/CANN/driver/commit/device/频率)
|
|
316
|
+
2. 逐 case 对比表(baseline/optimized/Δ/speedup/精度——全量,禁只展示最快样本)
|
|
317
|
+
3. Bound 与指标变化(前后 verdict 关键指标对照)
|
|
318
|
+
4. 保留与回滚清单(负优化轮次与原因——回滚记录是瓶颈证据的组成部分)
|
|
319
|
+
5. 预估 vs 实测(每机制 speedup_est 对照实测,喂校准回路)
|
|
320
|
+
6. 适用边界标注(partial/dry_run/未验证项;soc/模式适用域)
|
|
321
|
+
|
|
322
|
+
另产出:
|
|
323
|
+
- `case_candidate.json`:E 级案例回灌条目(场景指纹/机制/实测/口径)
|
|
324
|
+
- `calibration_data.json`:speedup_est vs 实测对照(校准回路输入)
|
|
325
|
+
- `report.html`:**可视化报告**(ops-report skill)——批量场景(batch_pipeline
|
|
326
|
+
已产出矩阵目录)时必做;单轮场景可选:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
python3 <ops-verdict>/scripts/render_html.py \
|
|
330
|
+
--matrix-dir {output_dir}/matrix --title "OpsTune 调优报告 — {operator}@{soc}" \
|
|
331
|
+
-o {output_dir}/report.html
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### 完成验证
|
|
335
|
+
|
|
336
|
+
REPORT.md 六要素齐全;多轮场景含各轮改进幅度与相对首轮基线的总改进;
|
|
337
|
+
批量场景 report.html 存在且与矩阵同数据源(数字不一致 = 渲染 bug,报 issue 不手改)。
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## 报告格式通用规范
|
|
342
|
+
|
|
343
|
+
所有阶段产物头部:
|
|
344
|
+
|
|
345
|
+
```markdown
|
|
346
|
+
**状态**: ✅完成 / ❌失败 / ⏭️跳过
|
|
347
|
+
**阶段**: 采集与基线 / 分层判定 / 候选方案 / 单轮实施 / 归档汇报
|
|
348
|
+
**摘要**: 一句话结论
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### 逐 case 覆盖格式
|
|
352
|
+
|
|
353
|
+
```markdown
|
|
354
|
+
| Case | Shape | dtype | 瓶颈(rule_id) | 机制 | 基线(us) | 优化后(us) | speedup | 精度 |
|
|
355
|
+
|------|-------|-------|--------------|------|---------|-----------|---------|------|
|
|
356
|
+
| 1 | ... | fp16 | L1_VEC_BOUND | ub-fusion | 14.1 | 9.2 | 1.53x | PASS |
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## 故障分流
|
|
360
|
+
|
|
361
|
+
采集/编译/运行故障 → 读 `workflows/troubleshooting.md`;精度/崩溃/hang → 停止调优,
|
|
362
|
+
转精度/崩溃调试域流程(参考 CANN 调试资料),不在本套件范围内处置。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 故障分流表(采集 / 编译 / 运行 / 对比)
|
|
2
|
+
|
|
3
|
+
> 三列结构:故障现象 → 判定/根因 → 动作。条目来自一线调优实测沉淀,按调优域组织。
|
|
4
|
+
|
|
5
|
+
## 采集类
|
|
6
|
+
|
|
7
|
+
| 现象 | 根因 | 动作 |
|
|
8
|
+
|------|------|------|
|
|
9
|
+
| `--kernel-name` 采集为空但应用正常 | C++ mangled 匿名命名空间符号(`_ZN12_GLOBAL__N_1...`) | 去掉过滤全量采集,从 OpBasicInfo 抄真实 kernel 名重采 |
|
|
10
|
+
| fork 多进程只采到每进程第一个 kernel | msopprof 对 fork 子进程不完整 | 标 partial;改 SHMEMI_PROF 打点或完整 msprof(task-based) |
|
|
11
|
+
| 采集日志 libprofapi ERROR 但 CSV 正常 | 工具链噪声(CANN 9.1 实测) | **以产出检查为准**,不凭 ERROR 行判失败 |
|
|
12
|
+
| msprof op 拉起 MC² 程序数据可疑/挂 | 对 fork 行为未定义 | 强制回退 msprof --aic-mode=task-based |
|
|
13
|
+
| 输出目录直接报错 | 权限/软链检查 | 确认目录可写、无跨设备软链 |
|
|
14
|
+
| PipeUtilization 只有 N 个 block 行 | 数据量小或切核不足 | 正常——这正是 L2_UNDERUTILIZATION 的判定输入 |
|
|
15
|
+
| rankNum > 空闲设备数 | 环境 BLOCKED | 判定阶段即拦截(不进入采集);换卡/减 rank |
|
|
16
|
+
|
|
17
|
+
## 编译类
|
|
18
|
+
|
|
19
|
+
| 现象 | 根因 | 动作 |
|
|
20
|
+
|------|------|------|
|
|
21
|
+
| `GLIBCXX_3.4.32 not found` | miniconda libstdc++ 过旧(TBE 编译依赖) | 换系统库软链 |
|
|
22
|
+
| ffn 系列缺 `aic-ascend950-ops-info.ini` | 复合算子 6 子算子缺 A5 配置 | BLOCKED 等上游,如实标注 |
|
|
23
|
+
| MicroAPI / Reg API 编译报错 | 命名空间/签名/路径差异 | **修复顺序**:命名空间别名 → 签名适配 → include → 降级留痕 |
|
|
24
|
+
| 仿真拉起 signal 6 / Bad address | 仿真需要仿真兼容构建产物 | 走 cannsim 路径的兼容构建说明(`$ASCEND_HOME_PATH/tools/` 或昇腾文档站「cannsim」章节) |
|
|
25
|
+
|
|
26
|
+
## 运行类
|
|
27
|
+
|
|
28
|
+
| 现象 | 根因 | 动作 |
|
|
29
|
+
|------|------|------|
|
|
30
|
+
| tiling 改动后 device fault | 容量/深度联动假设被破坏 | ①回滚确认基线可复跑 ②-g 重编 + msSanitizer 定位 ③缩小改动粒度(baseK 128→192 非 256)④核对联动字段 |
|
|
31
|
+
| kernel 挂起 | 同步协议改动死锁等 | **挂起即回滚**,不在 hang 状态上调性能;不可拆分原子对先最小二分 |
|
|
32
|
+
| 精度失败(任一 case) | 机制引入语义变更 | 转调试域;该轮性能数字不得进报告 |
|
|
33
|
+
|
|
34
|
+
## 对比类
|
|
35
|
+
|
|
36
|
+
| 现象 | 根因 | 动作 |
|
|
37
|
+
|------|------|------|
|
|
38
|
+
| delta_compare exit 2(口径不一致) | HARD_KEYS 漂移(设备/口径/shape…) | 重建基线——跨口径比较无意义,禁止绕过 |
|
|
39
|
+
| delta_compare exit 2(精度非 pass) | 第三道门禁 | 处置精度,禁止生成性能结论 |
|
|
40
|
+
| 短 kernel event wall 无收益但 profiler 有收益 | 计时口径问题 | 多 launch 单 event 或 device duration 辅助口径并注明 |
|
|
41
|
+
| 收益在 ±5% 内反复横跳 | 噪声带 | repeat 翻倍复测(同步重采基线与优化侧、新目录重建快照——repeat 是 HARD 口径字段);仍带内按无稳定收益 |
|
|
42
|
+
| 首轮极慢(差可达 25%) | 冷跑(初始化/缓存预热/DVFS) | 固定 warmup 剔除;稳态 ≥3 取中位 |
|
|
43
|
+
| 环境指纹变化后旧基线全失效 | 跨环境比较禁令 | 正常行为:重建基线(这正是指纹存在的意义) |
|
|
Binary file
|