ops-tune-workbench-plugin 0.0.0-stage → 0.0.1-beta.2

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.
Files changed (183) hide show
  1. package/NOTICE.md +14 -0
  2. package/README.md +39 -2
  3. package/cordis.patch.yml +20 -0
  4. package/lib/client.js +4253 -0
  5. package/lib/host.js +2518 -0
  6. package/package.json +53 -4
  7. package/skills/tool-ops-tune/INSTALL.md +52 -0
  8. package/skills/tool-ops-tune/README.md +167 -0
  9. package/skills/tool-ops-tune/SKILL.md +93 -0
  10. package/skills/tool-ops-tune/agent/AGENTS.md +195 -0
  11. package/skills/tool-ops-tune/agent/agents/perf-implementer.md +68 -0
  12. package/skills/tool-ops-tune/agent/agents/perf-reviewer.md +86 -0
  13. package/skills/tool-ops-tune/agent/workflows/task-prompts.md +362 -0
  14. package/skills/tool-ops-tune/agent/workflows/troubleshooting.md +43 -0
  15. package/skills/tool-ops-tune/docs/figures/opstune-architecture.png +0 -0
  16. package/skills/tool-ops-tune/docs/figures/opstune-architecture.svg +253 -0
  17. package/skills/tool-ops-tune/docs/ops-tune-design.md +404 -0
  18. package/skills/tool-ops-tune/docs//347/224/250/344/276/213/346/236/204/345/273/272.md +714 -0
  19. package/skills/tool-ops-tune/docs//347/237/245/350/257/206/345/272/223/350/247/204/350/214/203.md +103 -0
  20. package/skills/tool-ops-tune/evals/evals.json +242 -0
  21. package/skills/tool-ops-tune/ops-collect/SKILL.md +146 -0
  22. package/skills/tool-ops-tune/ops-collect/references/tool-routing.md +86 -0
  23. package/skills/tool-ops-tune/ops-collect/scripts/collect_board.sh +444 -0
  24. package/skills/tool-ops-tune/ops-collect/scripts/collect_cases.py +368 -0
  25. package/skills/tool-ops-tune/ops-collect/scripts/collect_sim.sh +134 -0
  26. package/skills/tool-ops-tune/ops-collect/scripts/csv_to_db.py +314 -0
  27. package/skills/tool-ops-tune/ops-collect/scripts/db_bench.py +545 -0
  28. package/skills/tool-ops-tune/ops-collect/scripts/facts_bridge.py +1063 -0
  29. package/skills/tool-ops-tune/ops-collect/scripts/isolation_test.py +454 -0
  30. package/skills/tool-ops-tune/ops-collect/scripts/jsonl_to_cases.py +163 -0
  31. package/skills/tool-ops-tune/ops-family/SKILL.md +76 -0
  32. package/skills/tool-ops-tune/ops-family/references/broadcast/advanced_tiling.md +92 -0
  33. package/skills/tool-ops-tune/ops-family/references/broadcast/broadcast_design.md +160 -0
  34. package/skills/tool-ops-tune/ops-family/references/broadcast/code/broadcast_add_kernel.cpp +126 -0
  35. package/skills/tool-ops-tune/ops-family/references/broadcast/code/broadcast_add_tiling.cpp +144 -0
  36. package/skills/tool-ops-tune/ops-family/references/broadcast/code/broadcast_tiling_common.h +401 -0
  37. package/skills/tool-ops-tune/ops-family/references/broadcast/code/onedim_add_kernel.cpp +107 -0
  38. package/skills/tool-ops-tune/ops-family/references/broadcast/code/onedim_add_tiling.cpp +64 -0
  39. package/skills/tool-ops-tune/ops-family/references/broadcast/datacopypad_design.md +46 -0
  40. package/skills/tool-ops-tune/ops-family/references/broadcast/guide.md +14 -0
  41. package/skills/tool-ops-tune/ops-family/references/broadcast/nddma_design.md +53 -0
  42. package/skills/tool-ops-tune/ops-family/references/broadcast/onedim_design.md +114 -0
  43. package/skills/tool-ops-tune/ops-family/references/broadcast/ub_broadcast_design.md +67 -0
  44. package/skills/tool-ops-tune/ops-family/references/common/datacopy_optimization_design.md +351 -0
  45. package/skills/tool-ops-tune/ops-family/references/common/index.md +9 -0
  46. package/skills/tool-ops-tune/ops-family/references/common/tail_block_design.md +268 -0
  47. package/skills/tool-ops-tune/ops-family/references/common/timing_harness/index.md +38 -0
  48. package/skills/tool-ops-tune/ops-family/references/common/timing_harness/timing_harness_aclrt_event.cpp +199 -0
  49. package/skills/tool-ops-tune/ops-family/references/common/timing_harness/timing_harness_torch_event.py +130 -0
  50. package/skills/tool-ops-tune/ops-family/references/common/ub_resident_design.md +342 -0
  51. package/skills/tool-ops-tune/ops-family/references/conversion/guide.md +69 -0
  52. package/skills/tool-ops-tune/ops-family/references/conversion/index.md +4 -0
  53. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_base.template +81 -0
  54. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_big_dim.template +217 -0
  55. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_cut_one_axis.template +336 -0
  56. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_cut_two_axis.template +781 -0
  57. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_n_last.template +340 -0
  58. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_small_shape.template +321 -0
  59. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_tensor_move.template +102 -0
  60. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_transdata_5hd.template +480 -0
  61. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_transdata_5hd_021axis.template +533 -0
  62. package/skills/tool-ops-tune/ops-family/references/conversion/templates/dav3510/transpose_with_gather.template +688 -0
  63. package/skills/tool-ops-tune/ops-family/references/conversion/templates/transpose_tiling_data.template +192 -0
  64. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_big_dim.md +220 -0
  65. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_cut_one_axis.md +175 -0
  66. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_cut_two_axis.md +177 -0
  67. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_fusion_design.md +398 -0
  68. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_gather.md +191 -0
  69. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_n_last.md +276 -0
  70. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_small_shape.md +315 -0
  71. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_tensor_move.md +203 -0
  72. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_tiling_data.md +176 -0
  73. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_vconv_021.md +206 -0
  74. package/skills/tool-ops-tune/ops-family/references/conversion/transpose_vconv_5hd.md +179 -0
  75. package/skills/tool-ops-tune/ops-family/references/elementwise/double_buffer_design.md +288 -0
  76. package/skills/tool-ops-tune/ops-family/references/elementwise/guide.md +46 -0
  77. package/skills/tool-ops-tune/ops-family/references/elementwise/index.md +10 -0
  78. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/CMakeLists.txt +131 -0
  79. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/README.md +55 -0
  80. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_extension/add_custom_torch.cpp +80 -0
  81. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_extension/ops.h +23 -0
  82. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_extension/register.cpp +30 -0
  83. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_host/add_custom.asc +149 -0
  84. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_host/data_utils.h +97 -0
  85. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_kernel/add_custom_kernel.asc +136 -0
  86. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/op_kernel/add_custom_tiling.h +31 -0
  87. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/run.sh +86 -0
  88. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/gen_data.py +70 -0
  89. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/golden.py +34 -0
  90. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/test_torch.py +99 -0
  91. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/add_custom/scripts/verify_result.py +56 -0
  92. package/skills/tool-ops-tune/ops-family/references/elementwise/templates/usage_guide.md +61 -0
  93. package/skills/tool-ops-tune/ops-family/references/elementwise/vector_efficiency_design.md +203 -0
  94. package/skills/tool-ops-tune/ops-family/references/fa/fa_mixed_kernel_design.md +174 -0
  95. package/skills/tool-ops-tune/ops-family/references/fa/fa_roofline_design.md +141 -0
  96. package/skills/tool-ops-tune/ops-family/references/fa/guide.md +87 -0
  97. package/skills/tool-ops-tune/ops-family/references/knowledge_gaps.json +56 -0
  98. package/skills/tool-ops-tune/ops-family/references/matmul/best-practices-guide.md +14 -0
  99. package/skills/tool-ops-tune/ops-family/references/matmul/fullload_design.md +344 -0
  100. package/skills/tool-ops-tune/ops-family/references/matmul/guide.md +52 -0
  101. package/skills/tool-ops-tune/ops-family/references/matmul/mte2_preload_design.md +320 -0
  102. package/skills/tool-ops-tune/ops-family/references/matmul/pingpong_design.md +254 -0
  103. package/skills/tool-ops-tune/ops-family/references/matmul/scale_coalescing_design.md +282 -0
  104. package/skills/tool-ops-tune/ops-family/references/matmul/streamk_design.md +374 -0
  105. package/skills/tool-ops-tune/ops-family/references/matmul/swat_design.md +423 -0
  106. package/skills/tool-ops-tune/ops-family/references/matmul/templates/matmul_basic_blaze.template +165 -0
  107. package/skills/tool-ops-tune/ops-family/references/matmul/templates/usage_guide.md +29 -0
  108. package/skills/tool-ops-tune/ops-family/references/mc2/best-practices-guide.md +43 -0
  109. package/skills/tool-ops-tune/ops-family/references/mc2/guide.md +42 -0
  110. package/skills/tool-ops-tune/ops-family/references/mc2/local_matmul_design.md +130 -0
  111. package/skills/tool-ops-tune/ops-family/references/mc2/pipeline_balancing_design.md +502 -0
  112. package/skills/tool-ops-tune/ops-family/references/reduce/guide.md +178 -0
  113. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/kernel_utils.template +75 -0
  114. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ar_full_load.template +429 -0
  115. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ar_recompute.template +485 -0
  116. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ar_small_r.template +348 -0
  117. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ara_full_load.template +574 -0
  118. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ara_online.template +324 -0
  119. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_ara_recompute.template +436 -0
  120. package/skills/tool-ops-tune/ops-family/references/reduce/templates/dav310/softmax_v2_base.template +950 -0
  121. package/skills/tool-ops-tune/ops-family/references/reduce/templates/fused_attention_online_softmax_design.md +428 -0
  122. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ar_full_load.md +137 -0
  123. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ar_recompute.md +135 -0
  124. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ar_small_r.md +122 -0
  125. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ara_full_load.md +144 -0
  126. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ara_online.md +185 -0
  127. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_ara_recompute.md +163 -0
  128. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_tiling.template +460 -0
  129. package/skills/tool-ops-tune/ops-family/references/reduce/templates/softmax_v2_tiling_data.template +278 -0
  130. package/skills/tool-ops-tune/ops-family/references/reduce/templates/state_resident_design.md +337 -0
  131. package/skills/tool-ops-tune/ops-family/references/reduce/templates/usage_guide.md +253 -0
  132. package/skills/tool-ops-tune/ops-family/references/scalar/coding_principles.md +476 -0
  133. package/skills/tool-ops-tune/ops-family/references/scalar/conv_scalar.md +163 -0
  134. package/skills/tool-ops-tune/ops-family/references/scalar/guide.md +30 -0
  135. package/skills/tool-ops-tune/ops-family/references/simt/guide.md +91 -0
  136. package/skills/tool-ops-tune/ops-family/references/simt/optimization-guide.md +110 -0
  137. package/skills/tool-ops-tune/ops-family/references/sort/guide.md +83 -0
  138. package/skills/tool-ops-tune/ops-family/references/sort/radix_sort.md +354 -0
  139. package/skills/tool-ops-tune/ops-family/scripts/family_asset_audit.py +68 -0
  140. package/skills/tool-ops-tune/ops-family/scripts/tiling_candidates.py +419 -0
  141. package/skills/tool-ops-tune/ops-mechanism/SKILL.md +23 -0
  142. package/skills/tool-ops-tune/ops-mechanism/cases/ascendc/case_groupedmatmul_pipeline.md +23 -0
  143. package/skills/tool-ops-tune/ops-mechanism/cases/ascendc/case_triton_atomic_revert.md +19 -0
  144. package/skills/tool-ops-tune/ops-mechanism/cases/mc2/case_mc2_fusion.md +19 -0
  145. package/skills/tool-ops-tune/ops-mechanism/references/optimize/api-usage.md +70 -0
  146. package/skills/tool-ops-tune/ops-mechanism/references/optimize/ascendc-regbase-vf.md +45 -0
  147. package/skills/tool-ops-tune/ops-mechanism/references/optimize/ascendc-tiling.md +51 -0
  148. package/skills/tool-ops-tune/ops-mechanism/references/optimize/data-copy.md +67 -0
  149. package/skills/tool-ops-tune/ops-mechanism/references/optimize/index.md +45 -0
  150. package/skills/tool-ops-tune/ops-mechanism/references/optimize/mc2-balancing.md +77 -0
  151. package/skills/tool-ops-tune/ops-mechanism/references/optimize/mc2.md +103 -0
  152. package/skills/tool-ops-tune/ops-mechanism/references/optimize/memory-hierarchy.md +40 -0
  153. package/skills/tool-ops-tune/ops-mechanism/references/optimize/pipeline.md +95 -0
  154. package/skills/tool-ops-tune/ops-mechanism/scripts/case_backfill.py +170 -0
  155. package/skills/tool-ops-tune/ops-mechanism/scripts/log_gap.py +145 -0
  156. package/skills/tool-ops-tune/ops-mechanism/scripts/mc2_search.py +367 -0
  157. package/skills/tool-ops-tune/ops-report/SKILL.md +77 -0
  158. package/skills/tool-ops-tune/ops-verdict/evals/run_evals.py +837 -0
  159. package/skills/tool-ops-tune/ops-verdict/evals/smoke/install-hooks.sh +65 -0
  160. package/skills/tool-ops-tune/ops-verdict/evals/smoke/run_smoke.sh +405 -0
  161. package/skills/tool-ops-tune/ops-verdict/fixtures/core_tail_a5.csv +25 -0
  162. package/skills/tool-ops-tune/ops-verdict/fixtures/few_cores_a5.csv +5 -0
  163. package/skills/tool-ops-tune/ops-verdict/fixtures/mte2_bound_a2.csv +17 -0
  164. package/skills/tool-ops-tune/ops-verdict/fixtures/multi_kernel_mix_a5.csv +7 -0
  165. package/skills/tool-ops-tune/ops-verdict/fixtures/no_bound_a5.csv +9 -0
  166. package/skills/tool-ops-tune/ops-verdict/fixtures/serial_no_overlap_a2.csv +9 -0
  167. package/skills/tool-ops-tune/ops-verdict/fixtures/vec_bound_a5.csv +9 -0
  168. package/skills/tool-ops-tune/ops-verdict/references/io-contracts.md +94 -0
  169. package/skills/tool-ops-tune/ops-verdict/references/rule-schema.md +130 -0
  170. package/skills/tool-ops-tune/ops-verdict/references/scope-schema.md +61 -0
  171. package/skills/tool-ops-tune/ops-verdict/references/soc-spec.yaml +140 -0
  172. package/skills/tool-ops-tune/ops-verdict/rules/L0-instruction.yaml +67 -0
  173. package/skills/tool-ops-tune/ops-verdict/rules/L1-single-core.yaml +316 -0
  174. package/skills/tool-ops-tune/ops-verdict/rules/L2-inter-core.yaml +173 -0
  175. package/skills/tool-ops-tune/ops-verdict/rules/L3-inter-card.yaml +156 -0
  176. package/skills/tool-ops-tune/ops-verdict/scripts/batch_pipeline.py +444 -0
  177. package/skills/tool-ops-tune/ops-verdict/scripts/calibrate.py +249 -0
  178. package/skills/tool-ops-tune/ops-verdict/scripts/delta_compare.py +244 -0
  179. package/skills/tool-ops-tune/ops-verdict/scripts/render_html.py +274 -0
  180. package/skills/tool-ops-tune/ops-verdict/scripts/snapshot.py +200 -0
  181. package/skills/tool-ops-tune/ops-verdict/scripts/trace_bubble.py +331 -0
  182. package/skills/tool-ops-tune/ops-verdict/scripts/verdict.py +1072 -0
  183. package/skills/tool-ops-tune/scripts/diff_audit.py +281 -0
@@ -0,0 +1,316 @@
1
+ # L1 单核层判定规则包:核内 pipe 级 Bound
2
+ #
3
+ # 阈值来源(知识契约:每条阈值可溯源,变更须过 evals/run_evals.py 回归):
4
+ # [msprof-doc] msprof 官方文档与 CSV 字段说明(MindStudio 8.3 口径)
5
+ # [tuning-practice] 一线调优实践沉淀(阈值实测来源,标定于 A2/A5 真机案例)
6
+ schema: opstune.rules/1.0
7
+ layer: L1
8
+ title: 单核流水判定(核内 pipe 级)
9
+ soc: [a2, a3, a5]
10
+
11
+ # ---------------------------------------------------------------------------
12
+ # 指标词汇表:规则-指标绑定契约的解析层。
13
+ # columns 为候选列名(按序取首个可解析者,兼容 A5 aic_/aiv_ 双列名与旧版百分数格式)。
14
+ # normalize: ratio_to_pct — 0~1.5 视为比例 ×100(仅限 ratio 类指标,时间/计数类禁止)。
15
+ # group: pipe — 参与主导 pipe 排序(rank 聚合)与串行指纹求和。
16
+ # source: scalar — 由调用方经 --scalar 提供(如带宽占峰值百分比),缺失时反证不可评估。
17
+ # ---------------------------------------------------------------------------
18
+ metrics:
19
+ vec_ratio:
20
+ source: pipe
21
+ columns: [aiv_vec_ratio, aic_vec_ratio, "VectorUtilization(%)", vec_ratio, VECTOR(%)]
22
+ normalize: ratio_to_pct
23
+ group: pipe
24
+ cube_ratio:
25
+ source: pipe
26
+ columns: [aic_cube_ratio, aiv_cube_ratio, "CubeUtilization(%)", cube_ratio, CUBE(%)]
27
+ normalize: ratio_to_pct
28
+ group: pipe
29
+ mte2_ratio:
30
+ source: pipe
31
+ columns: [aic_mte2_ratio, aiv_mte2_ratio, ai_mte2_ratio, "Mte2Utilization(%)", mte2_ratio, MTE2(%)]
32
+ normalize: ratio_to_pct
33
+ group: pipe
34
+ mte3_ratio:
35
+ source: pipe
36
+ columns: [aic_mte3_ratio, aiv_mte3_ratio, ai_mte3_ratio, "Mte3Utilization(%)", mte3_ratio, MTE3(%)]
37
+ normalize: ratio_to_pct
38
+ group: pipe
39
+ mte1_ratio:
40
+ source: pipe
41
+ columns: [aic_mte1_ratio, aiv_mte1_ratio, "Mte1Utilization(%)", mte1_ratio, MTE1(%)]
42
+ normalize: ratio_to_pct
43
+ group: pipe
44
+ fixpipe_ratio:
45
+ source: pipe
46
+ columns: [aic_fixpipe_ratio, aiv_fixpipe_ratio, "FixpipeUtilization(%)", fixp_ratio, FIXP(%)]
47
+ normalize: ratio_to_pct
48
+ group: pipe
49
+ scalar_ratio:
50
+ source: pipe
51
+ columns: [aic_scalar_ratio, aiv_scalar_ratio, ai_scalar_ratio, "ScalarUtilization(%)", scalar_ratio, SCALAR(%)]
52
+ normalize: ratio_to_pct
53
+ group: pipe
54
+ mte2_active_bw_pct_of_peak:
55
+ source: scalar
56
+ description: MTE2 活跃带宽占理论峰值百分比(调用方按目标 SoC 峰值换算后提供)
57
+ vec_total_cflt_ratio:
58
+ source: scalar
59
+ description: Vector 指令 Bank conflict 比例(ResourceConflictRatio.csv ai*_vec_total_cflt_ratio,调用方换算后提供)
60
+ vec_fp32_ratio:
61
+ source: scalar
62
+ description: Vector 中 fp32 指令占比(ArithmeticUtilization.csv,调用方换算后提供)
63
+ fixpipe_align_hint:
64
+ source: scalar
65
+ description: 保留位(未使用)
66
+
67
+ rules:
68
+ # ---------------------------------------------------------------- MTE2 搬入
69
+ - id: L1_MTE2_BOUND
70
+ name: MTE2 搬入瓶颈
71
+ priority: 10
72
+ parent: L1_MEMORY_SATURATION
73
+ threshold_source: "[msprof-doc] >80% 直接判 / 最大且 >70%;watch 50% 档取 [tuning-practice]"
74
+ metrics_required: [mte2_ratio]
75
+ metrics_optional: [mte2_active_bw_pct_of_peak, fixpipe_ratio]
76
+ condition:
77
+ any:
78
+ - {metric: mte2_ratio, agg: mean, op: gt, value: 80}
79
+ - all:
80
+ - {metric: mte2_ratio, agg: mean, op: gt, value: 70}
81
+ - {metric: mte2_ratio, agg: rank, op: eq, value: 1}
82
+ watch:
83
+ condition: {metric: mte2_ratio, agg: mean, op: gt, value: 50}
84
+ note: MTE2 占比 50~70%,暂非主导,已具备搬运优化价值
85
+ severity:
86
+ metric: mte2_ratio
87
+ bands:
88
+ - {min: 85, level: critical, note: 接近极限,单机制收益有限,需数据量/复用级优化}
89
+ - {min: 70, level: moderate}
90
+ default: light
91
+ counter_evidence:
92
+ - id: true-bandwidth-saturation
93
+ condition: {metric: mte2_active_bw_pct_of_peak, agg: value, op: gt, value: 80}
94
+ note: active_bw 已达理论 80%+:真带宽饱和。优化在数据量削减/复用,不在搬运组织
95
+ action: annotate
96
+ - id: fake-mte2-small-packet
97
+ condition: {metric: mte2_active_bw_pct_of_peak, agg: value, op: lt, value: 40}
98
+ note: busy 高但带宽 <40% 峰值:疑似小包/非对齐/频繁同步(假 MTE2 bound)
99
+ action: annotate
100
+ - id: fixpipe-misalignment
101
+ condition: {metric: fixpipe_ratio, agg: mean, op: gt, value: 15}
102
+ note: fixpipe >15%:GM 地址未 512B 对齐问题叠加 [tuning-practice]
103
+ action: annotate
104
+ confidence: high
105
+ speedup_range: [1.2, 2.0]
106
+ speedup_source: "[tuning-practice] MTE2 优化方法预期收益,🟡 首期标定值"
107
+ mechanism_refs:
108
+ - ops-mechanism:references/optimize/data-copy.md
109
+ - ops-mechanism:references/optimize/memory-hierarchy.md
110
+
111
+ # ---------------------------------------------------------------- CUBE 计算
112
+ - id: L1_CUBE_BOUND
113
+ name: Cube 矩阵计算瓶颈
114
+ priority: 20
115
+ parent: L1_COMPUTE_SATURATION
116
+ threshold_source: "[msprof-doc]"
117
+ metrics_required: [cube_ratio]
118
+ metrics_optional: []
119
+ condition:
120
+ any:
121
+ - {metric: cube_ratio, agg: mean, op: gt, value: 80}
122
+ - all:
123
+ - {metric: cube_ratio, agg: mean, op: gt, value: 70}
124
+ - {metric: cube_ratio, agg: rank, op: eq, value: 1}
125
+ watch:
126
+ condition: {metric: cube_ratio, agg: mean, op: gt, value: 40}
127
+ note: Cube 占比 >40%(MatMul 类正常水位 [msprof-doc])
128
+ severity:
129
+ metric: cube_ratio
130
+ bands:
131
+ - {min: 85, level: critical, note: 接近理论极限,先核 fops 折算的真实利用率}
132
+ - {min: 70, level: moderate}
133
+ default: light
134
+ counter_evidence:
135
+ - id: check-real-flops
136
+ condition: {metric: cube_ratio, agg: mean, op: gt, value: 85}
137
+ note: busy 接近饱和时必须用 aic_cube_fops 折算理论利用率,排除空转指令 [tuning-practice]
138
+ action: annotate
139
+ confidence: high
140
+ speedup_range: [1.1, 1.5]
141
+ speedup_source: 🟡 首期标定值
142
+ mechanism_refs:
143
+ - ops-mechanism:references/optimize/ascendc-tiling.md
144
+ - ops-family:references/matmul/guide.md
145
+
146
+ # ---------------------------------------------------------------- VEC 向量
147
+ - id: L1_VEC_BOUND
148
+ name: Vector 向量计算瓶颈
149
+ priority: 30
150
+ parent: L1_COMPUTE_SATURATION
151
+ threshold_source: "[msprof-doc] 主判定表;[tuning-practice] 50-65/65-80/>80 三档"
152
+ metrics_required: [vec_ratio]
153
+ metrics_optional: []
154
+ condition:
155
+ any:
156
+ - {metric: vec_ratio, agg: mean, op: gt, value: 80}
157
+ - all:
158
+ - {metric: vec_ratio, agg: mean, op: gt, value: 70}
159
+ - {metric: vec_ratio, agg: rank, op: eq, value: 1}
160
+ watch:
161
+ condition: {metric: vec_ratio, agg: mean, op: gt, value: 50}
162
+ note: VEC 占比 50~70%,UB 融合/减 Cast 已有收益空间 [tuning-practice]
163
+ severity:
164
+ metric: vec_ratio
165
+ bands:
166
+ - {min: 80, level: critical, note: VEC 接近理论极限,优化空间有限,转数据量/算法侧}
167
+ - {min: 65, level: moderate, note: 需减少 Cast 或融合指令}
168
+ - {min: 50, level: light, note: DoubleBuffer + UB 融合有较大收益}
169
+ default: light
170
+ counter_evidence:
171
+ - id: bank-conflict-amplify
172
+ condition: {metric: vec_total_cflt_ratio, agg: mean, op: gt, value: 5}
173
+ note: Bank conflict 放大了 VEC 耗时,先解冲突再谈向量化 [tuning-practice 交叉关联诊断]
174
+ action: annotate
175
+ - id: cast-heavy
176
+ condition: {metric: vec_fp32_ratio, agg: mean, op: gt, value: 60}
177
+ note: fp32 指令占比高:存在大量 fp16→fp32 转换,减 Cast 优先 [tuning-practice]
178
+ action: annotate
179
+ confidence: high
180
+ speedup_range: [1.1, 1.5]
181
+ speedup_source: "[tuning-practice] UB 融合 20-50% / 减 Cast 10-30%(档位内取保守下界),🟡 待校准"
182
+ mechanism_refs:
183
+ - ops-mechanism:references/optimize/api-usage.md
184
+ - ops-mechanism:references/optimize/pipeline.md
185
+ - ops-mechanism:references/optimize/ascendc-regbase-vf.md
186
+
187
+ # ---------------------------------------------------------------- MTE3 搬出
188
+ - id: L1_MTE3_BOUND
189
+ name: MTE3 搬出瓶颈
190
+ priority: 40
191
+ parent: L1_MEMORY_SATURATION
192
+ threshold_source: "[msprof-doc]"
193
+ metrics_required: [mte3_ratio]
194
+ metrics_optional: []
195
+ condition:
196
+ any:
197
+ - {metric: mte3_ratio, agg: mean, op: gt, value: 80}
198
+ - all:
199
+ - {metric: mte3_ratio, agg: mean, op: gt, value: 70}
200
+ - {metric: mte3_ratio, agg: rank, op: eq, value: 1}
201
+ severity:
202
+ metric: mte3_ratio
203
+ bands:
204
+ - {min: 85, level: critical}
205
+ - {min: 70, level: moderate}
206
+ default: light
207
+ confidence: high
208
+ speedup_range: [1.1, 1.4]
209
+ speedup_source: 🟡 首期标定值
210
+ mechanism_refs:
211
+ - ops-mechanism:references/optimize/data-copy.md
212
+
213
+ # ---------------------------------------------------------------- FIXP
214
+ - id: L1_FIXP_BOUND
215
+ name: FixPipe 输出瓶颈
216
+ priority: 50
217
+ parent: L1_MEMORY_SATURATION
218
+ threshold_source: "[msprof-doc] >80% 判 bound;>15% 对齐预警取 [tuning-practice]"
219
+ metrics_required: [fixpipe_ratio]
220
+ metrics_optional: []
221
+ condition: {metric: fixpipe_ratio, agg: mean, op: gt, value: 80}
222
+ watch:
223
+ condition: {metric: fixpipe_ratio, agg: mean, op: gt, value: 15}
224
+ note: fixpipe >15%:GM 地址未 512B 对齐的直接信号,修复成本低收益显著 [tuning-practice FA 案例]
225
+ severity:
226
+ metric: fixpipe_ratio
227
+ bands:
228
+ - {min: 85, level: critical}
229
+ - {min: 80, level: moderate}
230
+ default: light
231
+ confidence: high
232
+ speedup_range: [1.1, 1.3]
233
+ speedup_source: 🟡 首期标定值
234
+ mechanism_refs:
235
+ - ops-mechanism:references/optimize/data-copy.md
236
+
237
+ # ---------------------------------------------------------------- SCALAR
238
+ - id: L1_SCALAR_BOUND
239
+ name: Scalar 标量瓶颈
240
+ priority: 60
241
+ parent: L1_SCALAR_SATURATION
242
+ threshold_source: "[tuning-practice] >30% 判定;[tuning-practice] >90% 且 vec/mte 低 → 标量访问/地址计算"
243
+ metrics_required: [scalar_ratio, vec_ratio]
244
+ metrics_optional: []
245
+ condition:
246
+ any:
247
+ - {metric: scalar_ratio, agg: mean, op: gt, value: 80}
248
+ - all:
249
+ - {metric: scalar_ratio, agg: mean, op: gt, value: 70}
250
+ - {metric: scalar_ratio, agg: rank, op: eq, value: 1}
251
+ watch:
252
+ condition: {metric: scalar_ratio, agg: mean, op: gt, value: 30}
253
+ note: scalar >30%:常见于数据量小、头开销占比大场景;检查 TilingData 体积与核数 [tuning-practice]
254
+ severity:
255
+ metric: scalar_ratio
256
+ bands:
257
+ - {min: 85, level: critical}
258
+ - {min: 70, level: moderate}
259
+ default: light
260
+ counter_evidence:
261
+ - id: address-compute-heavy
262
+ condition: {metric: scalar_ratio, agg: mean, op: gt, value: 90}
263
+ note: scalar >90% 而 vec/mte 低:标量访问/地址计算主导,查指针运算与分支 [tuning-practice]
264
+ action: annotate
265
+ confidence: high
266
+ speedup_range: [1.1, 1.5]
267
+ speedup_source: 🟡 首期标定值
268
+ mechanism_refs:
269
+ - ops-mechanism:references/optimize/api-usage.md
270
+
271
+ # ------------------------------------------------- LATENCY/SYNC 可疑档
272
+ - id: L1_LATENCY_SYNC_SUSPECT
273
+ name: 全流水低占用(LATENCY/SYNC 可疑)
274
+ priority: 70
275
+ parent: L1_LATENCY
276
+ threshold_source: "[tuning-practice] 全 pipe busy 均值 <50% 不是『无 bound』"
277
+ metrics_required: [vec_ratio, cube_ratio, mte2_ratio, mte3_ratio, scalar_ratio]
278
+ metrics_optional: []
279
+ condition:
280
+ all:
281
+ - {metric: __max_pipe_mean, op: lt, value: 50}
282
+ severity:
283
+ metric: __max_pipe_mean
284
+ bands:
285
+ - {max: 30, level: critical, note: 全 pipe <30%,重度等待}
286
+ - {max: 50, level: moderate}
287
+ default: light
288
+ counter_evidence:
289
+ - id: serial-fingerprint
290
+ condition: {metric: __pipe_sum_mean, op: between, value: [85, 115]}
291
+ note: 多 pipe 互补求和≈100%:串行无重叠指纹,Double Buffer / 流水掩盖是首选机制 [tuning-practice]
292
+ action: annotate
293
+ confidence: medium
294
+ speedup_range: [1.2, 2.5]
295
+ speedup_source: "[tuning-practice] Double Buffer 类机制实测区间,🟡 待校准"
296
+ mechanism_refs:
297
+ - ops-mechanism:references/optimize/pipeline.md
298
+
299
+ # ------------------------------------------------- 串行无重叠指纹(独立发现)
300
+ - id: L1_SERIAL_NO_OVERLAP
301
+ name: 串行无重叠指纹
302
+ priority: 80
303
+ parent: L1_LATENCY
304
+ threshold_source: "[tuning-practice] cube 0.44+mte2 0.42+mte1 0.18≈1 案例"
305
+ metrics_required: [vec_ratio, cube_ratio, mte2_ratio, mte3_ratio, mte1_ratio, scalar_ratio, fixpipe_ratio]
306
+ metrics_optional: []
307
+ condition:
308
+ all:
309
+ - {metric: __max_pipe_mean, op: lt, value: 70}
310
+ - {metric: __pipe_sum_mean, op: between, value: [85, 115]}
311
+ severity: {default: moderate}
312
+ confidence: medium
313
+ speedup_range: [1.3, 2.0]
314
+ speedup_source: "单缓冲→双缓冲典型收益,🟡 待校准"
315
+ mechanism_refs:
316
+ - ops-mechanism:references/optimize/pipeline.md
@@ -0,0 +1,173 @@
1
+ # L2 核间层判定规则包:多核负载与占用
2
+ #
3
+ # 阈值来源:
4
+ # [tuning-practice] 一线调优实践沉淀:长尾 1.25x 档 / A5 典型 28 AIC·56 AIV(soc-spec.yaml 实测勘误)
5
+ # [tuning-practice] 逐核耗时离散度三档(<10 达标 / 10~30 警告 / >30 严重,A2/A5 实测标定)
6
+ # [tuning-practice] 头开销参考值(Atlas A2 满核 ~20-21us,实测;A5 未标定,见 soc-spec.yaml 🟡)
7
+ schema: opstune.rules/1.0
8
+ layer: L2
9
+ title: 核间负载判定
10
+ soc: [a2, a3, a5]
11
+
12
+ metrics:
13
+ row_count:
14
+ source: derived
15
+ description: PipeUtilization 有效 block 行数(活跃核数)
16
+ block_dim:
17
+ source: scalar
18
+ description: OpBasicInfo Block Dim(逻辑核数)
19
+ physical_cores:
20
+ source: scalar
21
+ description: 目标 SoC 物理核数(调用方提供:优先按 soc-spec.yaml skus 解析实际 SKU;a5 典型 28 AIC/56 AIV、a2 典型 24 AIC/48 AIV——旧注释「A5 约 48 AIV/28 AIC」已按 ini 实测勘误)
22
+ task_duration_us:
23
+ source: scalar
24
+ description: OpBasicInfo Task Duration(us)
25
+ dominant_time_us:
26
+ source: derived
27
+ description: max(aic_time, aiv_time) 逐核均值(核执行主体时间;引擎按 CSV 逐核耗时均值计算)
28
+ time_mean_us:
29
+ source: derived
30
+ description: 逐核耗时均值(活跃核)
31
+ time_max_us:
32
+ source: derived
33
+ description: 逐核耗时最大值(最慢核)
34
+ time_min_us:
35
+ source: derived
36
+ description: 逐核耗时最小值
37
+ host_dispatch_us:
38
+ source: scalar
39
+ description: host 下发间隙(launch → task start,µs;scene=cluster 由 host 侧时间轴产物换算后提供——P2-4 规划态,暂无生产者)
40
+
41
+ rules:
42
+ - id: L2_CORE_TAIL
43
+ name: 核间长尾
44
+ priority: 10
45
+ threshold_source: "[tuning-practice] max > mean×1.25;[tuning-practice] 离散度三档"
46
+ metrics_required: [time_mean_us, time_max_us, time_min_us]
47
+ metrics_optional: []
48
+ condition:
49
+ all:
50
+ - {metric: time_mean_us, op: gt, value: 0}
51
+ - {metric: time_max_us, op: gt_ratio, value: {metric: time_mean_us, factor: 1.25}}
52
+ severity:
53
+ metric: __tail_ratio
54
+ bands:
55
+ - {min: 1.6, level: critical}
56
+ - {min: 1.25, level: moderate}
57
+ default: light
58
+ counter_evidence:
59
+ - id: numa-two-cluster
60
+ condition: {metric: __two_cluster_gap_pct, op: gt, value: 2}
61
+ note: 前后半段核均值差距 ≥2%:疑似 NUMA/L2 slice 负载偏斜,block swat / 尾轮均衡优先 [tuning-practice]
62
+ action: annotate
63
+ confidence: high
64
+ speedup_range: [1.05, 1.3]
65
+ speedup_source: 🟡 首期标定值
66
+ mechanism_refs:
67
+ - ops-mechanism:references/optimize/ascendc-tiling.md
68
+
69
+ - id: L2_IMBALANCE_MILD
70
+ name: 核间负载不均衡(离散度警告档)
71
+ priority: 15
72
+ threshold_source: "[tuning-practice] (max-min)/max:10~30% 警告"
73
+ metrics_required: [time_mean_us, time_max_us, time_min_us]
74
+ metrics_optional: []
75
+ condition:
76
+ all:
77
+ - {metric: __imbalance_pct, op: gt, value: 10}
78
+ - {metric: __imbalance_pct, op: lte, value: 30}
79
+ severity: {default: light}
80
+ confidence: medium
81
+ speedup_range: [1.0, 1.1]
82
+ speedup_source: 🟡 首期标定值
83
+ mechanism_refs:
84
+ - ops-mechanism:references/optimize/ascendc-tiling.md
85
+
86
+ - id: L2_IMBALANCE_SEVERE
87
+ name: 核间负载不均衡(离散度严重档)
88
+ priority: 16
89
+ threshold_source: "[tuning-practice] (max-min)/max >30% 严重问题"
90
+ metrics_required: [time_mean_us, time_max_us, time_min_us]
91
+ metrics_optional: []
92
+ condition: {metric: __imbalance_pct, op: gt, value: 30}
93
+ severity: {default: critical}
94
+ confidence: high
95
+ speedup_range: [1.1, 1.5]
96
+ speedup_source: 🟡 首期标定值
97
+ mechanism_refs:
98
+ - ops-mechanism:references/optimize/ascendc-tiling.md
99
+
100
+ - id: L2_UNDERUTILIZATION
101
+ name: 切核不足(occupancy 可疑)
102
+ priority: 20
103
+ threshold_source: "[tuning-practice] block 行数 ≪ 物理核数;[tuning-practice] Block Dim 不足是最常见低垂果实"
104
+ metrics_required: [row_count, physical_cores]
105
+ metrics_optional: [block_dim]
106
+ condition:
107
+ all:
108
+ - {metric: row_count, op: gt, value: 0}
109
+ - {metric: row_count, op: lt_ratio, value: {metric: physical_cores, factor: 0.33}}
110
+ severity:
111
+ metric: __occupancy_pct
112
+ bands:
113
+ - {max: 10, level: critical, note: 活跃核不足物理核 10%,切分严重不足}
114
+ - {max: 33, level: moderate}
115
+ default: light
116
+ counter_evidence:
117
+ - id: small-case-fewer-cores
118
+ condition: {metric: task_duration_us, op: lt, value: 25}
119
+ note: Task 极短(<25us):数据量小,增核可能放大头开销(A2 满核头开销 ~20-21us),需权衡 [tuning-practice]
120
+ action: annotate
121
+ confidence: medium
122
+ speedup_range: [1.2, 3.0]
123
+ speedup_source: "[tuning-practice] Block Dim 4→20 核案例 4.75x(区间下界保守化),🟡 待校准"
124
+ mechanism_refs:
125
+ - ops-mechanism:references/optimize/ascendc-tiling.md
126
+
127
+ - id: L2_HEAD_OVERHEAD
128
+ name: 头开销占比过高
129
+ priority: 30
130
+ threshold_source: "[tuning-practice] overhead = TaskDuration − max(aic,aiv);[tuning-practice] 头开销占比 >30% 说明数据量太小或核数太多"
131
+ metrics_required: [task_duration_us, dominant_time_us]
132
+ metrics_optional: []
133
+ condition:
134
+ all:
135
+ - {metric: task_duration_us, op: gt, value: 0}
136
+ # 木桶口径:头开销以最慢核为基准(Task 总时长 − 最慢核主体时间)/ Task 总时长
137
+ - {metric: __head_overhead_pct, op: gt, value: 30}
138
+ severity:
139
+ metric: __head_overhead_pct
140
+ bands:
141
+ - {min: 50, level: critical}
142
+ - {min: 30, level: moderate}
143
+ default: light
144
+ confidence: medium
145
+ speedup_range: [1.05, 1.2]
146
+ speedup_source: 🟡 首期标定值
147
+ mechanism_refs:
148
+ - ops-mechanism:references/optimize/api-usage.md
149
+
150
+ # ------------------------------------------------ host 下发档(P2-4/G17,scene=cluster)
151
+ # 集群视角的 host 侧证据:下发阻塞(launch → task start 的 host 间隙)主导时,
152
+ # 算子侧优化收益有限,先解 host 下发(流组织 / launch 合并 / host 占用)。
153
+ - id: L2_HOST_DISPATCH_BLOCK
154
+ name: host 下发阻塞(scene=cluster 专用档)
155
+ priority: 35
156
+ threshold_source: "🟡 host_dispatch_us > 50 且占 task_duration >30% 为初值占位(首个集群场景实战后标定)"
157
+ metrics_required: [host_dispatch_us, task_duration_us]
158
+ metrics_optional: []
159
+ condition:
160
+ all:
161
+ - {metric: host_dispatch_us, op: gt, value: 50}
162
+ - {metric: __host_dispatch_pct, op: gt, value: 30}
163
+ severity:
164
+ metric: __host_dispatch_pct
165
+ bands:
166
+ - {min: 50, level: critical, note: 下发间隙超过 task 半程:host 侧完全主导}
167
+ - {min: 30, level: moderate}
168
+ default: light
169
+ confidence: low
170
+ speedup_range: [1.0, 1.2]
171
+ speedup_source: 🟡 待标定(P2-4 规划态规则,缺真实集群数据)
172
+ mechanism_refs:
173
+ - ops-mechanism:references/optimize/api-usage.md
@@ -0,0 +1,156 @@
1
+ # L3 卡间层判定规则包:MC² 通算融合通信-计算比
2
+ #
3
+ # 阈值来源:
4
+ # [mc2-practice] MC² 通算融合一线调优实践:R 值五档(真机实测 R 从 0.3 到 9.8)
5
+ # [mc2-practice] 掩盖率公式 / 跨 rank max 口径(多卡实测沉淀)
6
+ #
7
+ # 前置要求(由 ops-collect 隔离测试产出,缺失时本规则包整体降级为 UNRESOLVED):
8
+ # - T_comm:tileCnt=1 注释计算 process,多 rank 并行采集,取各 rank 稳态均值最大值
9
+ # - T_compute:tileCnt=1 注释通信 process,同上口径
10
+ schema: opstune.rules/1.0
11
+ layer: L3
12
+ title: 卡间通算比判定(MC²)
13
+ soc: [a5]
14
+ requires_experiment:
15
+ kind: isolation_test
16
+ outputs: [t_comm_us, t_compute_us, m_rows]
17
+ note: 隔离测试数据缺失时本包所有规则不触发,输出 UNRESOLVED + 补采指令
18
+
19
+ metrics:
20
+ t_comm_us:
21
+ source: scalar
22
+ description: 纯通信耗时(隔离测试,跨 rank max 稳态均值)
23
+ t_compute_us:
24
+ source: scalar
25
+ description: 纯计算耗时(隔离测试,跨 rank max 稳态均值)
26
+ r_value:
27
+ source: derived
28
+ description: R = T_compute / T_comm
29
+ mask_ratio:
30
+ source: scalar
31
+ description: 掩盖率 = (融合前耗时−融合后耗时)/min(T_comm,T_compute)
32
+ rank_imbalance:
33
+ source: scalar
34
+ description: max(rank 稳态均值)/mean(rank 稳态均值)
35
+ mte2_ratio_full:
36
+ source: scalar
37
+ description: 完整算子 aic_mte2_ratio(含通信等待,跨 rank max)
38
+ mte2_ratio_pure:
39
+ source: scalar
40
+ description: 隔离测试纯计算路径 aic_mte2_ratio(无通信等待)
41
+
42
+ rules:
43
+ - id: L3_MC2_BALANCED
44
+ name: 通算完美平衡
45
+ priority: 10
46
+ threshold_source: "[mc2-practice] R≈1 (0.9~1.1)"
47
+ metrics_required: [t_comm_us, t_compute_us]
48
+ metrics_optional: []
49
+ condition:
50
+ all:
51
+ - {metric: r_value, op: between, value: [0.9, 1.1]}
52
+ severity: {default: light}
53
+ confidence: high
54
+ speedup_range: [1.0, 1.1]
55
+ speedup_source: "[mc2-practice] 等分切分即最优"
56
+ mechanism_refs:
57
+ - ops-mechanism:references/optimize/mc2.md
58
+
59
+ - id: L3_MC2_COMPUTE_BOUND
60
+ name: 通算计算 Bound
61
+ priority: 20
62
+ threshold_source: "[mc2-practice] 1.1 < R ≤ 2"
63
+ metrics_required: [t_comm_us, t_compute_us]
64
+ metrics_optional: [mask_ratio]
65
+ condition:
66
+ all:
67
+ - {metric: r_value, op: gt, value: 1.1}
68
+ - {metric: r_value, op: lte, value: 2}
69
+ severity: {default: moderate}
70
+ confidence: high
71
+ speedup_range: [1.1, 1.8]
72
+ speedup_source: "[mc2-practice] 用通信掩盖计算,增大 tileCnt;🟡 待校准"
73
+ mechanism_refs:
74
+ - ops-mechanism:references/optimize/mc2.md
75
+ - ops-mechanism:references/optimize/mc2-balancing.md
76
+
77
+ - id: L3_MC2_STRONG_COMPUTE
78
+ name: 通算强计算 Bound
79
+ priority: 21
80
+ threshold_source: "[mc2-practice] R > 2"
81
+ metrics_required: [t_comm_us, t_compute_us]
82
+ metrics_optional: []
83
+ condition: {metric: r_value, op: gt, value: 2}
84
+ severity: {default: critical}
85
+ confidence: high
86
+ speedup_range: [1.0, 1.2]
87
+ speedup_source: "[mc2-practice] 增大 tileCnt 收益极小,倾向少切分;须搜索确认"
88
+ mechanism_refs:
89
+ - ops-mechanism:references/optimize/mc2.md
90
+ - ops-family:references/matmul/guide.md
91
+
92
+ - id: L3_MC2_COMM_BOUND
93
+ name: 通算通信 Bound
94
+ priority: 30
95
+ threshold_source: "[mc2-practice] R < 0.9(上界 0.9 与 BALANCED 下界 0.9 对齐,消除区间重叠)"
96
+ metrics_required: [t_comm_us, t_compute_us]
97
+ metrics_optional: [mask_ratio]
98
+ condition:
99
+ all:
100
+ - {metric: r_value, op: lt, value: 0.9}
101
+ - {metric: r_value, op: gte, value: 0.5}
102
+ severity: {default: moderate}
103
+ confidence: high
104
+ speedup_range: [1.1, 1.8]
105
+ speedup_source: "[mc2-practice] 用计算掩盖通信,增大 tileCnt;🟡 待校准"
106
+ mechanism_refs:
107
+ - ops-mechanism:references/optimize/mc2.md
108
+ - ops-mechanism:references/optimize/mc2-balancing.md
109
+
110
+ - id: L3_MC2_STRONG_COMM
111
+ name: 通算强通信 Bound
112
+ priority: 31
113
+ threshold_source: "[mc2-practice] R < 0.5"
114
+ metrics_required: [t_comm_us, t_compute_us]
115
+ metrics_optional: []
116
+ condition: {metric: r_value, op: lt, value: 0.5}
117
+ severity: {default: critical}
118
+ confidence: high
119
+ speedup_range: [1.2, 2.0]
120
+ speedup_source: "[mc2-practice] 从短块出发搜索,最大化 tileCnt;🟡 待校准"
121
+ mechanism_refs:
122
+ - ops-mechanism:references/optimize/mc2.md
123
+ - ops-mechanism:references/optimize/mc2-balancing.md
124
+
125
+ - id: L3_MTE2_POLLUTED
126
+ name: MTE2 指标被通信等待污染(路由规则)
127
+ priority: 5
128
+ threshold_source: "[mc2-practice] ratio_full−ratio_pure > 0.1 或 ratio_pure/ratio_full < 0.8"
129
+ metrics_required: [mte2_ratio_full, mte2_ratio_pure]
130
+ metrics_optional: []
131
+ condition:
132
+ any:
133
+ - {metric: __mte2_pollution_gap, op: gt, value: 10}
134
+ - {metric: __mte2_pure_ratio_pct, op: lt, value: 80}
135
+ severity: {default: moderate}
136
+ confidence: high
137
+ routing:
138
+ on_hit: [disable_rule, L1_MTE2_BOUND]
139
+ reroute_to: ops-mechanism:references/optimize/mc2.md
140
+ note: MTE2 含通信等待空转,单核访存优化无效,路由到通信掩盖策略
141
+ mechanism_refs:
142
+ - ops-mechanism:references/optimize/mc2.md
143
+
144
+ - id: L3_RANK_IMBALANCE
145
+ name: 跨 rank 木桶不均衡
146
+ priority: 40
147
+ threshold_source: 🟡 M1 实测标定(初值 1.1 为工程经验占位)
148
+ metrics_required: [rank_imbalance]
149
+ metrics_optional: []
150
+ condition: {metric: rank_imbalance, op: gt, value: 1.1}
151
+ severity: {default: moderate}
152
+ confidence: low
153
+ speedup_range: [1.0, 1.15]
154
+ speedup_source: 🟡 待标定
155
+ mechanism_refs:
156
+ - ops-mechanism:references/optimize/mc2.md