@cannbot-plugin/cannbot-harness 0.0.0-stage → 0.1.5

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 (1291) hide show
  1. package/README.md +105 -3
  2. package/THIRD_PARTY_NOTICES.md +11 -0
  3. package/assets/ops-direct-invoke/.cannbot-bundle +1 -0
  4. package/assets/ops-direct-invoke/.claude-plugin/plugin.json +21 -0
  5. package/assets/ops-direct-invoke/.codex-plugin/plugin.json +30 -0
  6. package/assets/ops-direct-invoke/AGENTS.md +93 -0
  7. package/assets/ops-direct-invoke/LICENSE +38 -0
  8. package/assets/ops-direct-invoke/QUICKSTART.md +44 -0
  9. package/assets/ops-direct-invoke/README.md +219 -0
  10. package/assets/ops-direct-invoke/SKILLS_LICENSE +38 -0
  11. package/assets/ops-direct-invoke/agents/ops-direct-invoke-architect.md +39 -0
  12. package/assets/ops-direct-invoke/agents/ops-direct-invoke-developer.md +39 -0
  13. package/assets/ops-direct-invoke/agents/ops-direct-invoke-verifier.md +38 -0
  14. package/assets/ops-direct-invoke/init.sh +8 -0
  15. package/assets/ops-direct-invoke/plugin-install.json +24 -0
  16. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/SKILL.md +88 -0
  17. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/evals/evals.json +207 -0
  18. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-arithmetic.md +399 -0
  19. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-atomic.md +192 -0
  20. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-buffer.md +364 -0
  21. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-cross-gen-fixpipe.md +28 -0
  22. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-cross-gen-migration.md +91 -0
  23. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-crosscore-sync.md +259 -0
  24. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-datacopy.md +405 -0
  25. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-gathermask.md +243 -0
  26. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-gmm.md +260 -0
  27. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-hccl-host.md +187 -0
  28. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-hcomm.md +229 -0
  29. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-host-runtime.md +129 -0
  30. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-loaddata.md +196 -0
  31. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-matmul.md +364 -0
  32. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-mrgsort.md +636 -0
  33. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-pipeline.md +206 -0
  34. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-precision.md +146 -0
  35. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-quickref.md +192 -0
  36. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-reduce-pattern.md +132 -0
  37. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-reduce.md +282 -0
  38. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-repeat-limits.md +144 -0
  39. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-restrictions.md +200 -0
  40. package/assets/ops-direct-invoke/skills/ascendc-api-best-practices/references/api-transpose.md +234 -0
  41. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/SKILL.md +245 -0
  42. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/block/block_mmad_glu.h +238 -0
  43. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/block/block_scheduler_group_matmul.h +106 -0
  44. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/block/weight_quant_matmul_block_mmad.h +362 -0
  45. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/block_epilogue_dequant_swiglu.h +265 -0
  46. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/block_epilogue_pertoken_quant_single_pass.h +252 -0
  47. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/block_epilogue_pertoken_quant_two_pass_chunked.h +313 -0
  48. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/block_epilogue_swiglu.h +171 -0
  49. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/cv_sync_constants.h +32 -0
  50. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/epilogue_fusion_membase.h +212 -0
  51. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/epilogue_fusion_regbase.h +324 -0
  52. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/online_softmax_cross_core_epilogue.h +396 -0
  53. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/epilogue/online_softmax_per_tile_epilogue.h +421 -0
  54. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/kernel/group_matmul_kernel_cv1_v2.h +150 -0
  55. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/kernel/group_matmul_kernel_glu_fused.h +345 -0
  56. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/kernel/weight_quant_matmul_kernel.h +611 -0
  57. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/policy/dispatch_policy.h +63 -0
  58. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/utils/common_utils.h +101 -0
  59. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/blaze_custom/utils/integral_constant.h +38 -0
  60. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/matmul/blaze_group_matmul_pertoken_quant_selector.h +119 -0
  61. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/matmul/blaze_group_matmul_tiling_data.h +38 -0
  62. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/matmul/blaze_matmul_tiling.h +457 -0
  63. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/matmul/blaze_matmul_tiling_data.h +50 -0
  64. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/mx/quant_matmul_mx_tiling.h +549 -0
  65. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/mx/quant_matmul_mx_tiling_data.h +47 -0
  66. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/weight_quant/weight_quant_tiling.h +428 -0
  67. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/assets/op_tiling/weight_quant/weight_quant_tiling_data.h +59 -0
  68. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/evals/evals.json +234 -0
  69. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/blaze-investigation/assembly-recovery-method.md +106 -0
  70. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/blaze-investigation/dependency-trace-method.md +140 -0
  71. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/blaze-investigation/design-contract-method.md +78 -0
  72. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/blaze-investigation/investigation-report-template.md +249 -0
  73. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/blaze-investigation/source-investigation-method.md +131 -0
  74. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/fundamentals/blaze-cmake-build-guide.md +184 -0
  75. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/fundamentals/blaze-framework-overview.md +403 -0
  76. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/fundamentals/blaze-matmul-layout.md +322 -0
  77. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/fundamentals/blaze-sync-patterns.md +814 -0
  78. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/fundamentals/tensor-api-reference.md +589 -0
  79. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/blaze-design-template.md +593 -0
  80. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/blaze-plan-template.md +391 -0
  81. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/glu-development.md +755 -0
  82. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/glu-precision-diagnosis.md +113 -0
  83. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/group-matmul-delta.md +299 -0
  84. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/per-token-quant-development.md +450 -0
  85. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/kernel-design/tiling-selection.md +114 -0
  86. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/launcher/launcher-development.md +346 -0
  87. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-elementwise-then-vector-pertoken-quant/cube-matmul-then-vector-elementwise-then-vector-pertoken-quant-design.md +196 -0
  88. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-elementwise-then-vector-pertoken-quant/cube-matmul-then-vector-elementwise-then-vector-pertoken-quant-development.md +104 -0
  89. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-glu/cube-matmul-then-vector-glu-design.md +150 -0
  90. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-glu/cube-matmul-then-vector-glu-development.md +54 -0
  91. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-glu-then-vector-pertoken-quant/cube-matmul-then-vector-glu-then-vector-pertoken-quant-design.md +189 -0
  92. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-glu-then-vector-pertoken-quant/cube-matmul-then-vector-glu-then-vector-pertoken-quant-development.md +52 -0
  93. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-pertoken-quant/cube-matmul-then-vector-pertoken-quant-design.md +138 -0
  94. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-pertoken-quant/cube-matmul-then-vector-pertoken-quant-development.md +45 -0
  95. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-softmax-reduce/cube-matmul-then-vector-softmax-reduce-design.md +205 -0
  96. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-softmax-reduce/cube-matmul-then-vector-softmax-reduce-development.md +99 -0
  97. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-softmax-reduce/cv-sync-and-two-phase-entry.md +156 -0
  98. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-softmax-reduce/cv1-v2-adaptation-for-softmax-reduce.md +331 -0
  99. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-softmax-reduce/online-softmax-reduce-epilogue-design.md +174 -0
  100. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/cube-matmul-then-vector-softmax-reduce/reduce-adaptation-guide.md +204 -0
  101. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/block-l0c2ub-extension.md +75 -0
  102. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/elementwise-broadcast-epilogue-fusion-design.md +280 -0
  103. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/elementwise-broadcast-epilogue-fusion-development.md +202 -0
  104. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/epilogue-membase-design.md +82 -0
  105. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/epilogue-regbase-design.md +95 -0
  106. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/fused-kernel-development.md +71 -0
  107. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/precision-diagnosis.md +86 -0
  108. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/elementwise-broadcast-epilogue-fusion/splitm-contract-and-debugging.md +86 -0
  109. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/index.md +14 -0
  110. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/scenario-extension-guide.md +84 -0
  111. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/layout-variant-boundary.md +76 -0
  112. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/pitfalls-and-diagnosis.md +124 -0
  113. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/prologue-ub-layout-design.md +135 -0
  114. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/prologue-vf-dequant-design.md +213 -0
  115. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/vc-sync-and-l1-layout-design.md +103 -0
  116. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/weight-dequant-prologue-fusion-design.md +289 -0
  117. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/weight-dequant-prologue-fusion-development.md +232 -0
  118. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/scenarios/weight-dequant-prologue-fusion/weight-quant-tiling-contract.md +83 -0
  119. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/troubleshooting/compile-troubleshooting.md +231 -0
  120. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/troubleshooting/optimized-runtime-hang.md +102 -0
  121. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/workflow/step1-project-setup.md +170 -0
  122. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/workflow/step2-blaze-investigation.md +192 -0
  123. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/workflow/step3-kernel-design.md +246 -0
  124. package/assets/ops-direct-invoke/skills/ascendc-blaze-best-practice/references/workflow/step4-operator-development.md +166 -0
  125. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/SKILL.md +67 -0
  126. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/evals/evals.json +123 -0
  127. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/references/crash_workflow.md +193 -0
  128. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/references/memcheck/README.md +137 -0
  129. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/references/memcheck/automated_workflow.md +418 -0
  130. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/references/memcheck/mssanitizer_guide.md +181 -0
  131. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/scripts/memcheck_input.json.template +44 -0
  132. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/scripts/parse_plog.py +191 -0
  133. package/assets/ops-direct-invoke/skills/ascendc-crash-debug/scripts/run_memcheck_pre.sh +696 -0
  134. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/SKILL.md +105 -0
  135. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/evals/evals.json +128 -0
  136. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/CMakeLists.txt +131 -0
  137. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/README.md +55 -0
  138. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_extension/add_custom_torch.cpp +82 -0
  139. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_extension/ops.h +23 -0
  140. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_extension/register.cpp +42 -0
  141. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_host/add_custom.asc +149 -0
  142. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_host/data_utils.h +98 -0
  143. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_kernel/add_custom_kernel.asc +136 -0
  144. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/op_kernel/add_custom_tiling.h +31 -0
  145. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/run.sh +86 -0
  146. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/scripts/gen_data.py +49 -0
  147. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/scripts/golden.py +36 -0
  148. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/scripts/test_torch.py +90 -0
  149. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/add_custom/scripts/verify_result.py +54 -0
  150. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kernel_launch_details.md +116 -0
  151. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/CMakeLists.txt +19 -0
  152. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/README.md +214 -0
  153. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/UPSTREAM.md +35 -0
  154. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/add_custom.cpp +99 -0
  155. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/add_custom_tiling.h +25 -0
  156. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/cmake/Modules/CMakeCCECompiler.cmake.in +15 -0
  157. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/cmake/Modules/CMakeCCEInformation.cmake +51 -0
  158. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/cmake/Modules/CMakeDetermineCCECompiler.cmake +119 -0
  159. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/cmake/Modules/CMakeTestCCECompiler.cmake +11 -0
  160. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/cmake/npu/CMakeLists.txt +36 -0
  161. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/data_utils.h +132 -0
  162. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/ext_lib/.gitattributes +1 -0
  163. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/input/.keep +0 -0
  164. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/main.cpp +108 -0
  165. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/output/.keep +0 -0
  166. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/run.sh +141 -0
  167. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/scripts/acl.json +1 -0
  168. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/scripts/gen_data.py +26 -0
  169. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_add_template/scripts/verify_result.py +54 -0
  170. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/kirin_vector_guide.md +172 -0
  171. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_guide.md +348 -0
  172. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/CMakeLists.txt +157 -0
  173. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/common/acl_utils.h +70 -0
  174. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/common/common_utils.h +84 -0
  175. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/common/io_utils.h +163 -0
  176. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_extension/matmul_blaze_torch.cpp +55 -0
  177. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_extension/ops.h +22 -0
  178. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_extension/register.cpp +22 -0
  179. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_kernel/include/blaze_custom/.gitkeep +0 -0
  180. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_kernel/matmul_blaze_kernel.cpp +33 -0
  181. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_kernel/matmul_blaze_kernel.h +99 -0
  182. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_tiling/matmul_constant.h +31 -0
  183. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_tiling/matmul_tiling_data.h +45 -0
  184. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/op_tiling/matmul_tiling_stub.h +77 -0
  185. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/run.sh +94 -0
  186. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/scripts/gen_data_mxfp4.py +152 -0
  187. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/scripts/gen_data_mxfp8.py +114 -0
  188. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/scripts/verify_result.py +132 -0
  189. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/test_matmul_blaze.cpp +145 -0
  190. package/assets/ops-direct-invoke/skills/ascendc-direct-invoke-template/references/matmul_blaze_template/test_matmul_blaze_torch.py +141 -0
  191. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/SKILL.md +56 -0
  192. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/evals/evals.json +191 -0
  193. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/references/aclnn-api-doc-template.md +368 -0
  194. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/references/detailed-design-template.md +388 -0
  195. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/references/iteration-plan-template.md +45 -0
  196. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/references/operator-readme-template.md +234 -0
  197. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/references/operator-readme-template_bak.md +165 -0
  198. package/assets/ops-direct-invoke/skills/ascendc-docs-gen/references/requirement-analysis-template.md +131 -0
  199. package/assets/ops-direct-invoke/skills/ascendc-docs-search/SKILL.md +163 -0
  200. package/assets/ops-direct-invoke/skills/ascendc-docs-search/evals/evals.json +197 -0
  201. package/assets/ops-direct-invoke/skills/ascendc-docs-search/references/api-index.md +207 -0
  202. package/assets/ops-direct-invoke/skills/ascendc-docs-search/references/compatibility.md +141 -0
  203. package/assets/ops-direct-invoke/skills/ascendc-docs-search/references/example-catalog.md +197 -0
  204. package/assets/ops-direct-invoke/skills/ascendc-docs-search/requirements.txt +2 -0
  205. package/assets/ops-direct-invoke/skills/ascendc-docs-search/scripts/__init__.py +6 -0
  206. package/assets/ops-direct-invoke/skills/ascendc-docs-search/scripts/ascend_content_fetcher.py +479 -0
  207. package/assets/ops-direct-invoke/skills/ascendc-docs-search/scripts/ascend_search_client.py +201 -0
  208. package/assets/ops-direct-invoke/skills/ascendc-docs-search/scripts/ascend_search_skill.py +163 -0
  209. package/assets/ops-direct-invoke/skills/ascendc-docs-search/scripts/clean_markdown.py +489 -0
  210. package/assets/ops-direct-invoke/skills/ascendc-docs-search/scripts/find_api_doc.sh +54 -0
  211. package/assets/ops-direct-invoke/skills/ascendc-env-check/SKILL.md +123 -0
  212. package/assets/ops-direct-invoke/skills/ascendc-env-check/evals/evals.json +211 -0
  213. package/assets/ops-direct-invoke/skills/ascendc-env-check/references/asys_commands.md +64 -0
  214. package/assets/ops-direct-invoke/skills/ascendc-env-check/references/env_config_guide.md +96 -0
  215. package/assets/ops-direct-invoke/skills/ascendc-env-check/references/kirin_platform_guide.md +11 -0
  216. package/assets/ops-direct-invoke/skills/ascendc-env-check/references/npu_commands.md +114 -0
  217. package/assets/ops-direct-invoke/skills/ascendc-env-check/references/troubleshooting.md +177 -0
  218. package/assets/ops-direct-invoke/skills/ascendc-env-check/scripts/_npu_info.py +763 -0
  219. package/assets/ops-direct-invoke/skills/ascendc-env-check/scripts/check_env.sh +320 -0
  220. package/assets/ops-direct-invoke/skills/ascendc-env-check/scripts/get_npu_arch.py +488 -0
  221. package/assets/ops-direct-invoke/skills/ascendc-env-check/scripts/npu_info.sh +228 -0
  222. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/SKILL.md +370 -0
  223. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/docs/CONTEXT.md +85 -0
  224. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/docs/MC2-CAPABILITY-PLAN.md +111 -0
  225. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/docs/adr/0001-mc2-skill-not-plugin.md +31 -0
  226. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/docs/adr/0002-decision-stack-path-registry.md +33 -0
  227. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/evals/evals.json +315 -0
  228. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/capability-declaration.md +97 -0
  229. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/codebase-analysis.md +34 -0
  230. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/fundamentals/architecture.md +444 -0
  231. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/fundamentals/communication.md +669 -0
  232. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/fundamentals/compute.md +587 -0
  233. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/fundamentals/fusion.md +550 -0
  234. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/design-template.md +313 -0
  235. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/dev-methodology.md +111 -0
  236. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/development-guide.md +445 -0
  237. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/host-and-testing.md +285 -0
  238. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/operator-anatomy.md +739 -0
  239. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/paradigm-mapping.md +93 -0
  240. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/operator-design/plan-template.md +235 -0
  241. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/review-checklist.md +96 -0
  242. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/compute-first-reduce-scatter/design.md +107 -0
  243. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/compute-first-reduce-scatter/development.md +272 -0
  244. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/get-all-gather-quant-matmul/design.md +93 -0
  245. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/get-all-gather-quant-matmul/development.md +70 -0
  246. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/index.md +47 -0
  247. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/put-all-gather-quant-matmul/design.md +83 -0
  248. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/put-all-gather-quant-matmul/development.md +62 -0
  249. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/put-all-to-all-quant-matmul/design.md +106 -0
  250. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/scenarios/put-all-to-all-quant-matmul/development.md +74 -0
  251. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/troubleshooting/failure-navigation.md +47 -0
  252. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/troubleshooting/optimization-playbook.md +143 -0
  253. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/workflow/step1-project-setup.md +52 -0
  254. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/workflow/step2-investigation.md +89 -0
  255. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/workflow/step3-design.md +69 -0
  256. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/workflow/step4-implementation.md +29 -0
  257. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/apace/workflow_integration.md +122 -0
  258. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/api-rules/dispatch-combine-contracts.md +60 -0
  259. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/api-rules/index.md +71 -0
  260. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/api-rules/mte-address-access.md +374 -0
  261. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/api-rules/sync-and-visibility.md +105 -0
  262. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/reading/combine-reading-guide.md +102 -0
  263. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/reading/common-reading-method.md +226 -0
  264. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/reading/design-overview.md +558 -0
  265. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/reading/dispatch-reading-guide.md +81 -0
  266. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/reading/kernel-execution-units.md +189 -0
  267. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/reading/mega-moe-reading-guide.md +123 -0
  268. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/build-framework.md +177 -0
  269. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/change-routing.md +18 -0
  270. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/combine-dataflow.md +144 -0
  271. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/dispatch-dataflow.md +128 -0
  272. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/index.md +98 -0
  273. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/CMakeLists.txt +51 -0
  274. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/README.md +131 -0
  275. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/build.sh +56 -0
  276. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/include/moe_dispatch_base_compat.h +113 -0
  277. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/include/tiling_data.h +100 -0
  278. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/include/utils.h +57 -0
  279. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/kernel/moe_dispatch.h +524 -0
  280. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/kernel/mte_dispatch_comm.h +324 -0
  281. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/moe_dispatch.cpp +67 -0
  282. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/run.sh +61 -0
  283. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/run_multi_data_test.sh +80 -0
  284. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/scripts/verify_dispatch.py +248 -0
  285. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/moe_dispatch_direct_invoke_sample/test/test_moe_dispatch.cpp +679 -0
  286. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/sample-helper-map.md +47 -0
  287. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/samples/spec-template.md +78 -0
  288. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/tiling-scheme/double-buffer-protocol.md +69 -0
  289. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/tiling-scheme/index.md +111 -0
  290. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/tiling-scheme/multi-core-formulas.md +126 -0
  291. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/tiling-scheme/split-core-design.md +100 -0
  292. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/ascendc-api/moe-dispatch-combine/tiling-scheme/window-memory-layout.md +199 -0
  293. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/CMakeLists.txt +95 -0
  294. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/cmake/ascend.cmake +59 -0
  295. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/cmake/shmem.cmake +75 -0
  296. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/cmake/tensor_api.cmake +48 -0
  297. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/common/host_utils/acl_utils.h +73 -0
  298. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/common/host_utils/common_utils.h +181 -0
  299. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/common/host_utils/io_utils.h +175 -0
  300. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/common/kernel_utils/common_utils.h +99 -0
  301. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/common/kernel_utils/integral_constant.h +36 -0
  302. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/common/kernel_utils/tuple_utils.h +34 -0
  303. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/block/block_mmad.h +27 -0
  304. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/block/block_scheduler_policy.h +35 -0
  305. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/block/block_scheduler_utils.h +27 -0
  306. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/block/quant_matmul_mx_block_mmad_swat.h +392 -0
  307. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/block/quant_matmul_mx_block_scheduler_swat.h +290 -0
  308. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/kernel/all_to_all_comm_udma.h +255 -0
  309. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/kernel/all_to_all_matmul_impl.h +370 -0
  310. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/kernel/heavy_kernels.h +128 -0
  311. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/kernel/qbmm_mx_kernel.h +395 -0
  312. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/policy/dispatch_policy.h +47 -0
  313. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tile/copy_scale_l1_to_l0a.h +61 -0
  314. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tile/copy_scale_l1_to_l0b.h +54 -0
  315. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tile/pad_mx_kl1.h +138 -0
  316. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tile/tile_mmad_mx.h +34 -0
  317. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tiling/all_to_all_matmul_tiling_data.h +29 -0
  318. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tiling/quant_matmul_mx_tiling_swat.h +410 -0
  319. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tiling/quant_matmul_tiling_base.h +116 -0
  320. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tiling/quant_matmul_tiling_common.h +101 -0
  321. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/tiling/quant_matmul_tiling_data.h +61 -0
  322. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/include/utils/constant.h +106 -0
  323. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/run.sh +65 -0
  324. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/scripts/extract_perf.py +57 -0
  325. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/scripts/gen_data.py +139 -0
  326. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/scripts/verify_result.py +152 -0
  327. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/src/all_to_all_matmul.cpp +396 -0
  328. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/all_to_all_matmul/src/utils.h +168 -0
  329. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/codebase_map.md +342 -0
  330. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/comm_shmem.md +280 -0
  331. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/matmul_blaze.md +259 -0
  332. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/mc2_architecture.md +199 -0
  333. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/review-checklist.md +29 -0
  334. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/blaze-shmem/workflow_integration.md +215 -0
  335. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/CMakeLists.txt +559 -0
  336. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/build.sh +319 -0
  337. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/config.cmake +232 -0
  338. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/func.cmake +478 -0
  339. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/intf.cmake +4 -0
  340. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/intf_pub.cmake +67 -0
  341. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/modules/Findalog.cmake +105 -0
  342. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/scripts/check_version_compatible.py +94 -0
  343. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/cmake/scripts/prepare.sh +129 -0
  344. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/golden.py +27 -0
  345. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/run_test.sh +33 -0
  346. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/single_server_check_result.py +71 -0
  347. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/single_server_config.ini +17 -0
  348. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/single_server_gen_data.py +91 -0
  349. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/single_server_run.py +116 -0
  350. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/examples/test_golden_cpu.py +63 -0
  351. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/CMakeLists.txt +202 -0
  352. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/mc2_common_infershape.cpp +163 -0
  353. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/mc2_common_infershape.h +49 -0
  354. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/formulaic_tiling_datatype.h +161 -0
  355. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/hccl_formulaic_tiling.cpp +373 -0
  356. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/hccl_formulaic_tiling.h +150 -0
  357. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/hccl_performance.cpp +206 -0
  358. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/hccl_performance.h +118 -0
  359. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/hcom_topo_info.h +81 -0
  360. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/matmul_formulaic_tiling.cpp +338 -0
  361. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/matmul_formulaic_tiling.h +340 -0
  362. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/matmul_performance.cpp +272 -0
  363. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/matmul_performance.h +152 -0
  364. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/mc2_tiling_struct.h +46 -0
  365. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/mc2_tiling_utils.cpp +296 -0
  366. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_host/op_tiling/mc2_tiling_utils.h +269 -0
  367. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_kernel/mc2_matmul_block.h +235 -0
  368. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_kernel/mc2_matmul_block_l2cache.h +165 -0
  369. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_kernel/mc2_matmul_compute.h +218 -0
  370. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_kernel/mc2_nd_to_nz.h +579 -0
  371. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/op_kernel/mc2_tiling_struct.h +164 -0
  372. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/utils/mc2_hcom_topo_info.cpp +390 -0
  373. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/utils/mc2_hcom_topo_info.h +81 -0
  374. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/mc2_common/utils/ops_utils.h +77 -0
  375. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_api/aclnn_x_all_gather_matmul.cpp +65 -0
  376. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_api/aclnn_x_all_gather_matmul.h +57 -0
  377. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/arch22/x_all_gather_formulaic_tiling_a2a3.cpp +50 -0
  378. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/arch22/x_all_gather_formulaic_tiling_a2a3.h +47 -0
  379. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/arch22/x_all_gather_matmul_tiling_a2a3.cpp +72 -0
  380. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/arch22/x_all_gather_matmul_tiling_a2a3.h +31 -0
  381. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/x_all_gather_formulaic_tiling.cpp +82 -0
  382. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/x_all_gather_formulaic_tiling.h +55 -0
  383. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/x_all_gather_matmul_tiling_base.cpp +508 -0
  384. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/op_tiling/x_all_gather_matmul_tiling_base.h +54 -0
  385. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/x_all_gather_matmul_def.cpp +79 -0
  386. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_host/x_all_gather_matmul_proto.cpp +39 -0
  387. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_kernel/x_all_gather_matmul.cpp +96 -0
  388. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_kernel/x_all_gather_matmul_base.h +152 -0
  389. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_kernel/x_all_gather_matmul_full_mesh.h +230 -0
  390. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_kernel/x_all_gather_matmul_tiling.h +45 -0
  391. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/all_gather_matmul/x_all_gather_matmul/op_kernel/x_all_gather_matmul_tiling_key.h +47 -0
  392. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/codebase_map.md +281 -0
  393. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/comm_hccl.md +201 -0
  394. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/matmul_fusion.md +50 -0
  395. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/mc2_architecture.md +142 -0
  396. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/op_architecture.md +167 -0
  397. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/pipeline_tuning.md +47 -0
  398. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/review-checklist.md +39 -0
  399. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/foundations/hccl-matmul/workflow_integration.md +152 -0
  400. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/operators/collective-comm.md +145 -0
  401. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/requirement-analysis/classification.md +27 -0
  402. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/requirement-analysis/comm-path-decision.md +51 -0
  403. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/requirement-analysis/grill-protocol.md +202 -0
  404. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/requirement-analysis/quality-checklist.md +57 -0
  405. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/requirement-analysis/template.md +208 -0
  406. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/shared/pipeline_tuning.md +232 -0
  407. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/references/shared/profiling_mc2.md +278 -0
  408. package/assets/ops-direct-invoke/skills/ascendc-mc2-best-practice/scripts/fetch_apace.sh +96 -0
  409. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/SKILL.md +121 -0
  410. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/evals/evals.json +138 -0
  411. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/advanced_tiling.md +92 -0
  412. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/broadcast_design.md +160 -0
  413. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/code/broadcast_add_kernel.cpp +118 -0
  414. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/code/broadcast_add_tiling.cpp +126 -0
  415. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/code/broadcast_common.h +344 -0
  416. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/code/onedim_add_kernel.cpp +97 -0
  417. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/code/onedim_add_tiling.cpp +57 -0
  418. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/datacopypad_design.md +46 -0
  419. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/nddma_design.md +53 -0
  420. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/onedim_design.md +114 -0
  421. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/broadcast/ub_broadcast_design.md +67 -0
  422. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/common/core_shrink_design.md +126 -0
  423. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/common/datacopy_optimization_design.md +351 -0
  424. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/common/tail_block_design.md +268 -0
  425. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/common/ub_resident_design.md +342 -0
  426. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/guide.md +69 -0
  427. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_base.template +81 -0
  428. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_big_dim.template +217 -0
  429. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_cut_one_axis.template +336 -0
  430. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_cut_two_axis.template +781 -0
  431. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_n_last.template +340 -0
  432. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_small_shape.template +321 -0
  433. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_tensor_move.template +102 -0
  434. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_transdata_5hd.template +480 -0
  435. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_transdata_5hd_021axis.template +533 -0
  436. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/dav3510/transpose_with_gather.template +688 -0
  437. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/templates/transpose_tiling_data.template +192 -0
  438. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_big_dim.md +220 -0
  439. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_cut_one_axis.md +175 -0
  440. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_cut_two_axis.md +177 -0
  441. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_fusion_design.md +398 -0
  442. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_gather.md +191 -0
  443. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_n_last.md +276 -0
  444. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_small_shape.md +315 -0
  445. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_tensor_move.md +203 -0
  446. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_tiling_data.md +176 -0
  447. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_vconv_021.md +206 -0
  448. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/conversion/transpose_vconv_5hd.md +179 -0
  449. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/elementwise/double_buffer_design.md +288 -0
  450. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/elementwise/vector_efficiency_design.md +203 -0
  451. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/constant_folding_design.md +466 -0
  452. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/fullload_design.md +344 -0
  453. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/guide.md +16 -0
  454. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/mte2_preload_design.md +320 -0
  455. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/pingpong_design.md +254 -0
  456. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/scale_coalescing_design.md +282 -0
  457. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/small_m_wide_n_pipeline_design.md +137 -0
  458. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/streamk_design.md +374 -0
  459. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/matmul/swat_design.md +423 -0
  460. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/mc2/guide.md +45 -0
  461. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/mc2/local_matmul_design.md +130 -0
  462. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/mc2/pipeline_balancing_design.md +502 -0
  463. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/guide.md +178 -0
  464. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/kernel_utils.template +75 -0
  465. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_ar_full_load.template +429 -0
  466. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_ar_recompute.template +485 -0
  467. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_ar_small_r.template +348 -0
  468. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_ara_full_load.template +574 -0
  469. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_ara_online.template +324 -0
  470. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_ara_recompute.template +436 -0
  471. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/dav310/softmax_v2_base.template +950 -0
  472. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/fused_attention_online_softmax_design.md +428 -0
  473. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_ar_full_load.md +137 -0
  474. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_ar_recompute.md +135 -0
  475. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_ar_small_r.md +122 -0
  476. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_ara_full_load.md +144 -0
  477. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_ara_online.md +185 -0
  478. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_ara_recompute.md +163 -0
  479. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_tiling.template +460 -0
  480. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/softmax_v2_tiling_data.template +278 -0
  481. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/state_resident_design.md +337 -0
  482. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/reduce/templates/usage_guide.md +253 -0
  483. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/scalar/coding_principles.md +476 -0
  484. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/scalar/conv_scalar.md +165 -0
  485. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/scalar/guide.md +31 -0
  486. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/simt/optimization-guide.md +110 -0
  487. package/assets/ops-direct-invoke/skills/ascendc-performance-best-practices/references/sort/radix_sort.md +354 -0
  488. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/SKILL.md +361 -0
  489. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/evals/evals.json +161 -0
  490. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/ascendc-dumptensor-refs/api-reference.md +92 -0
  491. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/ascendc-dumptensor-refs/error-patterns.md +40 -0
  492. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/ascendc-dumptensor.md +205 -0
  493. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/best-practices.md +317 -0
  494. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/binary-search-debug.md +275 -0
  495. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/case-studies.md +459 -0
  496. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/common-traps.md +492 -0
  497. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/data-comparison.md +308 -0
  498. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/debug-summary-template.md +198 -0
  499. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/diagnosis-workflow.md +180 -0
  500. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/printf-debug.md +296 -0
  501. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/simt-precision-debug.md +76 -0
  502. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/references/tools-reference.md +364 -0
  503. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/scripts/error_analysis.py +148 -0
  504. package/assets/ops-direct-invoke/skills/ascendc-precision-debug/scripts/gen_boundary_test.py +169 -0
  505. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/SKILL.md +47 -0
  506. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/evals/evals.json +115 -0
  507. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/arithmetic_and_reduce.md +228 -0
  508. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/compute_api_membase_vs_regbase.md +107 -0
  509. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/datacopy_best_practices.md +139 -0
  510. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/index.md +38 -0
  511. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/pipeline_and_buffer.md +105 -0
  512. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/regbase_api_reference.md +303 -0
  513. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/regbase_api_sync.md +173 -0
  514. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/api/regbase_api_whitelist.md +142 -0
  515. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/dev-experience/index.md +24 -0
  516. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/dev-experience/regbase_build_notes.md +49 -0
  517. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/dev-experience/regbase_performance_practices.md +52 -0
  518. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/dev-experience/regbase_programming_notes.md +120 -0
  519. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/dev-experience/tiling_review_notes.md +86 -0
  520. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/dev-experience/working_vs_failed_dav_3510_cases.md +49 -0
  521. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/README.md +190 -0
  522. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_host/adam_apply_one_assign_def.cpp +102 -0
  523. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_host/arch35/adam_apply_one_assign_tiling_arch35.cpp +597 -0
  524. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_host/arch35/adam_apply_one_assign_tiling_arch35.h +82 -0
  525. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_kernel/adam_apply_one_assign.cpp +44 -0
  526. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_kernel/arch35/adam_apply_one_assign_kernel.h +361 -0
  527. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_kernel/arch35/adam_apply_one_assign_struct.h +27 -0
  528. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-code/op_kernel/arch35/adam_apply_one_assign_tiling_struct.h +53 -0
  529. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-design/adam_apply_one_assign_analysis.md +143 -0
  530. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/examples-adam-design/adam_apply_one_assign_design.md +2865 -0
  531. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/CMakeLists.txt +328 -0
  532. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/README.md +163 -0
  533. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_graph/xdivy_graph_infer.cpp +38 -0
  534. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_graph/xdivy_proto.h +42 -0
  535. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_host/arch35/xdivy_tiling_arch35.cpp +601 -0
  536. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_host/arch35/xdivy_tiling_arch35.h +89 -0
  537. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_host/xdivy_def.cpp +60 -0
  538. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_host/xdivy_infershape.cpp +58 -0
  539. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_kernel/arch35/xdivy_kernel.h +331 -0
  540. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_kernel/arch35/xdivy_struct.h +28 -0
  541. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_kernel/arch35/xdivy_tiling_struct.h +57 -0
  542. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/op_kernel/xdivy.cpp +42 -0
  543. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/aclnn/CMakeLists.txt +67 -0
  544. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/aclnn/run.sh +56 -0
  545. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/aclnn/test_aclnn.cpp +354 -0
  546. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/geir/CMakeLists.txt +69 -0
  547. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/geir/run.sh +58 -0
  548. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/geir/test_geir.cpp +407 -0
  549. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/tiling/CMakeLists.txt +185 -0
  550. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/tiling/run.sh +61 -0
  551. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/example/xdivy_custom_package/tests/tiling/test_tiling.cpp +386 -0
  552. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/patterns.md +324 -0
  553. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-kernel-entrance.md +95 -0
  554. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-overview.md +252 -0
  555. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-standard/broadcast-standard-compute-flow.md +214 -0
  556. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-standard/broadcast-standard-dag-buffers.md +285 -0
  557. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-standard/broadcast-standard-kernel-helpers.md +209 -0
  558. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-standard/broadcast-standard-kernel-template.md +611 -0
  559. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-standard/broadcast-standard-tiling-preprocess.md +545 -0
  560. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/broadcast/references/broadcast-template-standard/broadcast-standard-tiling.md +471 -0
  561. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/broadcast-rules.md +126 -0
  562. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/cast-rules.md +414 -0
  563. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/datacopypad-rules.md +185 -0
  564. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/nddma-rules.md +255 -0
  565. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/sync-and-consistency.md +314 -0
  566. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/value-depend-process.md +40 -0
  567. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/common/vf-programming-rules.md +150 -0
  568. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/dynamic_shape/knowledge.md +382 -0
  569. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/dynamic_shape/patterns.md +260 -0
  570. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/elewise/patterns.md +46 -0
  571. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/elewise/tiling.md +215 -0
  572. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/example-routes.yaml +17 -0
  573. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/general-methodology.md +94 -0
  574. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/mask_predicate/patterns.md +99 -0
  575. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/numerical_stable/knowledge.md +233 -0
  576. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/numerical_stable/patterns.md +390 -0
  577. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/CMakeLists.txt +289 -0
  578. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/README.md +148 -0
  579. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_graph/euclidean_norm_graph_infer.cpp +39 -0
  580. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_graph/euclidean_norm_proto.h +54 -0
  581. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_host/arch35/euclidean_norm_tiling_arch35.cpp +1040 -0
  582. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_host/arch35/euclidean_norm_tiling_arch35.h +28 -0
  583. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_host/euclidean_norm_def.cpp +86 -0
  584. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_host/euclidean_norm_infershape.cpp +205 -0
  585. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm.cpp +46 -0
  586. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_base.h +965 -0
  587. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_empty.h +153 -0
  588. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_group.h +396 -0
  589. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_tiling_data.h +74 -0
  590. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_tiling_key.h +32 -0
  591. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/aclnn/CMakeLists.txt +59 -0
  592. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/aclnn/run.sh +36 -0
  593. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/aclnn/test_aclnn.cpp +227 -0
  594. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/geir/CMakeLists.txt +84 -0
  595. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/geir/run.sh +48 -0
  596. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/geir/test_geir.cpp +297 -0
  597. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/tiling/CMakeLists.txt +143 -0
  598. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/tiling/run.sh +40 -0
  599. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/example/euclidean_norm_package/tests/tiling/test_tiling.cpp +318 -0
  600. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/patterns.md +527 -0
  601. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-binary-sum.md +260 -0
  602. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-highlevel-api.md +146 -0
  603. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-kernel-entrance.md +96 -0
  604. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-survival-node.md +74 -0
  605. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-binary-base/reduction-binary-base-dag-buffers.md +612 -0
  606. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-binary-base/reduction-binary-base-kernel-template.md +1261 -0
  607. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-binary-base/reduction-binary-base-tiling.md +531 -0
  608. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-binary-group/reduction-binary-group-dag-buffers.md +209 -0
  609. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-binary-group/reduction-binary-group-kernel-template.md +588 -0
  610. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-binary-group/reduction-binary-group-tiling.md +203 -0
  611. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-empty/reduction-empty-dag-buffers.md +292 -0
  612. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-empty/reduction-empty-kernel-template.md +360 -0
  613. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-empty/reduction-empty-tiling.md +234 -0
  614. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-template-overview.md +238 -0
  615. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-tiling-preprocess.md +218 -0
  616. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-tuple-reduce.md +72 -0
  617. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/references/reduction-vf-fusion-rules.md +95 -0
  618. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/reduction/validate_gates.py +194 -0
  619. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/resolve_example.py +106 -0
  620. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/routes.yaml +39 -0
  621. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/stateful/patterns.md +146 -0
  622. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/variable_output/knowledge.md +366 -0
  623. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/paradigms/variable_output/patterns.md +203 -0
  624. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/api_misuse.md +50 -0
  625. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/common_traps.md +67 -0
  626. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/index.md +25 -0
  627. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/precision_failures.md +51 -0
  628. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/precision_guide.md +85 -0
  629. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/regbase_vs_membase_confusions.md +52 -0
  630. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/pitfalls/symptom_to_cause.md +38 -0
  631. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/reference-ops/open_source_operator_table.md +740 -0
  632. package/assets/ops-direct-invoke/skills/ascendc-regbase-best-practice/references/regbase_development_guide.md +334 -0
  633. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/SKILL.md +107 -0
  634. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/evals/evals.json +44 -0
  635. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/compute-operators.md +34 -0
  636. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/data-transfer.md +51 -0
  637. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/debug-api.md +530 -0
  638. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/index-calculation.md +49 -0
  639. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/intra-core-shared.md +70 -0
  640. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/macro-api.md +65 -0
  641. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/multi-core-sync.md +39 -0
  642. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/overview.md +128 -0
  643. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/tensorlist-handling.md +92 -0
  644. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/thread-stride-pattern.md +49 -0
  645. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/vf-call.md +51 -0
  646. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references/vf-declaration.md +39 -0
  647. package/assets/ops-direct-invoke/skills/ascendc-simt-best-practices/references//347/274/226/350/257/221/344/270/216/350/277/220/350/241/214.md +158 -0
  648. package/assets/ops-direct-invoke/skills/ascendc-simt-tiling-design/SKILL.md +42 -0
  649. package/assets/ops-direct-invoke/skills/ascendc-simt-tiling-design/evals/evals.json +44 -0
  650. package/assets/ops-direct-invoke/skills/ascendc-simt-tiling-design/references/guide.md +73 -0
  651. package/assets/ops-direct-invoke/skills/ascendc-st-design/SKILL.md +316 -0
  652. package/assets/ops-direct-invoke/skills/ascendc-st-design/evals/evals.json +44 -0
  653. package/assets/ops-direct-invoke/skills/ascendc-st-design/references/constraint-examples.md +392 -0
  654. package/assets/ops-direct-invoke/skills/ascendc-st-design/references/dependency-yaml-spec.md +625 -0
  655. package/assets/ops-direct-invoke/skills/ascendc-st-design/references/empty-tensor-guide.md +236 -0
  656. package/assets/ops-direct-invoke/skills/ascendc-st-design/references/parameter-definition.md +491 -0
  657. package/assets/ops-direct-invoke/skills/ascendc-st-design/references/standards.md +11 -0
  658. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/generate_empty_tensor_cases_derive.py +815 -0
  659. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/generate_factor_values.py +1287 -0
  660. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/generate_implicit_constraints.py +511 -0
  661. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/generate_solver_config.py +618 -0
  662. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/generate_test_cases.py +2800 -0
  663. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/generate_test_factors.py +762 -0
  664. package/assets/ops-direct-invoke/skills/ascendc-st-design/scripts/utils.py +1931 -0
  665. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/SKILL.md +91 -0
  666. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/evals/evals.json +72 -0
  667. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/broadcast/dynamic-ub-broadcast.md +87 -0
  668. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/broadcast/nddma-broadcast.md +199 -0
  669. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/broadcast/onedim.md +152 -0
  670. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/broadcast/patterns.md +165 -0
  671. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/broadcast/ub-broadcast.md +331 -0
  672. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/conversion/patterns.md +261 -0
  673. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/elewise/patterns.md +46 -0
  674. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/elewise/tiling.md +215 -0
  675. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/design/_governance.md +132 -0
  676. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/design/execution.md +469 -0
  677. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/design/resources.md +339 -0
  678. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/design/shape.md +271 -0
  679. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/foundation/composition.md +138 -0
  680. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/foundation/extension_points.md +173 -0
  681. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/foundation/fundamentals.md +245 -0
  682. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/foundation/roofline.md +227 -0
  683. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/implementation_ref.md +201 -0
  684. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/patterns.md +239 -0
  685. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/specialization/feature_flags.md +216 -0
  686. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/specialization/sparse_design.md +198 -0
  687. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/subfamilies/base_design.md +395 -0
  688. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/flashattention/subfamilies/quantization_design.md +233 -0
  689. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/index/gather.md +273 -0
  690. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/index/index_add.md +434 -0
  691. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/index/index_select.md +185 -0
  692. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/index/patterns.md +199 -0
  693. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/index/repeat_interleave.md +251 -0
  694. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/index/scatter.md +341 -0
  695. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/matmul/ascendc-api-gmm-tiling.md +313 -0
  696. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/matmul/ascendc-api-matmul-tiling.md +408 -0
  697. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/matmul/patterns.md +32 -0
  698. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/alg-dichotomy.md +56 -0
  699. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/alg-group-reduce.md +101 -0
  700. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/alg-welford.md +74 -0
  701. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/algorithms.md +35 -0
  702. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/ar-colsplit.md +149 -0
  703. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/ar-fullload.md +151 -0
  704. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/ara-fullload.md +228 -0
  705. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/ara-rowsplit.md +219 -0
  706. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/multi-axis-transform.md +83 -0
  707. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/multi-output-buffer.md +115 -0
  708. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/patterns.md +212 -0
  709. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/tiling-fields.md +94 -0
  710. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/reduction/with-index.md +247 -0
  711. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/scatter/patterns.md +827 -0
  712. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/sort/alg-two-level-mrgsort.md +681 -0
  713. package/assets/ops-direct-invoke/skills/ascendc-tiling-design/references/sort/patterns.md +249 -0
  714. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/SKILL.md +109 -0
  715. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/coverage_files_question.json +24 -0
  716. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_cmake.txt +46 -0
  717. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_inferdtype.cpp +139 -0
  718. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_inferdtype.csv +5 -0
  719. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_infershape.cpp +122 -0
  720. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_infershape.csv +5 -0
  721. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_param.h +319 -0
  722. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_tiling.cpp +154 -0
  723. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/csv-refactor/template_tiling.csv +5 -0
  724. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/question.json +100 -0
  725. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/template_report.md +112 -0
  726. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/assets/todo.json +24 -0
  727. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/evals/evals.json +198 -0
  728. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/coverage-guide/coverage-extraction.md +78 -0
  729. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/coverage-guide/test-implementation.md +136 -0
  730. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/custom/custom.md +5 -0
  731. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ops-transformer/csv-format-spec.md +263 -0
  732. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ops-transformer/csv-refactor-workflow.md +494 -0
  733. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ops-transformer/legacy-code-extraction.md +325 -0
  734. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ops-transformer/ops-transformer.md +75 -0
  735. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ut-guide/build_ut.md +65 -0
  736. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ut-guide/op-api-ut-guide.md +237 -0
  737. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ut-guide/op-host-ut-guide.md +240 -0
  738. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/ut-guide/op-kernel-ut-guide.md +198 -0
  739. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/workflow/step1.md +43 -0
  740. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/workflow/step2.md +26 -0
  741. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/workflow/step3.md +51 -0
  742. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/workflow/step4.md +130 -0
  743. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/references/workflow/step5.md +5 -0
  744. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/scripts/extract_dtype_combinations.py +200 -0
  745. package/assets/ops-direct-invoke/skills/ascendc-ut-develop/scripts/generate_csv_template.py +270 -0
  746. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/SKILL.md +125 -0
  747. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/evals/evals.json +198 -0
  748. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/S1-input-collection.md +125 -0
  749. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/case-mapper/00-execution-order.md +58 -0
  750. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/case-mapper/01-variable-semantics.md +250 -0
  751. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/case-mapper/02-generate-mapper.md +218 -0
  752. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/case-mapper/S5_case_json_schema.md +373 -0
  753. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/case-mapper/S5_mapped_case_schema.md +131 -0
  754. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/case-mapper/s5_case_mapper_template.py +411 -0
  755. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/design-verifier/00-execution-order.md +114 -0
  756. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/source-analysis/00-execution-order.md +291 -0
  757. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/source-analysis/01-code-analyzer.md +121 -0
  758. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/source-analysis/02-interface-analyzer.md +417 -0
  759. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/source-analysis/03-param-derivation.md +45 -0
  760. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/source-analysis/04-test-design-template.md +231 -0
  761. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/source-analysis/05-network-search.md +154 -0
  762. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-a/00-overview.md +66 -0
  763. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-a/01-step1-tiling.md +114 -0
  764. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-a/02-step2-trace.md +81 -0
  765. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-a/03-step3-kernel.md +51 -0
  766. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-a/04-path-config-schema.md +342 -0
  767. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-d/00-execution-order.md +26 -0
  768. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-d/01-step1-merge.md +54 -0
  769. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-d/02-step2-group.md +44 -0
  770. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-d/03-step3-derive.md +416 -0
  771. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-d/04-step4-output.md +122 -0
  772. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/task-d/05-step5-gen-cases.md +156 -0
  773. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/ttk-converter/00-execution-order.md +108 -0
  774. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/ttk-converter/01-csv-common.md +33 -0
  775. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/ttk-converter/02-kernel-fields.md +64 -0
  776. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/ttk-converter/03-kernel-mode.md +142 -0
  777. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/references/workflow.md +193 -0
  778. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/_scout_common.py +53 -0
  779. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/assemble_dim_spec.py +232 -0
  780. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/build_param_def.py +134 -0
  781. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/build_path_list.py +520 -0
  782. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/format_json.py +135 -0
  783. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/gen_cases_template.py +196 -0
  784. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/generate_test_design.py +555 -0
  785. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/normalize_op_name.py +157 -0
  786. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/pick_dims.py +173 -0
  787. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/run_ttk_kernel_module.py +750 -0
  788. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/s2p0_verify.py +302 -0
  789. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/s3_task_d_gate.py +365 -0
  790. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/s5_append_empty.py +180 -0
  791. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/s5_check_mapper_outputs.py +292 -0
  792. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/s5_expand_high.py +208 -0
  793. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/scout_k.py +723 -0
  794. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/scout_t.py +983 -0
  795. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/ttk_generate_kernel_csv.py +346 -0
  796. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/ttk_precheck_env.py +248 -0
  797. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/ttk_validate_csv.py +315 -0
  798. package/assets/ops-direct-invoke/skills/ascendc-whitebox-design/scripts/update_path_list.py +143 -0
  799. package/assets/ops-direct-invoke/skills/cann-env-setup/SKILL.md +177 -0
  800. package/assets/ops-direct-invoke/skills/cann-env-setup/evals/evals.json +144 -0
  801. package/assets/ops-direct-invoke/skills/cann-env-setup/references/env_dependence.md +77 -0
  802. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/SKILL.md +51 -0
  803. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/overall-implementation.md +226 -0
  804. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/aclnn-adaptation.md +34 -0
  805. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/aicpu-load-balance-metadata.md +116 -0
  806. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/channel-buffer.md +36 -0
  807. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/compilation-launch.md +144 -0
  808. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/host-validation.md +34 -0
  809. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/layout-tail.md +53 -0
  810. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/synchronization.md +80 -0
  811. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/torch-registration.md +66 -0
  812. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/vf.md +144 -0
  813. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/patterns/workspace.md +67 -0
  814. package/assets/ops-direct-invoke/skills/cannbot-dsl-best-practice/references/production-code.md +120 -0
  815. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/SKILL.md +25 -0
  816. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/core/methodology.md +104 -0
  817. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/references/readability-rules.md +280 -0
  818. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/steps/clause-review.md +59 -0
  819. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/steps/report-write.md +60 -0
  820. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/workflows/file-review.md +49 -0
  821. package/assets/ops-direct-invoke/skills/cannbot-dsl-code-reviewer/workflows/pr-review.md +58 -0
  822. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/SKILL.md +97 -0
  823. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/references/checks-and-troubleshooting.md +96 -0
  824. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/references/env-selected-soc-schema.md +43 -0
  825. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/references/environment-schema.md +112 -0
  826. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/scripts/check_env.sh +34 -0
  827. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/scripts/env_check.py +946 -0
  828. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/scripts/probe_compile_stage.py +99 -0
  829. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/scripts/probe_kernel.py +33 -0
  830. package/assets/ops-direct-invoke/skills/cannbot-dsl-env-check/tests/test_env_report.py +90 -0
  831. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/SKILL.md +60 -0
  832. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/references/pipeline-design.md +84 -0
  833. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/references/stage-cost-model.md +77 -0
  834. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/DESIGN-BRANCH.md.templ +119 -0
  835. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/INDEX.md.templ +34 -0
  836. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/API.md.templ +67 -0
  837. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/DevView.md.templ +67 -0
  838. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/HostLaunch.md.templ +119 -0
  839. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/InferShapeDtype.md.templ +56 -0
  840. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/Interface.md.templ +61 -0
  841. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/Kernel.md.templ +183 -0
  842. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/LaunchData.md.templ +126 -0
  843. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/Overview.md.templ +57 -0
  844. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/TemplatePartition.md.templ +69 -0
  845. package/assets/ops-direct-invoke/skills/cannbot-dsl-op-design/templates/design/Validation.md.templ +80 -0
  846. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/SKILL.md +64 -0
  847. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/assets/case_contract.py +269 -0
  848. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/assets/test.py +571 -0
  849. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/references/cases.md +29 -0
  850. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/references/evidence.md +67 -0
  851. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/references/golden.md +12 -0
  852. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/build_blackbox_cases.py +536 -0
  853. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/build_tdd_cases.py +498 -0
  854. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/build_whitebox_cases.py +183 -0
  855. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/casebook.py +71 -0
  856. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/generator_support.py +95 -0
  857. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/prepare_golden.py +390 -0
  858. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/scripts/recipe_validation.py +144 -0
  859. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/tests/test_evidence_chain.py +339 -0
  860. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/tests/test_skills.py +547 -0
  861. package/assets/ops-direct-invoke/skills/cannbot-dsl-test-generator/tests/test_synthesize_dtype.py +85 -0
  862. package/assets/ops-direct-invoke/skills/cannbot-dsl-unit-planner/SKILL.md +35 -0
  863. package/assets/ops-direct-invoke/skills/cannbot-dsl-unit-planner/references/decomposition-checks.md +46 -0
  864. package/assets/ops-direct-invoke/skills/cannbot-dsl-unit-planner/references/unit-format.md +77 -0
  865. package/assets/ops-direct-invoke/skills/npu-arch/SKILL.md +87 -0
  866. package/assets/ops-direct-invoke/skills/npu-arch/evals/evals.json +356 -0
  867. package/assets/ops-direct-invoke/skills/npu-arch/references/npu-arch-guide-triton.md +312 -0
  868. package/assets/ops-direct-invoke/skills/npu-arch/references/npu-arch-guide.md +454 -0
  869. package/assets/ops-direct-invoke/skills/npu-arch/references/npu-hardware-params.md +248 -0
  870. package/assets/ops-direct-invoke/skills/npu-arch/references/simt-arch-guide.md +303 -0
  871. package/assets/ops-direct-invoke/skills/ops-design-paradigms/SKILL.md +41 -0
  872. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/index.md +32 -0
  873. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/arithmetic_and_reduce.md +96 -0
  874. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/datacopy_best_practices.md +87 -0
  875. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/index.md +37 -0
  876. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/pipeline_and_buffer.md +87 -0
  877. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/precision_and_runtime.md +98 -0
  878. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/regbase_api_reference.md +88 -0
  879. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/regbase_api_sync.md +112 -0
  880. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/api/regbase_api_whitelist.md +121 -0
  881. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/complexity_and_route_selection.md +113 -0
  882. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/index.md +55 -0
  883. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/process_memory_cards.md +54 -0
  884. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/regbase_build_notes.md +87 -0
  885. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/regbase_kernel_case_notes.md +103 -0
  886. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/regbase_performance_practices.md +92 -0
  887. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/regbase_programming_notes.md +108 -0
  888. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/requirements_analysis_patterns.md +97 -0
  889. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/small_channel_transpose_notes.md +78 -0
  890. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/tiling_review_notes.md +87 -0
  891. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/dev-experience/working_vs_failed_950_cases.md +85 -0
  892. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/index.md +30 -0
  893. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/broadcast_patterns.md +132 -0
  894. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/index.md +48 -0
  895. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/inplace_operator_patterns.md +182 -0
  896. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/kernel_design_patterns.md +117 -0
  897. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/reduction_patterns.md +152 -0
  898. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/regbase_buffer_partitioning.md +122 -0
  899. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/regbase_kernel_dataflow_patterns.md +164 -0
  900. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/regbase_operator_patterns.md +138 -0
  901. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/regbase_sync_patterns.md +113 -0
  902. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/tiling_input_validation.md +267 -0
  903. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/patterns/tiling_patterns.md +124 -0
  904. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/api_misuse.md +161 -0
  905. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/common_traps.md +199 -0
  906. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/index.md +41 -0
  907. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/precision_failures.md +176 -0
  908. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/precision_guide.md +190 -0
  909. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/regbase_vs_membase_confusions.md +89 -0
  910. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/pitfalls/symptom_to_cause.md +58 -0
  911. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/knowledge/regbase_development_guide.md +290 -0
  912. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/design_sample/flash_attn-arch35-best-practices.md +80 -0
  913. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/design_sample/quant_flash_attn-arch35-best-practices.md +67 -0
  914. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/design_sample/sparse_flash_attention-arch35-best-practices.md +66 -0
  915. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/design_sample/sparse_flash_mla-arch35-best-practices.md +69 -0
  916. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/patterns.md +65 -0
  917. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/advanced.md +37 -0
  918. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/buffer.md +241 -0
  919. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/compute-flow.md +111 -0
  920. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/load-balancing.md +42 -0
  921. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/pipeline-example.md +173 -0
  922. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/pipeline.md +60 -0
  923. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/pre-knowledge.md +197 -0
  924. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/roofline.md +220 -0
  925. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/selection.md +32 -0
  926. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/stage-cost.md +63 -0
  927. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/trait-mla.md +36 -0
  928. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/trait-quantization.md +51 -0
  929. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/FA/references/trait-sparse.md +35 -0
  930. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/README.md +20 -0
  931. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/capability-mapping.md +41 -0
  932. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/dag-buffers.md +285 -0
  933. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/design-spec.md +24 -0
  934. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_host/adam_apply_one_assign_def.cpp +104 -0
  935. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_host/arch35/adam_apply_one_assign_tiling_arch35.cpp +572 -0
  936. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_host/arch35/adam_apply_one_assign_tiling_arch35.h +86 -0
  937. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_kernel/adam_apply_one_assign.cpp +46 -0
  938. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_kernel/arch35/adam_apply_one_assign_kernel.h +343 -0
  939. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_kernel/arch35/adam_apply_one_assign_struct.h +29 -0
  940. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-code/op_kernel/arch35/adam_apply_one_assign_tiling_struct.h +53 -0
  941. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-design/adam_apply_one_assign_analysis.md +143 -0
  942. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/examples-adam-design/adam_apply_one_assign_design.md +2840 -0
  943. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/CMakeLists.txt +328 -0
  944. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/README.md +162 -0
  945. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_graph/xdivy_graph_infer.cpp +40 -0
  946. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_graph/xdivy_proto.h +44 -0
  947. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_host/arch35/xdivy_tiling_arch35.cpp +582 -0
  948. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_host/arch35/xdivy_tiling_arch35.h +94 -0
  949. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_host/xdivy_def.cpp +62 -0
  950. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_host/xdivy_infershape.cpp +60 -0
  951. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_kernel/arch35/xdivy_kernel.h +337 -0
  952. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_kernel/arch35/xdivy_struct.h +30 -0
  953. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_kernel/arch35/xdivy_tiling_struct.h +57 -0
  954. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/op_kernel/xdivy.cpp +44 -0
  955. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/aclnn/CMakeLists.txt +67 -0
  956. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/aclnn/run.sh +57 -0
  957. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/aclnn/test_aclnn.cpp +353 -0
  958. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/geir/CMakeLists.txt +69 -0
  959. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/geir/run.sh +59 -0
  960. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/geir/test_geir.cpp +409 -0
  961. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/tiling/CMakeLists.txt +185 -0
  962. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/tiling/run.sh +62 -0
  963. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/example/xdivy_custom_package/tests/tiling/test_tiling.cpp +355 -0
  964. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/index.md +48 -0
  965. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/kernel-entrance.md +95 -0
  966. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/kernel-helpers.md +208 -0
  967. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/kernel-template.md +617 -0
  968. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/overview.md +250 -0
  969. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/pitfalls.md +50 -0
  970. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/tiling-preprocess.md +487 -0
  971. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/ascendc/tiling.md +374 -0
  972. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/dsl/capability-mapping.md +50 -0
  973. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/dsl/implementation-guide.md +52 -0
  974. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/adapters/dsl/index.md +33 -0
  975. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/capability-contract.md +41 -0
  976. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/compute-flow.md +216 -0
  977. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/index.md +23 -0
  978. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/liveness-fusion.md +200 -0
  979. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/scene.md +68 -0
  980. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/shape-preprocessing.md +209 -0
  981. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/splitting.md +158 -0
  982. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/sync-model.md +79 -0
  983. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/generic/verification.md +131 -0
  984. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/broadcast/patterns.md +62 -0
  985. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/broadcast-rules.md +126 -0
  986. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/cast-rules.md +414 -0
  987. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/datacopypad-rules.md +186 -0
  988. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/nddma-rules.md +257 -0
  989. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/sync-and-consistency.md +315 -0
  990. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/value-depend-process.md +40 -0
  991. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/common/vf-programming-rules.md +150 -0
  992. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/example-routes.yaml +31 -0
  993. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/general-methodology-dsl.md +11 -0
  994. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/general-methodology.md +94 -0
  995. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/binary-tree.md +260 -0
  996. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/capability-mapping.md +49 -0
  997. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/design-spec.md +26 -0
  998. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/CMakeLists.txt +289 -0
  999. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/README.md +147 -0
  1000. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_graph/euclidean_norm_graph_infer.cpp +39 -0
  1001. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_graph/euclidean_norm_proto.h +54 -0
  1002. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_host/arch35/euclidean_norm_tiling_arch35.cpp +1027 -0
  1003. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_host/arch35/euclidean_norm_tiling_arch35.h +28 -0
  1004. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_host/euclidean_norm_def.cpp +85 -0
  1005. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_host/euclidean_norm_infershape.cpp +211 -0
  1006. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_apt.cpp +41 -0
  1007. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_base.h +911 -0
  1008. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_empty.h +141 -0
  1009. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_group.h +381 -0
  1010. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_tiling_data.h +65 -0
  1011. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/op_kernel/arch35/euclidean_norm_tiling_key.h +30 -0
  1012. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/aclnn/CMakeLists.txt +59 -0
  1013. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/aclnn/run.sh +37 -0
  1014. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/aclnn/test_aclnn.cpp +223 -0
  1015. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/geir/CMakeLists.txt +84 -0
  1016. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/geir/run.sh +49 -0
  1017. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/geir/test_geir.cpp +296 -0
  1018. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/tiling/CMakeLists.txt +143 -0
  1019. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/tiling/run.sh +41 -0
  1020. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/example/euclidean_norm_package/tests/tiling/test_tiling.cpp +320 -0
  1021. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/highlevel-api.md +146 -0
  1022. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/index.md +48 -0
  1023. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/kernel-entrance.md +97 -0
  1024. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/overview.md +237 -0
  1025. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/survival-node.md +74 -0
  1026. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/binary-base/dag-buffers.md +612 -0
  1027. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/binary-base/kernel-template.md +1213 -0
  1028. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/binary-base/tiling.md +511 -0
  1029. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/binary-group/dag-buffers.md +209 -0
  1030. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/binary-group/kernel-template.md +577 -0
  1031. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/binary-group/tiling.md +199 -0
  1032. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/empty/dag-buffers.md +292 -0
  1033. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/empty/kernel-template.md +349 -0
  1034. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/templates/empty/tiling.md +230 -0
  1035. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/tiling-preprocess.md +218 -0
  1036. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/tuple-reduce.md +72 -0
  1037. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/adapters/ascendc/vf-fusion-rules.md +95 -0
  1038. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/axis-preprocessing.md +109 -0
  1039. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/capability-contract.md +48 -0
  1040. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/index.md +23 -0
  1041. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/liveness-fusion.md +111 -0
  1042. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/scene.md +92 -0
  1043. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/splitting.md +230 -0
  1044. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/sync-model.md +86 -0
  1045. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/tree-reduction.md +160 -0
  1046. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/generic/tuple-reduce.md +53 -0
  1047. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/patterns.md +62 -0
  1048. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/reduction/validate_gates.py +196 -0
  1049. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/resolve_example.py +170 -0
  1050. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/paradigms/routes.yaml +39 -0
  1051. package/assets/ops-direct-invoke/skills/ops-design-paradigms/references/reference-ops/open_source_operator_table.md +715 -0
  1052. package/assets/ops-direct-invoke/skills/ops-design-paradigms/tests/test_language_route.py +142 -0
  1053. package/assets/ops-direct-invoke/skills/ops-direct-invoke/SKILL.md +249 -0
  1054. package/assets/ops-direct-invoke/skills/ops-direct-invoke/scripts/assemble_cannbotdsl_design.py +156 -0
  1055. package/assets/ops-direct-invoke/skills/ops-direct-invoke/scripts/assemble_workflow.py +571 -0
  1056. package/assets/ops-direct-invoke/skills/ops-direct-invoke/scripts/build_implementation_subgraph.py +320 -0
  1057. package/assets/ops-direct-invoke/skills/ops-direct-invoke/scripts/generate_workflow_guide.py +94 -0
  1058. package/assets/ops-direct-invoke/skills/ops-direct-invoke/scripts/run_workflow.py +121 -0
  1059. package/assets/ops-direct-invoke/skills/ops-direct-invoke/scripts/validate_unit_contracts.py +228 -0
  1060. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//344/273/243/347/240/201/344/277/256/345/244/215.yaml +39 -0
  1061. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//346/212/200/346/234/257/347/251/277/345/210/272.yaml +40 -0
  1062. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//346/226/207/346/241/243/345/207/206/345/244/207.yaml +27 -0
  1063. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//346/265/213/350/257/225/345/267/245/347/250/213/345/274/200/345/217/221.yaml +33 -0
  1064. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//347/231/275/347/233/222/346/265/213/350/257/225/350/256/276/350/256/241.yaml +34 -0
  1065. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//347/237/245/350/257/206/346/220/234/351/233/206.yaml +36 -0
  1066. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//347/256/227/345/255/220/345/274/200/345/217/221.yaml +47 -0
  1067. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/ascendc//351/273/221/347/233/222/346/265/213/350/257/225/350/256/276/350/256/241.yaml +27 -0
  1068. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//344/272/244/344/273/230.yaml +15 -0
  1069. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//344/273/243/347/240/201/346/243/200/350/247/206.yaml +18 -0
  1070. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/210/233/345/273/272/345/267/245/344/275/234/345/214/272.yaml +17 -0
  1071. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/215/225/345/205/203/344/273/273/345/212/241/346/213/206/345/210/206.yaml +22 -0
  1072. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/215/225/345/205/203/345/256/236/347/216/260.yaml +27 -0
  1073. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/215/225/345/205/203/351/233/206/346/210/220/345/244/215/351/252/214.yaml +19 -0
  1074. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/256/236/347/216/260/344/277/256/345/244/215.yaml +21 -0
  1075. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/256/236/347/216/260/346/243/200/350/247/206.yaml +20 -0
  1076. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//345/256/236/347/216/260/351/227/250/347/246/201.yaml +17 -0
  1077. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//346/200/247/350/203/275/344/274/230/345/214/226.yaml +22 -0
  1078. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//346/226/207/346/241/243/347/224/237/346/210/220.yaml +15 -0
  1079. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//346/226/271/346/241/210/350/256/276/350/256/241.yaml +32 -0
  1080. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//346/265/213/350/257/225/347/224/237/346/210/220.yaml +29 -0
  1081. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//347/216/257/345/242/203/345/260/261/347/273/252.yaml +25 -0
  1082. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//347/262/276/345/272/246/351/252/214/350/257/201.yaml +25 -0
  1083. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//350/247/204/346/240/274/347/224/237/346/210/220.yaml +18 -0
  1084. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//351/234/200/346/261/202/345/210/206/346/236/220.yaml +16 -0
  1085. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/cannbot-dsl//351/273/221/347/233/222/347/224/250/344/276/213/350/256/276/350/256/241.yaml +19 -0
  1086. package/assets/ops-direct-invoke/skills/ops-direct-invoke/tasks/common/.gitkeep +0 -0
  1087. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//344/273/243/347/240/201/346/243/200/350/247/206/346/212/245/345/221/212.md +70 -0
  1088. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//345/212/237/350/203/275/351/252/214/346/224/266/346/212/245/345/221/212.md +80 -0
  1089. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//346/265/213/350/257/225/346/211/247/350/241/214/350/256/260/345/275/225.md +73 -0
  1090. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//347/231/275/347/233/222/346/265/213/350/257/225/350/256/276/350/256/241.md +37 -0
  1091. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//347/237/245/350/257/206/346/220/234/351/233/206.md +25 -0
  1092. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//351/252/214/346/224/266/346/212/245/345/221/212.md +39 -0
  1093. package/assets/ops-direct-invoke/skills/ops-direct-invoke/templates//351/273/221/347/233/222/346/265/213/350/257/225/350/256/276/350/256/241.md +130 -0
  1094. package/assets/ops-direct-invoke/skills/ops-direct-invoke/workflows/ascendc/basic.yaml +57 -0
  1095. package/assets/ops-direct-invoke/skills/ops-direct-invoke/workflows/ascendc/feasibility.yaml +13 -0
  1096. package/assets/ops-direct-invoke/skills/ops-direct-invoke/workflows/cannbot-dsl/op-dev.graph-preview.yaml +18 -0
  1097. package/assets/ops-direct-invoke/skills/ops-direct-invoke/workflows/cannbot-dsl/op-dev.yaml +142 -0
  1098. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/SKILL.md +115 -0
  1099. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/agents-entry.md +23 -0
  1100. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/documentation.md +52 -0
  1101. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/ops-direct-invoke.md +67 -0
  1102. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/repo-skills.md +85 -0
  1103. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/subagents.md +43 -0
  1104. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/task-authoring.md +83 -0
  1105. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/reference/tests.md +33 -0
  1106. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/dsl_generation/test.py +499 -0
  1107. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/support.py +122 -0
  1108. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/test_all.py +59 -0
  1109. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/variables/test.py +100 -0
  1110. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/workflow_execution/test.py +134 -0
  1111. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/workflow_generation/test.py +457 -0
  1112. package/assets/ops-direct-invoke/skills/ops-direct-invoke-maintain/test/ut/workflow_guide/test.py +91 -0
  1113. package/assets/ops-direct-invoke/skills/ops-precision-standard/SKILL.md +22 -0
  1114. package/assets/ops-direct-invoke/skills/ops-precision-standard/evals/evals.json +120 -0
  1115. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/benchmark_construction.md +77 -0
  1116. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/float_compute.md +126 -0
  1117. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/integer_compute.md +105 -0
  1118. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/non_compute.md +81 -0
  1119. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/quantization.md +49 -0
  1120. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/random_generation.md +198 -0
  1121. package/assets/ops-direct-invoke/skills/ops-precision-standard/references/test_case_generation.md +61 -0
  1122. package/assets/ops-direct-invoke/skills/ops-precision-standard/scripts/bitwise_match.py +103 -0
  1123. package/assets/ops-direct-invoke/skills/ops-precision-standard/scripts/integer_compute_check.py +157 -0
  1124. package/assets/ops-direct-invoke/skills/ops-precision-standard/scripts/mixed_tolerance_check.py +178 -0
  1125. package/assets/ops-direct-invoke/skills/ops-precision-standard/scripts/random_distribution_check.py +247 -0
  1126. package/assets/ops-direct-invoke/skills/ops-profiling/SKILL.md +185 -0
  1127. package/assets/ops-direct-invoke/skills/ops-profiling/evals/evals.json +196 -0
  1128. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/SKILL.md +259 -0
  1129. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/VERSION +10 -0
  1130. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/evals/evals.json +33 -0
  1131. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/references/collection-workflow.md +91 -0
  1132. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/references/data-contract.md +63 -0
  1133. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/references/environment-and-failure.md +82 -0
  1134. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/references/validation-and-performance.md +63 -0
  1135. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/references/visualization-contract.md +86 -0
  1136. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/collect.py +2209 -0
  1137. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/collect_discovery.py +987 -0
  1138. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/collect_validate.py +607 -0
  1139. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/environment_context.py +723 -0
  1140. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/estimate_runtime.py +131 -0
  1141. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/run_pipeline.py +339 -0
  1142. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/runtime_guard.py +589 -0
  1143. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/self_check.py +465 -0
  1144. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/visualize.py +1004 -0
  1145. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/visualize_common.py +258 -0
  1146. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/visualize_parsers.py +1555 -0
  1147. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/visualize_render.py +286 -0
  1148. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/visualize_resolvers.py +1224 -0
  1149. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/scripts/visualize_source.py +1288 -0
  1150. package/assets/ops-direct-invoke/skills/ops-profiling/msopprof-visualization/templates/report_template.html +253 -0
  1151. package/assets/ops-direct-invoke/skills/ops-profiling/references/csv_fields_reference.md +260 -0
  1152. package/assets/ops-direct-invoke/skills/ops-profiling/references/msprof-guide.md +252 -0
  1153. package/assets/ops-direct-invoke/skills/ops-profiling/references/msprof-op-guide.md +241 -0
  1154. package/assets/ops-direct-invoke/skills/ops-profiling/references/optimization_quickref.md +265 -0
  1155. package/assets/ops-direct-invoke/skills/ops-profiling/scripts/msprof_perf_summary.py +2469 -0
  1156. package/assets/ops-direct-invoke/skills/ops-profiling/scripts/msprof_profile_run.sh +400 -0
  1157. package/assets/ops-direct-invoke/skills/ops-profiling/scripts/perf_summary.py +448 -0
  1158. package/assets/ops-direct-invoke/skills/ops-simulator/SKILL.md +233 -0
  1159. package/assets/ops-direct-invoke/skills/ops-simulator/evals/evals.json +128 -0
  1160. package/assets/ops-direct-invoke/skills/ops-simulator/references/pc-source-mapping.md +76 -0
  1161. package/assets/ops-direct-invoke/skills/ops-simulator/references/performance-issues-aic.md +557 -0
  1162. package/assets/ops-direct-invoke/skills/ops-simulator/references/performance-issues-aiv.md +674 -0
  1163. package/assets/ops-direct-invoke/skills/ops-simulator/references/performance-issues-general.md +199 -0
  1164. package/assets/ops-direct-invoke/skills/ops-simulator/references/performance-issues-template.md +143 -0
  1165. package/assets/ops-direct-invoke/skills/ops-simulator/references/performance-metrics-reference.md +350 -0
  1166. package/assets/ops-direct-invoke/skills/ops-simulator/references/pipeline-bubble-analysis.md +269 -0
  1167. package/assets/ops-direct-invoke/skills/ops-simulator/references/simulator-advanced.md +174 -0
  1168. package/assets/ops-direct-invoke/skills/ops-simulator/references/troubleshooting.md +105 -0
  1169. package/assets/ops-direct-invoke/skills/ops-simulator/scripts/map_pc_to_source.py +741 -0
  1170. package/assets/ops-direct-invoke/skills/ops-simulator/scripts/trace_bubble_analyzer.py +971 -0
  1171. package/assets/ops-direct-invoke/skills/ops-spec-gen/SKILL.md +350 -0
  1172. package/assets/ops-direct-invoke/skills/ops-spec-gen/evals/evals.json +114 -0
  1173. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/README.md +71 -0
  1174. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/add/spec.yaml +161 -0
  1175. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/complex/spec.yaml +154 -0
  1176. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/cumsum/spec.yaml +176 -0
  1177. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/dropout/spec.yaml +170 -0
  1178. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/fused_quant_matmul/spec.yaml +331 -0
  1179. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/matmul/spec.yaml +201 -0
  1180. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/nonzero/spec.yaml +174 -0
  1181. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/reduce_sum/spec.yaml +151 -0
  1182. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/reduce_sum_all/spec.yaml +135 -0
  1183. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/reduce_sum_fixed/spec.yaml +143 -0
  1184. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/softmax/spec.yaml +231 -0
  1185. package/assets/ops-direct-invoke/skills/ops-spec-gen/examples/split/spec.yaml +160 -0
  1186. package/assets/ops-direct-invoke/skills/ops-spec-gen/references/accumulation_order.md +63 -0
  1187. package/assets/ops-direct-invoke/skills/ops-spec-gen/references/error-codes.md +199 -0
  1188. package/assets/ops-direct-invoke/skills/ops-spec-gen/references/spec-cheatsheet.md +358 -0
  1189. package/assets/ops-direct-invoke/skills/ops-spec-gen/references/stage-rules.md +476 -0
  1190. package/assets/ops-direct-invoke/skills/ops-spec-gen/references/usage-scenarios.md +265 -0
  1191. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/anti_pattern_registry.yaml +51 -0
  1192. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/boundary_min_cases.yaml +215 -0
  1193. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/category_enum.yaml +37 -0
  1194. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/category_paradigm_map.yaml +145 -0
  1195. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/chip_registry.yaml +82 -0
  1196. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/error_code_enum.yaml +25 -0
  1197. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/framework_oracle_registry.yaml +22 -0
  1198. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/invariant_kind_registry.yaml +130 -0
  1199. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/machine_check_kind_registry.yaml +84 -0
  1200. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/paradigm_enum.yaml +48 -0
  1201. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/primitive_whitelist.yaml +67 -0
  1202. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/synthesize_pattern_registry.yaml +58 -0
  1203. package/assets/ops-direct-invoke/skills/ops-spec-gen/registries/tolerance_defaults.yaml +53 -0
  1204. package/assets/ops-direct-invoke/skills/ops-spec-gen/schemas/op-spec.json +762 -0
  1205. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/check_registry_schema_sync.py +167 -0
  1206. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/dump_rule_ids.py +168 -0
  1207. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/__init__.py +8 -0
  1208. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/_ast_sandbox.py +142 -0
  1209. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/broadcast.py +270 -0
  1210. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/dtype_eval.py +186 -0
  1211. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/extreme_inputs_check.py +355 -0
  1212. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/formula_eval.py +431 -0
  1213. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/formula_oracle_equiv.py +603 -0
  1214. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/invariant_exec.py +569 -0
  1215. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/oracle_check.py +465 -0
  1216. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/parser.py +71 -0
  1217. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/promote.py +254 -0
  1218. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/shape_eval.py +368 -0
  1219. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/stages.py +995 -0
  1220. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/evaluators/types.py +130 -0
  1221. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/generate_spec.py +1571 -0
  1222. package/assets/ops-direct-invoke/skills/ops-spec-gen/scripts/validate_spec.py +1848 -0
  1223. package/assets/ops-direct-invoke/skills/ops-spec-gen/templates/spec.yaml.tmpl +100 -0
  1224. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/conftest.py +21 -0
  1225. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_attr_resolve.py +72 -0
  1226. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_broadcast.py +85 -0
  1227. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_doc_drift.py +45 -0
  1228. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_dtype_eval.py +163 -0
  1229. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_examples.py +54 -0
  1230. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_extreme_inputs_check.py +181 -0
  1231. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_formula_eval.py +154 -0
  1232. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_formula_oracle_equiv.py +281 -0
  1233. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_generate_spec.py +98 -0
  1234. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_invariant_exec.py +235 -0
  1235. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_main_pipeline.py +419 -0
  1236. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_oracle.py +255 -0
  1237. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_promote.py +127 -0
  1238. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_registry_schema_sync.py +32 -0
  1239. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_sandbox_escape.py +90 -0
  1240. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_shape_eval.py +220 -0
  1241. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_shape_literal.py +82 -0
  1242. package/assets/ops-direct-invoke/skills/ops-spec-gen/tests/test_stage2_constraints.py +213 -0
  1243. package/assets/ops-direct-invoke/skills/repo-build-guide/SKILL.md +10 -0
  1244. package/assets/ops-direct-invoke/skills/repo-build-guide/references/build-guide.md +42 -0
  1245. package/assets/ops-direct-invoke/skills/repo-coding-rules/SKILL.md +10 -0
  1246. package/assets/ops-direct-invoke/skills/repo-coding-rules/references/red-lines.md +42 -0
  1247. package/assets/ops-direct-invoke/skills/repo-env-check/SKILL.md +44 -0
  1248. package/assets/ops-direct-invoke/skills/repo-env-check/references//347/216/257/345/242/203/344/277/241/346/201/257.md +42 -0
  1249. package/assets/ops-direct-invoke/skills/repo-knowledge/SKILL.md +12 -0
  1250. package/assets/ops-direct-invoke/skills/repo-knowledge/references/evaluation-contract.md +48 -0
  1251. package/assets/ops-direct-invoke/skills/repo-op-templates/SKILL.md +15 -0
  1252. package/assets/ops-direct-invoke/skills/repo-op-templates/references/operator-template.md +27 -0
  1253. package/assets/ops-direct-invoke/skills/repo-op-templates/references/project-skeleton.md +41 -0
  1254. package/assets/ops-direct-invoke/skills/repo-requirement/SKILL.md +39 -0
  1255. package/assets/ops-direct-invoke/skills/repo-requirement/references/requirement-checklist.md +70 -0
  1256. package/assets/ops-direct-invoke/skills/repo-test-develop/SKILL.md +17 -0
  1257. package/assets/ops-direct-invoke/skills/repo-test-develop/references/blackbox-design.md +30 -0
  1258. package/assets/ops-direct-invoke/skills/repo-test-develop/references/cannbench-integration.md +75 -0
  1259. package/assets/ops-direct-invoke/skills/repo-test-develop/references/precision-and-perf.md +36 -0
  1260. package/assets/ops-direct-invoke/skills/repo-test-develop/references/test-framework.md +75 -0
  1261. package/assets/ops-direct-invoke/skills/repo-test-develop/references/whitebox-design.md +19 -0
  1262. package/assets/ops-direct-invoke/skills/workflow-orchestrator/README.md +145 -0
  1263. package/assets/ops-direct-invoke/skills/workflow-orchestrator/SKILL.md +84 -0
  1264. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/approve_task.py +98 -0
  1265. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/get_task.py +1133 -0
  1266. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/init_status.py +131 -0
  1267. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/link_agent_config.py +89 -0
  1268. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/orchestrator.py +738 -0
  1269. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/poll_workflow.py +392 -0
  1270. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/task_graph.py +144 -0
  1271. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/update_status.py +149 -0
  1272. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/verdict_common.py +103 -0
  1273. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/verdict_fail.py +22 -0
  1274. package/assets/ops-direct-invoke/skills/workflow-orchestrator/scripts/verdict_pass.py +21 -0
  1275. package/assets/ops-direct-invoke/skills/workflow-orchestrator/templates/basic_workflow.yaml +113 -0
  1276. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_agent_exit.py +91 -0
  1277. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_approval.py +490 -0
  1278. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_link_agent_config.py +202 -0
  1279. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_nested_subgraphs.py +337 -0
  1280. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_orchestrator.py +1383 -0
  1281. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_poll_workflow.py +371 -0
  1282. package/assets/ops-direct-invoke/skills/workflow-orchestrator/tests/test_verdict.py +148 -0
  1283. package/cordis.patch.yml +3 -0
  1284. package/icon.svg +1 -0
  1285. package/lib/client.js +255 -0
  1286. package/lib/client.js.map +1 -0
  1287. package/lib/index.js +15 -0
  1288. package/locale/en.json +1 -0
  1289. package/locale/zh.json +1 -0
  1290. package/package.json +62 -3
  1291. package/upstream.json +10 -0
@@ -0,0 +1,2800 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) 2026 Huawei Technologies Co., Ltd.
4
+ # This program is free software, you can redistribute it and/or modify it under the terms and conditions of
5
+ # CANN Open Software License Agreement Version 2.0 (the "License").
6
+ # Please refer to the License for details. You may not use this file except in compliance with the License.
7
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8
+ # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
9
+ # See LICENSE in the root of the software repository for the full text of the License.
10
+ #
11
+ """
12
+ 测试用例生成脚本
13
+ 支持 L0(单因子覆盖)、L1(两两组合覆盖)和 L2(异常场景用例)
14
+ """
15
+
16
+ import argparse
17
+ import sys
18
+ import re
19
+ import random
20
+ import json
21
+ from pathlib import Path
22
+ from dataclasses import dataclass
23
+ import logging
24
+ from typing import Dict, List, Set, Tuple, Any, Optional, Union
25
+ import numpy as np
26
+ import yaml
27
+ from copy import deepcopy
28
+ import pandas as pd
29
+ from ast import literal_eval
30
+ from utils import (
31
+ normalize_dtype,
32
+ )
33
+ from generate_empty_tensor_cases_derive import (
34
+ load_constraints as load_constraints_derive,
35
+ analyze_operator_scenario,
36
+ generate_empty_tensor_cases as generate_empty_tensor_derive_cases,
37
+ )
38
+
39
+
40
+ @dataclass
41
+ class CreateCsvParams:
42
+ args: any
43
+ levels: list
44
+ constraints_def: any
45
+ param_def: any
46
+ factors: dict
47
+ df: any
48
+ all_factor_values: dict
49
+ md_content: str
50
+
51
+
52
+ @dataclass
53
+ class SaveCaseParams:
54
+ level: str
55
+ args: any
56
+ report: any
57
+ case_df_ttk: any
58
+ report_file: str
59
+ case_file: str
60
+ aclnn_name: str
61
+
62
+
63
+ @dataclass
64
+ class SaveResultsParams:
65
+ report: dict
66
+ case_df_ttk: any
67
+ output_dir: str
68
+ report_file: str
69
+ case_file: str
70
+ aclnn_name: str
71
+ verbose: bool
72
+
73
+
74
+ @dataclass
75
+ class TensorProcessData:
76
+ """用于封装 _process_acl_tensor 的输入输出集合,减少参数"""
77
+ input_shapes: list
78
+ input_dtypes: list
79
+ input_ranges: list
80
+ output_shapes: list
81
+ output_dtypes: list
82
+ output_indexes: list
83
+ tensor_list_lengths: list
84
+
85
+
86
+ @dataclass
87
+ class TtkCaseData:
88
+ """用于封装构建 TTK Case 所需的所有数据"""
89
+ input_shapes: list
90
+ input_dtypes: list
91
+ input_ranges: list
92
+ output_shapes: list
93
+ output_dtypes: list
94
+ output_indexes: list = None
95
+ scalar_dtypes_list: list = None
96
+ attrs_dict: dict = None
97
+ tensor_list_lengths: list = None
98
+
99
+ def __post_init__(self):
100
+ if self.output_indexes is None:
101
+ self.output_indexes = []
102
+ if self.scalar_dtypes_list is None:
103
+ self.scalar_dtypes_list = []
104
+ if self.attrs_dict is None:
105
+ self.attrs_dict = {}
106
+ if self.tensor_list_lengths is None:
107
+ self.tensor_list_lengths = []
108
+
109
+
110
+ @dataclass
111
+ class ErrorCaseSummary:
112
+ dtype_error_cases: list
113
+ dtype_combo_cases: list
114
+ dim_error_cases: list
115
+ format_error_cases: list
116
+ shape_error_cases: list
117
+ empty_tensor_cases: list
118
+ attr_error_cases: list
119
+
120
+
121
+ @dataclass
122
+ class InputTensorData:
123
+ input_shapes: list
124
+ input_dtypes: list
125
+ input_ranges: list
126
+
127
+
128
+ @dataclass
129
+ class TtkProcessContext:
130
+ """封装 _process_single_ttk_case 所需的上下文参数"""
131
+ row: any
132
+ idx: int
133
+ param_def: dict
134
+ param_names: list
135
+ aclnn_name: str
136
+ case_level: str
137
+
138
+
139
+ @dataclass
140
+ class ErrorCaseConfig:
141
+ """封装创建错误用例所需的所有配置参数"""
142
+ param_def: dict
143
+ aclnn_name: str
144
+ param_name: str
145
+ supported_dtype: str
146
+ error_type: str
147
+ error_param: str
148
+ case_name: str
149
+ shape_values: dict = None
150
+
151
+
152
+ @dataclass
153
+ class TensorListOutputContainer:
154
+ input_shapes: List
155
+ input_dtypes: List
156
+ input_ranges: List
157
+ tensor_list_lengths: List
158
+
159
+
160
+ @dataclass
161
+ class OutputTensorListContainer:
162
+ output_shapes: List
163
+ output_dtypes: List
164
+ tensor_list_lengths: List
165
+ output_indexes: List
166
+
167
+
168
+ # 全局常量:各 dtype 边界值定义
169
+ DTYPE_BOUNDARIES = {
170
+ 'float32': {'min': -3.4028235e+38, 'max': 3.4028235e+38, 'special': ['inf', '-inf', 'nan']},
171
+ 'float16': {'min': -65504.0, 'max': 65504.0, 'special': ['inf', '-inf', 'nan']},
172
+ 'float64': {'min': -1.7976931348623157e+308, 'max': 1.7976931348623157e+308, 'special': ['inf', '-inf', 'nan']},
173
+ 'bfloat16': {'min': -3.38e+38, 'max': 3.38e+38, 'special': ['inf', '-inf', 'nan']},
174
+ 'int32': {'min': -2147483648, 'max': 2147483647, 'special': []},
175
+ 'int64': {'min': -9223372036854775808, 'max': 9223372036854775807, 'special': []},
176
+ 'int16': {'min': -32768, 'max': 32767, 'special': []},
177
+ 'int8': {'min': -128, 'max': 127, 'special': []},
178
+ 'uint8': {'min': 0, 'max': 255, 'special': []},
179
+ 'bool': {'min': 0, 'max': 1, 'special': []},
180
+ 'complex64': {'min': None, 'max': None, 'special': ['nan']},
181
+ 'complex128': {'min': None, 'max': None, 'special': ['nan']},
182
+ }
183
+
184
+ _TTK_DATAFRAME_COLUMNS = [
185
+ 'testcase_name', 'api_name', 'tensor_view_shapes', 'tensor_dtypes',
186
+ 'scalar_dtypes', 'attributes', 'output_tensor_indexes',
187
+ 'precision_tolerances', 'absolute_precision', 'input_data_ranges',
188
+ 'scalar_data_ranges', 'tensor_list_distribution'
189
+ ]
190
+
191
+ # ============ 全量数据类型和格式定义(用于异常用例生成)============
192
+
193
+ ALL_DTYPES = [
194
+ 'float32', 'float16', 'float64', 'bfloat16',
195
+ 'int32', 'int64', 'int16', 'int8', 'uint8',
196
+ 'uint16', 'uint32', 'uint64',
197
+ 'bool', 'complex64', 'complex128',
198
+ 'float4_e2m1', 'float4_e1m2', 'float8_e4m3fn', 'float8_e5m2'
199
+ ]
200
+
201
+ ALL_FORMATS = ['ND', 'NCHW', 'NHWC', 'NCDHW', 'NDHWC', 'HWCN', 'NCW', 'NWC', 'NC1HWC0']
202
+
203
+ OVERFLOW_DIMENSIONS = [9, 10, 11, 12]
204
+
205
+ INCOMPATIBLE_DTYPE_COMBOS = [
206
+ ('int64', 'float16'),
207
+ ('uint64', 'int32'),
208
+ ('complex64', 'float32'),
209
+ ('complex128', 'float16'),
210
+ ('uint64', 'int64'),
211
+ ('uint32', 'int32'),
212
+ ]
213
+
214
+
215
+ def main():
216
+ """主函数"""
217
+ # 1. 解析参数
218
+ args = parse_arguments()
219
+
220
+ # 2. 解析级别
221
+ levels = parse_levels(args.level)
222
+
223
+ # 3. 参数校验(冲突检测)
224
+ validate_parameters(args, levels)
225
+
226
+ # 4. 加载约束定义(L2需要)
227
+ constraints_def = None
228
+ if 'L2' in levels:
229
+ constraints_def = load_yaml(args.constraints_file)
230
+ if args.verbose:
231
+ print(f"[INFO] 加载约束定义: {args.constraints_file}")
232
+
233
+ # 5. 加载数据(只加载一次,批量生成时共享)
234
+ param_def, factors, df = load_data(args)
235
+
236
+ # 6. 提取因子值(只提取一次,批量生成时共享)
237
+ all_factor_values = extract_all_factor_values(factors, df)
238
+
239
+ # 7. 获取接口文档内容(用于判断搬运类算子)
240
+ md_content = load_md_content(args, param_def)
241
+
242
+ if args.verbose:
243
+ print(f"[INFO] 将生成级别: {', '.join(levels)}\n")
244
+
245
+ # 8. 按级别生成用例
246
+ # 封装参数
247
+ csv_params = CreateCsvParams(
248
+ args=args,
249
+ levels=levels,
250
+ constraints_def=constraints_def,
251
+ param_def=param_def,
252
+ factors=factors,
253
+ df=df,
254
+ all_factor_values=all_factor_values,
255
+ md_content=md_content
256
+ )
257
+
258
+ # 调用函数
259
+ create_csv(csv_params)
260
+
261
+ if args.verbose:
262
+ print(f"[INFO] 完成! 共生成 {len(levels)} 个级别的用例")
263
+
264
+
265
+ def create_csv(params: CreateCsvParams):
266
+ for level in params.levels:
267
+ if params.args.verbose:
268
+ logging.info(f"{'='*10} 开始生成 {level} 用例 {'='*10}")
269
+
270
+ # L2 异常用例
271
+ if level == 'L2':
272
+ _handle_l2_cases(params.args, params.param_def, params.factors, params.constraints_def)
273
+ continue
274
+
275
+ # L0 / L1 用例筛选
276
+ selected_indices, report = _generate_l0_l1_cases(
277
+ level, params.df, params.all_factor_values, params.args
278
+ )
279
+
280
+ # 生成输出文件
281
+ aclnn_name = extract_aclnn_name(params.args)
282
+ report_file, case_file = get_output_filenames(
283
+ params.args.report_output, params.args.case_output, level, len(params.levels) > 1, aclnn_name
284
+ )
285
+
286
+ # 转换格式
287
+ selected_df = params.df.iloc[selected_indices].reset_index(drop=True)
288
+ case_df_ttk = convert_to_ttk_format(selected_df, params.param_def, aclnn_name, level)
289
+
290
+ # 空 tensor 用例
291
+ if not params.args.skip_empty and params.args.empty_count > 0 and level in ('L0', 'L1'):
292
+ constraints_path = infer_constraints_path(params.args)
293
+ case_df_ttk = empty_tensor_create(constraints_path, case_df_ttk, params.param_def, params.args)
294
+
295
+ # 保存结果
296
+ # 封装参数
297
+ save_params = SaveCaseParams(
298
+ level=level,
299
+ args=params.args,
300
+ report=report,
301
+ case_df_ttk=case_df_ttk,
302
+ report_file=report_file,
303
+ case_file=case_file,
304
+ aclnn_name=aclnn_name
305
+ )
306
+ # 调用
307
+ _save_case_results(save_params)
308
+
309
+ if params.args.verbose:
310
+ logging.info(f"{'='*10} {level} 用例生成完成 {'='*10}\n")
311
+
312
+
313
+ def _handle_l2_cases(args, param_def, factors, constraints_def):
314
+ """处理 L2 异常用例生成与保存"""
315
+ error_cases = generate_error_cases(param_def, factors, constraints_def, args.verbose)
316
+ case_df_ttk = create_error_ttk_dataframe(error_cases, param_def)
317
+
318
+ output_dir = Path(args.output_dir)
319
+ output_dir.mkdir(parents=True, exist_ok=True)
320
+ aclnn_name = extract_aclnn_name(args)
321
+
322
+ case_file = args.case_output if args.case_output else "l2_test_cases.csv"
323
+ base_name = Path(case_file).stem
324
+ ttk_csv = f"{aclnn_name}_{base_name}.csv"
325
+ case_path = output_dir / ttk_csv
326
+
327
+ case_df_ttk.to_csv(case_path, index=False)
328
+ if args.verbose:
329
+ print(f"[INFO] 生成异常用例: {case_path} ({len(case_df_ttk)}条)")
330
+
331
+
332
+ def _generate_l0_l1_cases(level, df, all_factor_values, args):
333
+ """生成 L0/L1 用例并返回选中索引 + 报告"""
334
+ if level == 'L0':
335
+ selected_indices, coverage_info = select_cases_L0(df, all_factor_values, args.verbose)
336
+ report = generate_L0_report(all_factor_values, coverage_info)
337
+ else:
338
+ pairwise_combinations = generate_pairwise_combinations(all_factor_values)
339
+ if args.verbose:
340
+ print(f"[INFO] 两两组合数: {len(pairwise_combinations)}")
341
+
342
+ selected_indices, coverage_info = select_cases_L1(
343
+ df, pairwise_combinations, all_factor_values, args.verbose, args.sample_size
344
+ )
345
+ selected_indices = complete_case(selected_indices, args)
346
+ report = generate_L1_report(
347
+ all_factor_values, pairwise_combinations, coverage_info, args.target_count
348
+ )
349
+ return selected_indices, report
350
+
351
+
352
+ def _save_case_results(params: SaveCaseParams):
353
+ """保存 L0/L1 用例与报告"""
354
+ output_dir = Path(params.args.output_dir)
355
+ output_dir.mkdir(parents=True, exist_ok=True)
356
+
357
+ if params.level == 'L0':
358
+ # 封装参数
359
+ save_params = SaveResultsParams(
360
+ report=params.report,
361
+ case_df_ttk=params.case_df_ttk,
362
+ output_dir=params.args.output_dir,
363
+ report_file=params.report_file,
364
+ case_file=params.case_file,
365
+ aclnn_name=params.aclnn_name,
366
+ verbose=params.args.verbose
367
+ )
368
+
369
+ # 调用函数
370
+ save_results(save_params)
371
+ else:
372
+ ttk_csv = f"{params.aclnn_name}_{params.case_file.split('.')[0]}.csv"
373
+ case_path = output_dir / ttk_csv
374
+ params.case_df_ttk.to_csv(case_path, index=False)
375
+ if params.args.verbose:
376
+ logging.info(f"生成用例: {case_path} ({len(params.case_df_ttk)}条)")
377
+
378
+
379
+ def complete_case(selected_indices, args):
380
+ if len(selected_indices) < args.target_count:
381
+ if args.verbose:
382
+ print(f"[INFO] 补齐用例: {len(selected_indices)} -> {args.target_count}")
383
+ selected_indices = pad_cases(
384
+ selected_indices, args.target_count, args.seed
385
+ )
386
+ return selected_indices
387
+
388
+
389
+ def empty_tensor_create(constraints_path, case_df_ttk, param_def, args):
390
+ if constraints_path:
391
+ empty_df = generate_empty_cases_inline(
392
+ case_df_ttk, constraints_path, param_def, args.empty_count, args.verbose
393
+ )
394
+ if len(empty_df) > 0:
395
+ case_df_ttk = pd.concat([empty_df, case_df_ttk], ignore_index=True)
396
+ if args.verbose:
397
+ print(f"[INFO] 合计用例: {len(case_df_ttk)}条(含{len(empty_df)}条空tensor)")
398
+ return case_df_ttk
399
+
400
+
401
+ def parse_arguments():
402
+ """解析命令行参数"""
403
+ parser = argparse.ArgumentParser(
404
+ description='测试用例生成脚本(支持L0和L1)',
405
+ formatter_class=argparse.RawDescriptionHelpFormatter,
406
+ epilog="""
407
+ 示例:
408
+ # 生成L0用例
409
+ python generate_test_cases.py param.yaml factors.yaml values.csv output/ --level L0
410
+
411
+ # 生成L1用例(500条)
412
+ python generate_test_cases.py param.yaml factors.yaml values.csv output/ --level L1 --target-count 500
413
+
414
+ # 批量生成L0和L1
415
+ python generate_test_cases.py param.yaml factors.yaml values.csv output/ --level L0 L1
416
+
417
+ # 自定义输出文件名
418
+ python generate_test_cases.py param.yaml factors.yaml values.csv output/ --level L0 --report-output my_report.yaml
419
+ """
420
+ )
421
+
422
+ parser.add_argument('param_def', help='参数定义YAML文件(03_参数定义.yaml)')
423
+ parser.add_argument('factors', help='测试因子YAML文件(04_测试因子.yaml)')
424
+ parser.add_argument('values', help='因子值CSV文件(07_因子值.csv)')
425
+ parser.add_argument('output_dir', help='输出目录')
426
+
427
+ parser.add_argument('--level', nargs='+', required=True,
428
+ help='用例级别(必填,支持多个): L0=单因子覆盖,L1=两两组合覆盖,L2=异常场景用例')
429
+ parser.add_argument('--aclnn-name', help='算子名称(默认从文件路径中提取)')
430
+ parser.add_argument('--target-count', type=int, default=500,
431
+ help='L1目标用例数量(默认500,仅L1有效)')
432
+ parser.add_argument('--sample-size', type=int, default=1000,
433
+ help='L1每次迭代采样的候选用例数量(默认1000,仅L1有效,用于加速大数据集)')
434
+ parser.add_argument('--seed', type=int, help='随机数种子(用于复现L1补齐,仅L1有效)')
435
+ parser.add_argument('--report-output', help='覆盖度报告文件名(默认: {level}_coverage_report.yaml)')
436
+ parser.add_argument('--case-output', help='测试用例文件名(默认: {level}_test_cases.csv)')
437
+ parser.add_argument('--md-file', help='接口文档路径(用于判断搬运类算子,可选)')
438
+ parser.add_argument('--constraints-file', help='约束定义YAML文件(05_约束定义.yaml,L2级别必填)')
439
+ parser.add_argument('--empty-count', type=int, default=5, help='空tensor用例数量(默认5,L0和L1有效)')
440
+ parser.add_argument('--skip-empty', action='store_true', help='跳过空tensor用例生成')
441
+ parser.add_argument('--verbose', action='store_true', help='详细输出模式')
442
+
443
+ return parser.parse_args()
444
+
445
+
446
+ def parse_levels(level_arg):
447
+ """解析 --level 参数"""
448
+ levels = []
449
+
450
+ for item in level_arg:
451
+ # 支持逗号分隔
452
+ if ',' in item:
453
+ levels.extend([l.strip() for l in item.split(',')])
454
+ else:
455
+ levels.append(item.strip())
456
+
457
+ # 去重并排序(L0在前,L2最后)
458
+ levels = sorted(set(levels), key=lambda x: (x == 'L2', x != 'L0', x))
459
+
460
+ # 验证
461
+ valid_levels = {'L0', 'L1', 'L2'}
462
+ invalid = set(levels) - valid_levels
463
+ if invalid:
464
+ print(f"[ERROR] 无效的级别: {invalid},仅支持 L0、L1 和 L2")
465
+ sys.exit(1)
466
+
467
+ return levels
468
+
469
+
470
+ def validate_parameters(args, levels):
471
+ """验证参数冲突"""
472
+ errors = []
473
+
474
+ # L2 级别必须提供 constraints_file
475
+ _validate_l2_requirements(levels, args, errors)
476
+
477
+ # 仅 L0 时,检查 L1 专用参数
478
+ _validate_l0_exclusive_params(levels, args, errors)
479
+
480
+ # 如果有错误,打印并退出
481
+ if errors:
482
+ _print_parameter_errors(errors)
483
+ sys.exit(1)
484
+
485
+
486
+ def _validate_l2_requirements(levels, args, errors):
487
+ """检查 L2 级别必须的参数"""
488
+ if 'L2' in levels and not args.constraints_file:
489
+ errors.append({
490
+ 'param': '--constraints-file',
491
+ 'value': 'None',
492
+ 'reason': 'L2 级别必须提供 --constraints-file 参数',
493
+ 'detail': 'L2 需要从约束定义文件提取支持的dtype/format等信息',
494
+ 'solution': ['添加 --constraints-file ops/aclnnAdds/tests/st/design/05_约束定义.yaml']
495
+ })
496
+
497
+
498
+ def _validate_l0_exclusive_params(levels, args, errors):
499
+ """仅生成 L0 时,检查 L1 专用参数是否被误用"""
500
+ if levels == ['L0']:
501
+ if args.target_count != 500:
502
+ errors.append({
503
+ 'param': '--target-count',
504
+ 'value': args.target_count,
505
+ 'reason': 'L0 不支持 --target-count 参数',
506
+ 'detail': 'L0 的用例数量由算法自动确定(覆盖所有因子值的最小集合)',
507
+ 'solution': ['移除 --target-count 参数', '或使用 --level L1 生成 L1 用例']
508
+ })
509
+
510
+ if args.seed is not None:
511
+ errors.append({
512
+ 'param': '--seed',
513
+ 'value': args.seed,
514
+ 'reason': 'L0 不支持 --seed 参数',
515
+ 'detail': 'L0 不需要补齐,因此无需随机数种子',
516
+ 'solution': ['移除 --seed 参数', '或使用 --level L1 生成 L1 用例']
517
+ })
518
+
519
+
520
+ def _print_parameter_errors(errors):
521
+ """统一打印参数错误信息并退出"""
522
+ logging.info("\n" + "=" * 80)
523
+ print("参数冲突错误")
524
+ print("=" * 80 + "\n")
525
+
526
+ for error in errors:
527
+ print(f"[ERROR] {error['param']}={error['value']} 无效")
528
+ print(f" {error['reason']}")
529
+ print(f" {error['detail']}")
530
+ print(" 解决方法:")
531
+ for i, sol in enumerate(error['solution'], 1):
532
+ print(f" {i}. {sol}")
533
+ print()
534
+
535
+ print("=" * 80)
536
+ print("脚本已退出(错误码:1)")
537
+ print("=" * 80 + "\n")
538
+
539
+
540
+ def infer_constraints_path(args):
541
+ """从参数定义路径推断约束定义文件路径"""
542
+ if args.constraints_file:
543
+ return args.constraints_file
544
+ param_path = Path(args.param_def)
545
+ design_dir = param_path.parent
546
+
547
+ constraints_file = design_dir / "05_约束定义.yaml"
548
+ if constraints_file.exists():
549
+ return str(constraints_file)
550
+
551
+ return None
552
+
553
+
554
+ def generate_empty_cases_inline(case_df, constraints_path, param_def, num_empty, verbose):
555
+ """内联生成空tensor用例(L0和L1都生成)"""
556
+ try:
557
+ constraints = load_constraints_derive(constraints_path)
558
+ scenarios = analyze_operator_scenario(constraints)
559
+ if not scenarios:
560
+ if verbose:
561
+ print("[INFO] 无空tensor场景,跳过生成")
562
+ return pd.DataFrame()
563
+ if verbose:
564
+ print(f"[INFO] 分析到 {len(scenarios)} 个空tensor场景")
565
+ empty_df = generate_empty_tensor_derive_cases(
566
+ case_df, constraints, param_def, num_cases=num_empty, verbose=verbose
567
+ )
568
+ return empty_df
569
+ except Exception as e:
570
+ if verbose:
571
+ print(f"[WARN] 空tensor用例生成失败: {e}")
572
+ return pd.DataFrame()
573
+
574
+
575
+ def load_data(args):
576
+ """加载数据文件"""
577
+ param_def = load_yaml(args.param_def)
578
+ factors = load_yaml(args.factors)
579
+ df = pd.read_csv(args.values)
580
+
581
+ if args.verbose:
582
+ print(f"[INFO] 加载参数定义: {args.param_def}")
583
+ print(f"[INFO] 加载测试因子: {args.factors}")
584
+ print(f"[INFO] 加载因子值: {args.values} ({len(df)}个用例)\n")
585
+
586
+ return param_def, factors, df
587
+
588
+
589
+ def load_md_content(args, param_def):
590
+ """
591
+ 加载接口文档内容(用于判断搬运类算子)
592
+
593
+ Args:
594
+ args: 命令行参数
595
+ param_def: 参数定义
596
+
597
+ Returns:
598
+ str: md 文件内容(如果找不到则返回 None)
599
+ """
600
+ md_file = _resolve_md_file_path(args, param_def)
601
+
602
+ if md_file is None:
603
+ return None
604
+
605
+ return _read_md_file_content(md_file, args.verbose)
606
+
607
+
608
+ def _resolve_md_file_path(args, param_def):
609
+ """确定 md 文件路径"""
610
+ if args.md_file:
611
+ return Path(args.md_file)
612
+
613
+ return _infer_md_file_from_param_def(args.param_def, param_def)
614
+
615
+
616
+ def _infer_md_file_from_param_def(param_def_path, param_def):
617
+ """从参数定义文件路径推断 md 文件路径"""
618
+ param_def_path = Path(param_def_path)
619
+
620
+ ops_idx = _find_ops_index(param_def_path.parts)
621
+ if ops_idx is None or ops_idx + 1 >= len(param_def_path.parts):
622
+ return None
623
+
624
+ operator_name = param_def_path.parts[ops_idx + 1]
625
+ docs_dir = param_def_path.parents[3] / operator_name / 'docs'
626
+
627
+ return _find_md_file_in_docs(docs_dir, param_def)
628
+
629
+
630
+ def _find_ops_index(parts):
631
+ """在路径中找到 ops 目录的索引"""
632
+ for i, part in enumerate(parts):
633
+ if part == 'ops':
634
+ return i
635
+ return None
636
+
637
+
638
+ def _find_md_file_in_docs(docs_dir, param_def):
639
+ """在 docs 目录中查找 md 文件"""
640
+ aclnn_name = param_def.get('aclnn_name', '')
641
+
642
+ if aclnn_name:
643
+ return docs_dir / f"{aclnn_name}.md"
644
+
645
+ if not docs_dir.exists():
646
+ return None
647
+
648
+ md_files = list(docs_dir.glob('aclnn*.md'))
649
+ return md_files[0] if md_files else None
650
+
651
+
652
+ def _read_md_file_content(md_file, verbose):
653
+ """读取 md 文件内容"""
654
+ if not md_file.exists():
655
+ return None
656
+
657
+ try:
658
+ with open(md_file, 'r', encoding='utf-8') as f:
659
+ content = f.read()
660
+ if verbose:
661
+ print(f"[INFO] 加载接口文档: {md_file}")
662
+ return content
663
+ except Exception as e:
664
+ if verbose:
665
+ print(f"[WARN] 无法加载接口文档 {md_file}: {e}")
666
+ return None
667
+
668
+
669
+ # ============ L0 相关函数 ============
670
+
671
+ def select_cases_L0(df, all_factor_values, verbose=False):
672
+ """
673
+ L0: 使用贪心算法选择覆盖所有单个因子值的最小用例集
674
+
675
+ Args:
676
+ df: 因子值 DataFrame
677
+ all_factor_values: 所有因子及其值
678
+ verbose: 是否输出详细信息
679
+
680
+ Returns:
681
+ Tuple[List[int], Dict]: (选中的用例索引列表, 覆盖度信息)
682
+ """
683
+ if verbose:
684
+ print(f"[INFO] 提取因子: {len(all_factor_values)}个因子, {sum(len(v) for v in all_factor_values.values())}个因子值")
685
+
686
+ selected_indices = []
687
+ uncovered = deepcopy(all_factor_values)
688
+ covered = {k: set() for k in all_factor_values.keys()}
689
+
690
+ iteration = 0
691
+ while any(uncovered.values()):
692
+ iteration += 1
693
+ best_idx = None
694
+ best_new_coverage = 0
695
+ best_covered = {}
696
+
697
+ for idx, row in df.iterrows():
698
+ if idx in selected_indices:
699
+ continue
700
+
701
+ new_coverage = 0
702
+ current_covered = {}
703
+
704
+ for factor_name, required_values in uncovered.items():
705
+ if factor_name not in row.index:
706
+ continue
707
+
708
+ value = row[factor_name]
709
+ value_key = make_hashable(value)
710
+
711
+ if value_key in required_values:
712
+ new_coverage += 1
713
+ current_covered[factor_name] = value_key
714
+
715
+ if new_coverage > best_new_coverage:
716
+ best_new_coverage = new_coverage
717
+ best_idx = idx
718
+ best_covered = current_covered
719
+
720
+ if best_idx is None or best_new_coverage == 0:
721
+ break
722
+
723
+ selected_indices.append(best_idx)
724
+
725
+ for factor_name, value in best_covered.items():
726
+ covered[factor_name].add(value)
727
+ uncovered[factor_name].discard(value)
728
+
729
+ if verbose and iteration % 5 == 0:
730
+ total_uncovered = sum(len(v) for v in uncovered.values())
731
+ print(f"[INFO] L0迭代{iteration}: 选择用例{best_idx}, 新覆盖{best_new_coverage}个因子值, 剩余{total_uncovered}")
732
+
733
+ if verbose:
734
+ total_values = sum(len(v) for v in all_factor_values.values())
735
+ covered_count = sum(len(v) for v in covered.values())
736
+ print(f"[INFO] 完成用例选择: {len(selected_indices)}个用例")
737
+ print(f"[INFO] 因子值覆盖: {covered_count}/{total_values} ({covered_count/total_values*100:.2f}%)")
738
+
739
+ coverage_info = {
740
+ 'covered_values': covered,
741
+ 'uncovered_values': uncovered,
742
+ 'total_factors': len(all_factor_values),
743
+ 'total_values': sum(len(v) for v in all_factor_values.values()),
744
+ 'covered_count': sum(len(v) for v in covered.values())
745
+ }
746
+
747
+ return selected_indices, coverage_info
748
+
749
+
750
+ def generate_L0_report(all_factor_values, coverage_info):
751
+ """生成L0覆盖度报告"""
752
+ total_values = sum(len(v) for v in all_factor_values.values())
753
+ covered_count = coverage_info['covered_count']
754
+ uncovered_count = total_values - covered_count
755
+
756
+ report = {
757
+ 'summary': {
758
+ 'level': 'L0',
759
+ 'strategy': 'single_factor_coverage',
760
+ 'total_factors': coverage_info['total_factors'],
761
+ 'total_factor_values': total_values,
762
+ 'covered_factor_values': covered_count,
763
+ 'uncovered_factor_values': uncovered_count,
764
+ 'coverage_rate': f"{covered_count/total_values*100:.2f}%" if total_values > 0 else "N/A",
765
+ 'minimal_case_count': coverage_info['covered_count']
766
+ },
767
+ 'details': {}
768
+ }
769
+
770
+ for factor_name, required_values in all_factor_values.items():
771
+ covered = coverage_info['covered_values'].get(factor_name, set())
772
+ uncovered = coverage_info['uncovered_values'].get(factor_name, set())
773
+
774
+ report['details'][factor_name] = {
775
+ 'target_values': sorted([str(v) for v in required_values]),
776
+ 'covered_values': sorted([str(v) for v in covered]),
777
+ 'uncovered_values': sorted([str(v) for v in uncovered]),
778
+ 'coverage_rate': f"{len(covered)/len(required_values)*100:.2f}%" if required_values else "N/A"
779
+ }
780
+
781
+ return report
782
+
783
+
784
+ # ============ L1 相关函数 ============
785
+
786
+ def generate_pairwise_combinations(all_factor_values):
787
+ """
788
+ 生成所有因子的两两组合(优化版:只考虑离散因子)
789
+
790
+ Args:
791
+ all_factor_values: Dict[str, List[Any]] - 因子名 -> 因子值列表
792
+
793
+ Returns:
794
+ Set[Tuple]: 所有两两组合集合
795
+
796
+ 优化说明:
797
+ 1. 只保留离散因子(dtype, dimensions, exist, format, 枚举值等)
798
+ 2. 过滤派生因子(.value, .shape)和连续值因子(.value_range)
799
+ 3. 过滤固定值因子(只有1个值的因子)
800
+
801
+ 性能提升:
802
+ - 原始:192,810个组合(包含value_range)
803
+ - 优化后:~500个组合(只有离散因子)
804
+ - 性能提升:~400倍
805
+ """
806
+ # 定义离散因子模式
807
+ discrete_patterns = [
808
+ '.dtype', # 数据类型(离散)
809
+ '.dimensions', # 维度数(离散)
810
+ '.exist', # 存在性(离散)
811
+ '.format', # 数据格式(离散)
812
+ 'cubeMathType.value', # 枚举值(离散)
813
+ ]
814
+
815
+ def is_discrete_factor(factor_name):
816
+ """判断是否为离散因子"""
817
+ # 排除派生因子和连续值因子
818
+ if factor_name.endswith('.value') and not factor_name == 'cubeMathType.value':
819
+ return False
820
+ if factor_name.endswith('.shape'):
821
+ return False
822
+ if factor_name.endswith('.value_range'):
823
+ return False
824
+
825
+ # 保留离散因子
826
+ for pattern in discrete_patterns:
827
+ if pattern in factor_name:
828
+ return True
829
+
830
+ return False
831
+
832
+ # 过滤离散因子
833
+ discrete_factors = {
834
+ name: values
835
+ for name, values in all_factor_values.items()
836
+ if is_discrete_factor(name)
837
+ }
838
+
839
+ # 过滤只有1个值的因子
840
+ multi_value_factors = {
841
+ name: values
842
+ for name, values in discrete_factors.items()
843
+ if len(values) > 1
844
+ }
845
+
846
+ fixed_value_factors = {
847
+ name: values
848
+ for name, values in discrete_factors.items()
849
+ if len(values) == 1
850
+ }
851
+
852
+ # 统计过滤的因子
853
+ filtered_continuous = {
854
+ name: values
855
+ for name, values in all_factor_values.items()
856
+ if name.endswith('.value_range') or (name.endswith('.value') and name != 'cubeMathType.value') or name.endswith('.shape')
857
+ }
858
+
859
+ if fixed_value_factors:
860
+ print(f"[INFO] 过滤固定值因子: {len(fixed_value_factors)}个")
861
+ if filtered_continuous:
862
+ print(f"[INFO] 过滤连续值/派生因子: {len(filtered_continuous)}个")
863
+ print(f"[INFO] 保留离散多值因子: {len(multi_value_factors)}个")
864
+
865
+ factor_names = sorted(multi_value_factors.keys())
866
+ pairwise_combinations = set()
867
+
868
+ for i in range(len(factor_names)):
869
+ for j in range(i + 1, len(factor_names)):
870
+ factor1_name = factor_names[i]
871
+ factor2_name = factor_names[j]
872
+
873
+ values1 = multi_value_factors[factor1_name]
874
+ values2 = multi_value_factors[factor2_name]
875
+
876
+ for v1 in values1:
877
+ for v2 in values2:
878
+ v1_key = make_hashable(v1)
879
+ v2_key = make_hashable(v2)
880
+
881
+ pair = (
882
+ (factor1_name, v1_key),
883
+ (factor2_name, v2_key)
884
+ )
885
+ pairwise_combinations.add(pair)
886
+
887
+ return pairwise_combinations
888
+
889
+
890
+ def select_cases_L1(df, pairwise_combinations, all_factor_values, verbose=False, sample_size=None):
891
+ """
892
+ L1: 使用贪心算法选择覆盖所有两两组合的用例集(优化版:只考虑离散因子)
893
+
894
+ Args:
895
+ df: 因子值 DataFrame
896
+ pairwise_combinations: 所有两两组合
897
+ all_factor_values: 所有因子及其值
898
+ verbose: 是否输出详细信息
899
+ sample_size: 每次迭代采样的候选用例数量(None表示全部考虑)
900
+
901
+ Returns:
902
+ Tuple[List[int], Dict]: (选中的用例索引列表, 覆盖度信息)
903
+
904
+ 优化说明:
905
+ 1. 只考虑离散因子(dtype, dimensions, exist, format, 枚举值等)
906
+ 2. 过滤连续值因子(value_range)和派生因子(value, shape)
907
+ """
908
+ # 定义离散因子模式
909
+ discrete_patterns = [
910
+ '.dtype', # 数据类型(离散)
911
+ '.dimensions', # 维度数(离散)
912
+ '.exist', # 存在性(离散)
913
+ '.format', # 数据格式(离散)
914
+ 'cubeMathType.value', # 枚举值(离散)
915
+ ]
916
+
917
+ def is_discrete_factor(factor_name):
918
+ """判断是否为离散因子"""
919
+ # 排除派生因子和连续值因子
920
+ if factor_name.endswith('.value') and not factor_name == 'cubeMathType.value':
921
+ return False
922
+ if factor_name.endswith('.shape'):
923
+ return False
924
+ if factor_name.endswith('.value_range'):
925
+ return False
926
+
927
+ # 保留离散因子
928
+ for pattern in discrete_patterns:
929
+ if pattern in factor_name:
930
+ return True
931
+
932
+ return False
933
+
934
+ # 过滤离散因子
935
+ discrete_factors = {
936
+ name: values
937
+ for name, values in all_factor_values.items()
938
+ if is_discrete_factor(name)
939
+ }
940
+
941
+ # 过滤只有1个值的因子
942
+ multi_value_factors = {
943
+ name: values
944
+ for name, values in discrete_factors.items()
945
+ if len(values) > 1
946
+ }
947
+
948
+ if verbose:
949
+ print(f"[INFO] 提取离散因子: {len(multi_value_factors)}个(已过滤连续值和派生因子)")
950
+ print(f"[INFO] 因子值总数: {sum(len(v) for v in multi_value_factors.values())}")
951
+
952
+ selected_indices = []
953
+ uncovered = deepcopy(pairwise_combinations)
954
+ covered = set()
955
+
956
+ factor_names = [col for col in df.columns if col in multi_value_factors]
957
+ all_indices = set(df.index.tolist())
958
+
959
+ iteration = 0
960
+ while uncovered:
961
+ iteration += 1
962
+ best_idx = None
963
+ best_new_coverage = 0
964
+ best_covered_pairs = set()
965
+
966
+ # 采样候选用例以加速
967
+ candidate_indices = list(all_indices - set(selected_indices))
968
+ if sample_size and len(candidate_indices) > sample_size:
969
+ candidate_indices = random.sample(candidate_indices, sample_size)
970
+
971
+ for idx in candidate_indices:
972
+ row = df.loc[idx]
973
+
974
+ covered_pairs = set()
975
+
976
+ for i in range(len(factor_names)):
977
+ for j in range(i + 1, len(factor_names)):
978
+ factor1_name = factor_names[i]
979
+ factor2_name = factor_names[j]
980
+
981
+ v1 = row[factor1_name]
982
+ v2 = row[factor2_name]
983
+
984
+ v1_key = make_hashable(v1)
985
+ v2_key = make_hashable(v2)
986
+
987
+ pair = (
988
+ (factor1_name, v1_key),
989
+ (factor2_name, v2_key)
990
+ )
991
+
992
+ if pair in uncovered:
993
+ covered_pairs.add(pair)
994
+
995
+ if len(covered_pairs) > best_new_coverage:
996
+ best_new_coverage = len(covered_pairs)
997
+ best_idx = idx
998
+ best_covered_pairs = covered_pairs
999
+
1000
+ if best_idx is None or best_new_coverage == 0:
1001
+ break
1002
+
1003
+ selected_indices.append(best_idx)
1004
+ covered.update(best_covered_pairs)
1005
+ uncovered -= best_covered_pairs
1006
+
1007
+ if verbose and iteration % 10 == 0:
1008
+ print(f"[INFO] L1迭代{iteration}: 选择用例{best_idx}, 新覆盖{best_new_coverage}个两两组合, 剩余{len(uncovered)}")
1009
+
1010
+ if verbose:
1011
+ print(f"[INFO] 完成用例选择: {len(selected_indices)}个用例")
1012
+ print(f"[INFO] 两两组合覆盖: {len(covered)}/{len(pairwise_combinations)} ({len(covered)/len(pairwise_combinations)*100:.2f}%)")
1013
+
1014
+ coverage_info = {
1015
+ 'total_pairwise': len(pairwise_combinations),
1016
+ 'covered_pairwise': len(covered),
1017
+ 'uncovered_pairwise': len(uncovered),
1018
+ 'coverage_rate': len(covered) / len(pairwise_combinations) * 100 if pairwise_combinations else 0,
1019
+ 'selected_count': len(selected_indices)
1020
+ }
1021
+
1022
+ return selected_indices, coverage_info
1023
+
1024
+
1025
+ def pad_cases(selected_indices, target_count, seed=None):
1026
+ """
1027
+ 补齐用例到目标数量(L1专用)
1028
+
1029
+ Args:
1030
+ selected_indices: 已选中的用例索引列表
1031
+ target_count: 目标用例数量
1032
+ seed: 随机数种子
1033
+
1034
+ Returns:
1035
+ List[int]: 补齐后的用例索引列表
1036
+ """
1037
+ if len(selected_indices) >= target_count:
1038
+ return selected_indices[:target_count]
1039
+
1040
+ if seed is not None:
1041
+ random.seed(seed)
1042
+
1043
+ need_pad = target_count - len(selected_indices)
1044
+ padded_indices = selected_indices.copy()
1045
+
1046
+ for _ in range(need_pad):
1047
+ random_idx = random.choice(selected_indices)
1048
+ padded_indices.append(random_idx)
1049
+
1050
+ return padded_indices
1051
+
1052
+
1053
+ def generate_L1_report(all_factor_values, pairwise_combinations, coverage_info, target_count):
1054
+ """生成L1覆盖度报告"""
1055
+ selected_count = coverage_info['selected_count']
1056
+ padded_count = max(0, target_count - selected_count)
1057
+
1058
+ report = {
1059
+ 'summary': {
1060
+ 'level': 'L1',
1061
+ 'strategy': 'pairwise_coverage',
1062
+ 'total_factors': len(all_factor_values),
1063
+ 'total_factor_values': sum(len(v) for v in all_factor_values.values()),
1064
+ 'total_pairwise_combinations': coverage_info['total_pairwise'],
1065
+ 'covered_pairwise_combinations': coverage_info['covered_pairwise'],
1066
+ 'uncovered_pairwise_combinations': coverage_info['uncovered_pairwise'],
1067
+ 'coverage_rate': f"{coverage_info['coverage_rate']:.2f}%",
1068
+ 'selected_case_count': selected_count,
1069
+ 'target_case_count': target_count,
1070
+ 'padded_case_count': padded_count
1071
+ },
1072
+ 'factor_statistics': {}
1073
+ }
1074
+
1075
+ for factor_name, values in all_factor_values.items():
1076
+ report['factor_statistics'][factor_name] = {
1077
+ 'value_count': len(values),
1078
+ 'values': sorted([str(v) for v in values])
1079
+ }
1080
+
1081
+ return report
1082
+
1083
+
1084
+ # ============ 共享工具函数 ============
1085
+
1086
+ def load_yaml(file_path):
1087
+ """加载YAML文件"""
1088
+ with open(file_path, 'r', encoding='utf-8') as f:
1089
+ return yaml.safe_load(f)
1090
+
1091
+
1092
+ def extract_all_factor_values(factors_dict, df=None):
1093
+ """
1094
+ 提取所有需要覆盖的因子值
1095
+
1096
+ 策略:
1097
+ 1. 从 CSV DataFrame 中提取每个因子的实际值(如果提供了 df)
1098
+ 2. 过滤 .shape 因子(由 dimensions 动态生成)
1099
+ 3. 处理 value_range_{dtype} 模式:
1100
+ - YAML 中定义的是按 dtype 分组的可选值(如 value_range_float16)
1101
+ - CSV 中的列名是统一的 value_range
1102
+ - 应该从 CSV 中提取 value_range 列的实际值,而不是合并 YAML 中的所有可能值
1103
+
1104
+ Args:
1105
+ factors_dict: YAML 中的因子定义
1106
+ df: CSV DataFrame(如果提供,从中提取实际值)
1107
+
1108
+ Returns:
1109
+ Dict[str, Set]: 因子名 -> 值集合
1110
+ """
1111
+ all_factor_values = {}
1112
+ value_range_dtype_pattern = re.compile(r'^(.+)\.value_range_([a-z0-9]+)$')
1113
+
1114
+ # 收集所有因子名(过滤 shape,处理 value_range_{dtype})
1115
+ factor_names_from_yaml = set()
1116
+ for param_name, param_info in factors_dict.items():
1117
+ factors = param_info.get('factors', {})
1118
+
1119
+ for factor_name in factors.keys():
1120
+ # 过滤 shape 因子
1121
+ if '.shape' in factor_name:
1122
+ continue
1123
+
1124
+ # 检测 value_range_{dtype} 模式
1125
+ match = value_range_dtype_pattern.match(factor_name)
1126
+ if match:
1127
+ # 转换为统一的 value_range 名称
1128
+ base_factor_name = f"{match.group(1)}.value_range"
1129
+ factor_names_from_yaml.add(base_factor_name)
1130
+ else:
1131
+ factor_names_from_yaml.add(factor_name)
1132
+
1133
+ # 如果提供了 DataFrame,从中提取实际值
1134
+ if df is not None:
1135
+ for factor_name in factor_names_from_yaml:
1136
+ if factor_name in df.columns:
1137
+ # 从 CSV 列中提取唯一值
1138
+ unique_values = df[factor_name].unique()
1139
+ all_factor_values[factor_name] = set(
1140
+ make_hashable(v) for v in unique_values if not pd.isna(v)
1141
+ )
1142
+ else:
1143
+ # 从 YAML 定义中提取(兼容旧行为)
1144
+ for param_name, param_info in factors_dict.items():
1145
+ factors = param_info.get('factors', {})
1146
+
1147
+ for factor_name, factor_values in factors.items():
1148
+ if '.shape' in factor_name:
1149
+ continue
1150
+
1151
+ match = value_range_dtype_pattern.match(factor_name)
1152
+ if match:
1153
+ base_factor_name = f"{match.group(1)}.value_range"
1154
+ if base_factor_name not in all_factor_values:
1155
+ all_factor_values[base_factor_name] = set()
1156
+ all_factor_values[base_factor_name].update(
1157
+ make_hashable(v) for v in factor_values
1158
+ )
1159
+ else:
1160
+ all_factor_values[factor_name] = set(
1161
+ make_hashable(v) for v in factor_values
1162
+ )
1163
+
1164
+ return all_factor_values
1165
+
1166
+
1167
+ def make_hashable(value):
1168
+ """将值转换为可哈希的类型"""
1169
+ if isinstance(value, list):
1170
+ return tuple(value)
1171
+ elif isinstance(value, dict):
1172
+ return tuple(sorted(value.items()))
1173
+ else:
1174
+ return value
1175
+
1176
+
1177
+ def extract_aclnn_name(args):
1178
+ """从参数定义中提取算子名称"""
1179
+ # 1. 优先使用命令行指定的名称
1180
+ if args.aclnn_name:
1181
+ return args.aclnn_name
1182
+
1183
+ # 2. 从参数定义中获取
1184
+ param_def_path = Path(args.param_def)
1185
+ try:
1186
+ with open(param_def_path, 'r', encoding='utf-8') as f:
1187
+ param_def = yaml.safe_load(f)
1188
+ if param_def.get('aclnn_name'):
1189
+ return param_def.get('aclnn_name')
1190
+ except Exception:
1191
+ pass
1192
+
1193
+ # 3. 从文件路径中提取(查找包含 aclnn 的目录名)
1194
+ for part in param_def_path.parts:
1195
+ if part.startswith('aclnn'):
1196
+ return part
1197
+
1198
+ return 'UnknownOperator'
1199
+
1200
+
1201
+ def get_output_filenames(report_output, case_output, level, is_batch, aclnn_name):
1202
+ """
1203
+ 确定输出文件名
1204
+
1205
+ Args:
1206
+ report_output: 用户指定的报告文件名(可能为None)
1207
+ case_output: 用户指定的用例文件名(可能为None)
1208
+ level: 当前级别 (L0/L1)
1209
+ is_batch: 是否批量生成
1210
+
1211
+ Returns:
1212
+ Tuple[str, str]: (报告文件名, 用例文件名)
1213
+ """
1214
+ # 报告文件名
1215
+ if report_output:
1216
+ report_name = report_output
1217
+ if is_batch:
1218
+ report_name = f"{aclnn_name}_{level}_{report_name}"
1219
+ else:
1220
+ if is_batch:
1221
+ report_name = f"{aclnn_name}_{level}_coverage_report.yaml"
1222
+ else:
1223
+ report_name = f"{aclnn_name}_{level.lower()}_coverage_report.yaml"
1224
+
1225
+ # 用例文件名
1226
+ if case_output:
1227
+ case_name = case_output
1228
+ if is_batch:
1229
+ case_name = f"{level}_{case_name}"
1230
+ else:
1231
+ if is_batch:
1232
+ case_name = f"{level}_test_cases.csv"
1233
+ else:
1234
+ case_name = f"{level.lower()}_test_cases.csv"
1235
+
1236
+ return report_name, case_name
1237
+
1238
+
1239
+ def _parse_tensor_length(row, param_name):
1240
+ length_raw = row.get(f"{param_name}.length", 1)
1241
+ try:
1242
+ return int(float(str(length_raw))) if pd.notna(length_raw) else 1
1243
+ except (ValueError, TypeError):
1244
+ return 1
1245
+
1246
+
1247
+ def _resolve_format(fmt_raw):
1248
+ if isinstance(fmt_raw, list):
1249
+ return random.choice(fmt_raw) if fmt_raw else fmt_raw
1250
+ return fmt_raw
1251
+
1252
+
1253
+ def _is_attr_param(io_type, param_type):
1254
+ if io_type not in ['input', 'output']:
1255
+ return True
1256
+ if io_type == 'input' and param_type not in ['aclTensor', 'aclTensorList']:
1257
+ return True
1258
+ return False
1259
+
1260
+
1261
+ def _process_attributes(row, param_def):
1262
+ attrs = {}
1263
+ attr_idx = 0
1264
+ for param_name, param_info in param_def.items():
1265
+ param_type = param_info.get('type', '')
1266
+ io_type = param_info.get('io_type', '')
1267
+ if not _is_attr_param(io_type, param_type):
1268
+ continue
1269
+ exist_col = f"{param_name}.exist"
1270
+ if exist_col in row.index and row[exist_col] == False:
1271
+ continue
1272
+ attr_prefix = '' if attr_idx == 0 else f'.{attr_idx}'
1273
+ attrs[f'attr_name{attr_prefix}'] = param_name
1274
+ attrs[f'attr_type{attr_prefix}'] = get_attr_type(param_type)
1275
+ attrs[f'attr_dtype{attr_prefix}'] = get_attr_dtype(
1276
+ param_type, row.get(f"{param_name}.dtype", '')
1277
+ )
1278
+ attrs[f'attr_value{attr_prefix}'] = format_attr_value(
1279
+ row.get(f"{param_name}.value", '')
1280
+ )
1281
+ attr_idx += 1
1282
+ return attrs
1283
+
1284
+
1285
+ def parse_list_value(value):
1286
+ """解析列表值"""
1287
+ if isinstance(value, str):
1288
+ try:
1289
+ return literal_eval(value)
1290
+ except (ValueError, SyntaxError):
1291
+ return value
1292
+ return value
1293
+
1294
+
1295
+ def parse_format_value(fmt_raw):
1296
+ if isinstance(fmt_raw, list):
1297
+ return fmt_raw
1298
+ if not isinstance(fmt_raw, str):
1299
+ return [str(fmt_raw)]
1300
+ try:
1301
+ parsed = literal_eval(fmt_raw)
1302
+ if isinstance(parsed, list):
1303
+ if parsed and all(isinstance(item, str) for item in parsed):
1304
+ return parsed
1305
+ if parsed and all(isinstance(item, list) for item in parsed):
1306
+ return parsed
1307
+ return [fmt_raw]
1308
+ return [fmt_raw]
1309
+ except (ValueError, SyntaxError):
1310
+ return [fmt_raw]
1311
+
1312
+
1313
+ def expand_for_tensorlist(values, length):
1314
+ """将值列表扩展为指定长度(用于TensorList的format/range/dtype等字段)
1315
+
1316
+ 对于字符串元素(如format):['ND'] -> ['ND', 'ND', ...]
1317
+ 对于非字符串元素(如range/dtype):[[min, max]] -> [[min, max], [min, max], ...]
1318
+ """
1319
+ if isinstance(values, list) and len(values) == 1 and isinstance(values[0], str):
1320
+ return values * length
1321
+ elif isinstance(values, list) and len(values) == 1 and isinstance(values[0], list):
1322
+ return [values[0] for _ in range(length)]
1323
+ elif isinstance(values, list):
1324
+ if len(values) >= length:
1325
+ return values[:length]
1326
+ else:
1327
+ return values * (length // len(values)) + values[:length % len(values)]
1328
+ else:
1329
+ return [values] * length
1330
+
1331
+
1332
+ def expand_format_for_tensorlist(fmt, length):
1333
+ return expand_for_tensorlist(fmt, length)
1334
+
1335
+
1336
+ def _format_range_value(v):
1337
+ import math
1338
+ if isinstance(v, float) and v == 0.0:
1339
+ if math.copysign(1, v) < 0:
1340
+ return '-0'
1341
+ return '+0'
1342
+ if isinstance(v, str) and v in ('+0', '-0'):
1343
+ return v
1344
+ return str(v)
1345
+
1346
+
1347
+ def format_list(items):
1348
+ formatted = []
1349
+ for item in items:
1350
+ if isinstance(item, (list, tuple)):
1351
+ inner = ','.join(_format_range_value(v) for v in item)
1352
+ formatted.append(f'[{inner}]')
1353
+ else:
1354
+ formatted.append(str(item))
1355
+ return f'[{",".join(formatted)}]'
1356
+
1357
+
1358
+ def format_quoted_list(items):
1359
+ if not items:
1360
+ return "[]"
1361
+ formatted = []
1362
+ for item in items:
1363
+ if isinstance(item, list):
1364
+ formatted.append(format_quoted_list(item))
1365
+ else:
1366
+ formatted.append(f"'{item}'")
1367
+ return f"[{','.join(formatted)}]"
1368
+
1369
+
1370
+ def convert_dtype_format(dtype_str):
1371
+ """将数据类型从 float32/float16/bfloat16/float64 转换为 fp32/fp16/bf16/fp64"""
1372
+ dtype_mapping = {
1373
+ 'float32': 'fp32',
1374
+ 'float16': 'fp16',
1375
+ 'bfloat16': 'bf16',
1376
+ 'float64': 'fp64'
1377
+ }
1378
+ return dtype_mapping.get(dtype_str, dtype_str)
1379
+
1380
+
1381
+ def get_attr_type(param_type):
1382
+ """获取属性类型"""
1383
+ type_mapping = {
1384
+ 'aclScalar': 'scalar',
1385
+ 'aclScalarList': 'scalar_list',
1386
+ 'aclIntArray': 'int_array',
1387
+ 'aclFloatArray': 'float_array',
1388
+ 'aclBoolArray': 'bool_array',
1389
+ 'int4_t': 'buildins',
1390
+ 'int8_t': 'buildins',
1391
+ 'int16_t': 'buildins',
1392
+ 'int32_t': 'buildins',
1393
+ 'int64_t': 'buildins',
1394
+ 'uint1_t': 'buildins',
1395
+ 'uint8_t': 'buildins',
1396
+ 'uint16_t': 'buildins',
1397
+ 'uint32_t': 'buildins',
1398
+ 'uint64_t': 'buildins',
1399
+ 'float': 'buildins',
1400
+ 'double': 'buildins',
1401
+ 'float16': 'buildins',
1402
+ 'bfloat16': 'buildins',
1403
+ 'float32': 'buildins',
1404
+ 'bool': 'buildins',
1405
+ 'char': 'buildins',
1406
+ 'string': 'buildins',
1407
+ }
1408
+ return type_mapping.get(param_type, 'buildins')
1409
+
1410
+
1411
+ def get_attr_dtype(param_type, dtype_value):
1412
+ """获取属性dtype"""
1413
+ type_dtype_map = {
1414
+ 'int4_t': 'int4', 'int8_t': 'int8', 'int16_t': 'int16',
1415
+ 'int32_t': 'int32', 'int64_t': 'int64', 'uint1_t': 'uint1',
1416
+ 'uint8_t': 'uint8', 'uint16_t': 'uint16', 'uint32_t': 'uint32',
1417
+ 'uint64_t': 'uint64', 'bool': 'bool', 'float': 'fp32',
1418
+ 'float16': 'fp16', 'bfloat16': 'bf16', 'float32': 'fp32',
1419
+ 'double': 'double', 'char': 'int8', 'string': 'string',
1420
+ }
1421
+ if param_type in ('aclIntArray', 'aclFloatArray', 'aclBoolArray', 'aclScalarList'):
1422
+ return 'list'
1423
+ if param_type == 'aclScalar':
1424
+ dtype = dtype_value if dtype_value else 'float32'
1425
+ elif param_type in type_dtype_map:
1426
+ dtype = type_dtype_map[param_type]
1427
+ else:
1428
+ dtype = param_type
1429
+ return convert_dtype_format(dtype)
1430
+
1431
+
1432
+ def format_attr_value(value):
1433
+ """格式化属性值"""
1434
+ import math
1435
+ if pd.isna(value):
1436
+ return ''
1437
+ if isinstance(value, bool):
1438
+ return str(value).lower()
1439
+ if isinstance(value, str) and value in ('+0', '-0'):
1440
+ return value
1441
+ if isinstance(value, (list, tuple)):
1442
+ return str(list(value))
1443
+ if isinstance(value, float):
1444
+ if value == 0.0:
1445
+ if math.copysign(1, value) < 0:
1446
+ return '-0'
1447
+ elif math.copysign(1, value) > 0:
1448
+ return '+0'
1449
+ elif value != value:
1450
+ return "'nan'"
1451
+ elif value == float('inf'):
1452
+ return "'inf'"
1453
+ elif value == float('-inf'):
1454
+ return "'-inf'"
1455
+ return str(value)
1456
+
1457
+
1458
+ def save_results(params: SaveResultsParams):
1459
+ """保存结果文件"""
1460
+ output_dir = Path(params.output_dir)
1461
+ output_dir.mkdir(parents=True, exist_ok=True)
1462
+
1463
+ # 保存覆盖度报告
1464
+ report_path = output_dir / params.report_file
1465
+ with open(report_path, 'w', encoding='utf-8') as f:
1466
+ yaml.dump(params.report, f, allow_unicode=True, default_flow_style=False, sort_keys=False)
1467
+
1468
+ # 保存ttk用例csv
1469
+ ttk_csv = params.aclnn_name + "_" + str(params.case_file).split(".")[0] + ".csv"
1470
+ case_path_ = output_dir / ttk_csv
1471
+ params.case_df_ttk.to_csv(case_path_, index=False)
1472
+
1473
+ if params.verbose:
1474
+ logging.info(f"生成覆盖度报告: {report_path}")
1475
+ logging.info(f"生成用例: {case_path_} ({len(params.case_df_ttk)}条)")
1476
+
1477
+
1478
+ def convert_to_ttk_format(df, param_def, aclnn_name, case_level):
1479
+ """
1480
+ 转换为TTK用例CSV格式
1481
+ """
1482
+ cases = []
1483
+
1484
+ # 统一参数格式
1485
+ if isinstance(param_def.get('parameters'), list):
1486
+ params_dict = {p['name']: p for p in param_def['parameters'] if p.get('name')}
1487
+ param_def = params_dict
1488
+
1489
+ param_names = list(param_def.keys())
1490
+
1491
+ # 逐行生成用例
1492
+ for idx, row in df.iterrows():
1493
+ ctx = TtkProcessContext(
1494
+ row=row,
1495
+ idx=idx,
1496
+ param_def=param_def,
1497
+ param_names=param_names,
1498
+ aclnn_name=aclnn_name,
1499
+ case_level=case_level
1500
+ )
1501
+ case = _process_single_ttk_case(ctx)
1502
+ cases.append(case)
1503
+
1504
+ # 列定义
1505
+ columns = [
1506
+ 'testcase_name', 'api_name', 'tensor_view_shapes', 'tensor_dtypes',
1507
+ 'scalar_dtypes', 'attributes', 'output_tensor_indexes',
1508
+ 'precision_tolerances', 'absolute_precision', 'input_data_ranges',
1509
+ 'scalar_data_ranges', 'tensor_list_distribution'
1510
+ ]
1511
+
1512
+ return pd.DataFrame(cases)[columns]
1513
+
1514
+
1515
+ def _process_single_ttk_case(ctx: TtkProcessContext):
1516
+ """处理单行数据,生成单个 TTK 用例"""
1517
+ testcase_name = f"{ctx.aclnn_name}_{ctx.case_level}_{ctx.idx+1:03d}"
1518
+ api_name = ctx.aclnn_name
1519
+ case = _init_ttk_case_base(testcase_name, api_name)
1520
+
1521
+ # 初始化容器
1522
+ input_shapes, input_dtypes, input_ranges = [], [], []
1523
+ output_shapes, output_dtypes, output_indexes = [], [], []
1524
+ scalar_dtypes_list, scalar_ranges_list, attrs_dict = [], [], {}
1525
+ tensor_list_lengths = []
1526
+
1527
+ for param_name, param_info in ctx.param_def.items():
1528
+ io_type = param_info.get('io_type', 'input')
1529
+ param_type = param_info.get('type', '')
1530
+ exist_col = f"{param_name}.exist"
1531
+
1532
+ if exist_col in ctx.row and not ctx.row[exist_col]:
1533
+ continue
1534
+
1535
+ data = TensorProcessData(
1536
+ input_shapes=input_shapes,
1537
+ input_dtypes=input_dtypes,
1538
+ input_ranges=input_ranges,
1539
+ output_shapes=output_shapes,
1540
+ output_dtypes=output_dtypes,
1541
+ output_indexes=output_indexes,
1542
+ tensor_list_lengths=tensor_list_lengths
1543
+ )
1544
+
1545
+ if param_type == 'aclTensor':
1546
+ _process_acl_tensor(ctx.row, param_name, io_type, data, ctx.param_names)
1547
+ elif param_type == 'aclTensorList':
1548
+ _process_acl_tensor_list(ctx.row, param_name, io_type, data, ctx.param_names)
1549
+ else:
1550
+ _process_scalar_and_attrs(ctx.row, param_name, param_type, scalar_dtypes_list, attrs_dict)
1551
+
1552
+ # 封装并构建用例
1553
+ data = TtkCaseData(
1554
+ input_shapes=input_shapes,
1555
+ input_dtypes=input_dtypes,
1556
+ input_ranges=input_ranges,
1557
+ output_shapes=output_shapes,
1558
+ output_dtypes=output_dtypes,
1559
+ output_indexes=output_indexes,
1560
+ scalar_dtypes_list=scalar_dtypes_list,
1561
+ attrs_dict=attrs_dict,
1562
+ tensor_list_lengths=tensor_list_lengths
1563
+ )
1564
+ _build_ttk_case_data(case, data)
1565
+ return case
1566
+
1567
+
1568
+ def _process_acl_tensor(row, param_name, io_type, data: TensorProcessData, param_names):
1569
+ """处理单个 aclTensor 类型参数"""
1570
+ shape = parse_list_value(row.get(f"{param_name}.shape", '[]'))
1571
+ dtype = row.get(f"{param_name}.dtype", 'float32')
1572
+
1573
+ if io_type == 'input':
1574
+ value_range = parse_list_value(row.get(f"{param_name}.value_range", '[]'))
1575
+ data.input_shapes.append(shape)
1576
+ data.input_dtypes.append(dtype)
1577
+ data.input_ranges.append(value_range if value_range else [-2, 2])
1578
+ else:
1579
+ data.output_shapes.append(shape)
1580
+ data.output_dtypes.append(dtype)
1581
+ data.output_indexes.append(param_names.index(param_name))
1582
+
1583
+
1584
+ def _process_acl_tensor_list(row, param_name, io_type, data: TensorProcessData, param_names):
1585
+ """处理 aclTensorList 类型参数"""
1586
+ shape_list = parse_list_value(row.get(f"{param_name}.shape_list", '[]'))
1587
+ dtype = row.get(f"{param_name}.dtype", 'float32')
1588
+ length = _parse_tensor_length(row, param_name)
1589
+
1590
+ if io_type == 'input':
1591
+ value_range = parse_list_value(row.get(f"{param_name}.value_range", '[]'))
1592
+ single_range = value_range if value_range else [-2, 2]
1593
+ data.input_shapes.append(shape_list)
1594
+ data.input_dtypes.append(tuple([dtype] * length))
1595
+ data.input_ranges.append(tuple([single_range] * length))
1596
+ else:
1597
+ data.output_shapes.append(shape_list)
1598
+ data.output_dtypes.append(tuple([dtype] * length))
1599
+ data.output_indexes.append(param_names.index(param_name))
1600
+
1601
+ data.tensor_list_lengths.append(length)
1602
+
1603
+
1604
+ def _process_scalar_and_attrs(row, param_name, param_type, scalar_dtypes_list, attrs_dict):
1605
+ """处理标量、属性类型参数"""
1606
+ if param_type == 'aclScalar':
1607
+ dtype = row.get(f"{param_name}.dtype", 'float')
1608
+ scalar_dtypes_list.append(dtype)
1609
+ value = row.get(f"{param_name}.value", '')
1610
+ if pd.notna(value) and value != '':
1611
+ attrs_dict[param_name] = format_ttk_attr_value(value, param_type)
1612
+ return
1613
+
1614
+ # 数组 / 列表类型
1615
+ if param_type in ['aclIntArray', 'aclFloatArray', 'aclBoolArray', 'aclScalarList']:
1616
+ value = row.get(f"{param_name}.value", '')
1617
+ if pd.notna(value) and value != '':
1618
+ attrs_dict[param_name] = format_ttk_attr_value(value, param_type)
1619
+ return
1620
+
1621
+ # 基础类型
1622
+ basic_types = [
1623
+ 'int4_t', 'int8_t', 'int16_t', 'int32_t', 'int64_t',
1624
+ 'uint1_t', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
1625
+ 'float', 'double', 'float16', 'bfloat16', 'float32', 'bool', 'char', 'string'
1626
+ ]
1627
+ if param_type in basic_types:
1628
+ value = row.get(f"{param_name}.value", '')
1629
+ if pd.notna(value) and value != '':
1630
+ attrs_dict[param_name] = format_ttk_attr_value(value, param_type)
1631
+
1632
+
1633
+ def _build_ttk_case_data(case, data: TtkCaseData):
1634
+ """填充 TTK 用例字段(L0/L1 和 L2 共用)"""
1635
+ all_tensor_shapes = data.input_shapes + data.output_shapes
1636
+ all_tensor_dtypes = data.input_dtypes + data.output_dtypes
1637
+
1638
+ case['tensor_view_shapes'] = format_ttk_tuple(all_tensor_shapes)
1639
+ case['tensor_dtypes'] = format_ttk_tuple_str(all_tensor_dtypes)
1640
+
1641
+ if data.scalar_dtypes_list:
1642
+ case['scalar_dtypes'] = format_ttk_tuple_str(data.scalar_dtypes_list)
1643
+ if data.attrs_dict:
1644
+ case['attributes'] = format_ttk_dict(data.attrs_dict)
1645
+ if data.output_indexes:
1646
+ num_input = len(data.input_dtypes)
1647
+ output_pos = [num_input + i for i in range(len(data.output_indexes))]
1648
+ case['output_tensor_indexes'] = format_ttk_tuple(output_pos)
1649
+ if data.input_ranges:
1650
+ case['input_data_ranges'] = format_ttk_tuple(data.input_ranges)
1651
+ if data.tensor_list_lengths:
1652
+ case['tensor_list_distribution'] = format_ttk_tuple(data.tensor_list_lengths)
1653
+
1654
+
1655
+ def _format_number(x):
1656
+ """格式化数值,处理特殊浮点值"""
1657
+ if isinstance(x, float):
1658
+ if x == float('inf'):
1659
+ return 'inf'
1660
+ elif x == float('-inf'):
1661
+ return '-inf'
1662
+ elif x != x:
1663
+ return 'nan'
1664
+ elif isinstance(x, str):
1665
+ if x == 'inf':
1666
+ return 'inf'
1667
+ elif x == '-inf':
1668
+ return '-inf'
1669
+ elif x == 'nan':
1670
+ return 'nan'
1671
+ elif x == '+0':
1672
+ return '+0'
1673
+ elif x == '-0':
1674
+ return '-0'
1675
+ return str(x)
1676
+
1677
+
1678
+ def format_ttk_tuple(items):
1679
+ """格式化TTK元组格式(递归,支持嵌套子元组、特殊浮点值)
1680
+
1681
+ - aclTensor shape [4,2,2] → (4,2,2,)
1682
+ - aclTensorList shape [[1,4],[1,4]] → ((1,4,),(1,4,),)
1683
+ """
1684
+ if not items:
1685
+ return "()"
1686
+ formatted = []
1687
+ for item in items:
1688
+ if isinstance(item, (list, tuple)):
1689
+ formatted.append(format_ttk_tuple(item))
1690
+ else:
1691
+ formatted.append(_format_number(item))
1692
+ return f"({','.join(formatted)},)"
1693
+
1694
+
1695
+ def format_ttk_tuple_str(items):
1696
+ """格式化字符串元组(支持嵌套子元组)
1697
+
1698
+ - aclTensor dtype 'float32' → ('float32',)
1699
+ - aclTensorList dtype ('float32','float32') → (('float32','float32',),)
1700
+ """
1701
+ if not items:
1702
+ return ""
1703
+ formatted = []
1704
+ for item in items:
1705
+ if isinstance(item, (list, tuple)):
1706
+ inner = ",".join(f"'{x}'" for x in item)
1707
+ formatted.append(f"({inner},)")
1708
+ else:
1709
+ formatted.append(f"'{item}'")
1710
+ return f"({','.join(formatted)},)"
1711
+
1712
+
1713
+ def format_ttk_dict(d):
1714
+ """格式化字典为字符串"""
1715
+ if not d:
1716
+ return ""
1717
+
1718
+ def custom_serializer(obj):
1719
+ if isinstance(obj, complex):
1720
+ return f"({obj.real}+{obj.imag}j)"
1721
+ if isinstance(obj, np.ndarray):
1722
+ return obj.tolist()
1723
+ raise TypeError(f"Object of type {type(obj).__name__} is not JSON serializable")
1724
+
1725
+ return json.dumps(d, ensure_ascii=False, default=custom_serializer)
1726
+
1727
+
1728
+ def format_ttk_attr_value(value, param_type):
1729
+ """格式化TTK属性值"""
1730
+ if pd.isna(value):
1731
+ return ''
1732
+ if isinstance(value, bool):
1733
+ return value
1734
+ if isinstance(value, (list, tuple)):
1735
+ return list(value)
1736
+ try:
1737
+ parsed = literal_eval(str(value))
1738
+ if isinstance(parsed, (list, tuple)):
1739
+ return list(parsed)
1740
+ return parsed
1741
+ except (ValueError, SyntaxError):
1742
+ return str(value)
1743
+
1744
+
1745
+ # ============ L2 异常用例生成函数 ============
1746
+
1747
+ def generate_error_cases(param_def: Dict, factors: Dict, constraints_def: Dict,
1748
+ verbose: bool = False) -> List[Dict]:
1749
+ """
1750
+ 生成异常场景测试用例(L2级别)
1751
+
1752
+ 入口文件:04_测试因子.yaml 和 05_约束定义.yaml
1753
+ 每个异常场景只生成一条用例
1754
+
1755
+ Args:
1756
+ param_def: 参数定义(03_参数定义.yaml)- 用于参数结构信息
1757
+ factors: 测试因子(04_测试因子.yaml)- 用于提取支持的因子值
1758
+ constraints_def: 约束定义(05_约束定义.yaml)- 用于提取约束信息
1759
+ verbose: 详细输出
1760
+
1761
+ Returns:
1762
+ List[Dict]: 异常用例列表
1763
+ """
1764
+ if verbose:
1765
+ logging.info("[INFO] 开始生成异常用例")
1766
+ logging.info("[INFO] 入口文件: 04_测试因子.yaml, 05_约束定义.yaml")
1767
+
1768
+ error_cases = []
1769
+ aclnn_name = param_def.get('aclnn_name', 'UnknownOperator')
1770
+
1771
+ # 从04_测试因子.yaml提取支持的因子值(主要入口)
1772
+ supported_info = extract_supported_info_from_factors(factors)
1773
+ # 从05_约束定义.yaml提取约束信息(辅助入口)
1774
+ constraint_info = extract_constraint_info(constraints_def)
1775
+
1776
+ # 计算不支持的dtype和format
1777
+ unsupported_dtypes = [d for d in ALL_DTYPES if d not in supported_info['dtypes']]
1778
+ unsupported_formats = [f for f in ALL_FORMATS if f not in supported_info['formats']]
1779
+ max_dimensions = constraint_info.get('max_dimensions', 8)
1780
+
1781
+ # 打印不支持信息
1782
+ _print_unsupported_info(verbose, supported_info, unsupported_dtypes, unsupported_formats, constraint_info)
1783
+
1784
+ # 生成各类异常用例
1785
+ dtype_error_cases = generate_dtype_error_cases(param_def, unsupported_dtypes, aclnn_name, verbose)
1786
+ dtype_combo_cases = generate_dtype_combo_error_cases(
1787
+ param_def, supported_info['dtypes'], constraint_info, aclnn_name, verbose
1788
+ )
1789
+ dim_error_cases = generate_dimension_error_cases(param_def, max_dimensions, aclnn_name, verbose)
1790
+ format_error_cases, _ = generate_format_error_cases(param_def, unsupported_formats, aclnn_name, verbose)
1791
+ shape_error_cases = generate_shape_mismatch_cases(param_def, constraint_info, aclnn_name, verbose)
1792
+ empty_tensor_cases = generate_empty_tensor_cases(param_def, aclnn_name, verbose)
1793
+ attr_error_cases = generate_attr_error_cases(param_def, supported_info['dtypes'], aclnn_name, verbose)
1794
+
1795
+ error_cases.extend(dtype_error_cases)
1796
+ error_cases.extend(dtype_combo_cases)
1797
+ error_cases.extend(dim_error_cases)
1798
+ error_cases.extend(format_error_cases)
1799
+ error_cases.extend(shape_error_cases)
1800
+ error_cases.extend(empty_tensor_cases)
1801
+ error_cases.extend(attr_error_cases)
1802
+
1803
+ # 打印统计信息
1804
+ summary = ErrorCaseSummary(
1805
+ dtype_error_cases=dtype_error_cases,
1806
+ dtype_combo_cases=dtype_combo_cases,
1807
+ dim_error_cases=dim_error_cases,
1808
+ format_error_cases=format_error_cases,
1809
+ shape_error_cases=shape_error_cases,
1810
+ empty_tensor_cases=empty_tensor_cases,
1811
+ attr_error_cases=attr_error_cases,
1812
+ )
1813
+ _print_final_error_summary(verbose, summary)
1814
+
1815
+ return error_cases
1816
+
1817
+
1818
+ def _print_unsupported_info(verbose, supported_info, unsupported_dtypes, unsupported_formats, constraint_info):
1819
+ """打印不支持的类型与约束信息"""
1820
+ if not verbose:
1821
+ return
1822
+ logging.info("[INFO] 从04_测试因子.yaml提取:")
1823
+ logging.info(f"[INFO] 支持的dtype: {supported_info['dtypes']}")
1824
+ logging.info(f"[INFO] 支持的format: {supported_info['formats']}")
1825
+ logging.info(f"[INFO] 支持的dimensions: {supported_info['dimensions']}")
1826
+ logging.info(f"[INFO] 不支持的dtype: {unsupported_dtypes}")
1827
+ logging.info(f"[INFO] 不支持的format: {unsupported_formats}")
1828
+ logging.info("[INFO] 从05_约束定义.yaml提取:")
1829
+ logging.info(f"[INFO] 最大维度限制: {constraint_info.get('max_dimensions', 8)}")
1830
+ logging.info(f"[INFO] 约束数量: {constraint_info.get('constraint_count', 0)}")
1831
+
1832
+
1833
+ def _print_final_error_summary(verbose: bool, summary: ErrorCaseSummary):
1834
+ """打印最终异常用例统计"""
1835
+ if not verbose:
1836
+ return
1837
+
1838
+ total = (
1839
+ len(summary.dtype_error_cases)
1840
+ + len(summary.dtype_combo_cases)
1841
+ + len(summary.dim_error_cases)
1842
+ + len(summary.format_error_cases)
1843
+ + len(summary.shape_error_cases)
1844
+ + len(summary.empty_tensor_cases)
1845
+ + len(summary.attr_error_cases)
1846
+ )
1847
+
1848
+ logging.info(f"[INFO] 异常用例生成完成,总数: {total}")
1849
+ logging.info(f"[INFO] dtype异常: {len(summary.dtype_error_cases)}条")
1850
+ logging.info(f"[INFO] dtype组合异常: {len(summary.dtype_combo_cases)}条")
1851
+ logging.info(f"[INFO] 维度异常: {len(summary.dim_error_cases)}条")
1852
+ logging.info(f"[INFO] 格式异常: {len(summary.format_error_cases)}条")
1853
+ logging.info(f"[INFO] 形状异常: {len(summary.shape_error_cases)}条")
1854
+ logging.info(f"[INFO] 空张量异常: {len(summary.empty_tensor_cases)}条")
1855
+ logging.info(f"[INFO] attr属性异常: {len(summary.attr_error_cases)}条")
1856
+
1857
+
1858
+ def _flatten_format_values(format_values: List) -> List:
1859
+ """扁平化format嵌套列表"""
1860
+ flat_formats = []
1861
+ for fv in format_values:
1862
+ if isinstance(fv, list):
1863
+ flat_formats.extend(fv)
1864
+ else:
1865
+ flat_formats.append(fv)
1866
+ return flat_formats
1867
+
1868
+
1869
+ def _collect_factor_items(factor_dict: Dict, param_name: str, target_key: str, target_set: Set):
1870
+ """统一提取因子列表并写入集合"""
1871
+ full_key = f"{param_name}.{target_key}"
1872
+ if full_key not in factor_dict:
1873
+ return
1874
+ values = factor_dict[full_key]
1875
+ if isinstance(values, list):
1876
+ if target_key == "format":
1877
+ flat_items = _flatten_format_values(values)
1878
+ target_set.update(flat_items)
1879
+ else:
1880
+ target_set.update(values)
1881
+
1882
+
1883
+ def extract_supported_info_from_factors(factors: Dict) -> Dict:
1884
+ """
1885
+ 从04_测试因子.yaml提取支持的因子值(主要入口)
1886
+
1887
+ Args:
1888
+ factors: 测试因子(04_测试因子.yaml)
1889
+
1890
+ Returns:
1891
+ Dict: {'dtypes': [...], 'formats': [...], 'dimensions': [...], 'tensor_params': [...], 'scalar_params': [...]}
1892
+ """
1893
+ dtypes: Set = set()
1894
+ formats: Set = set()
1895
+ dimensions: Set = set()
1896
+ tensor_params: List[str] = []
1897
+ scalar_params: List[str] = []
1898
+
1899
+ # 遍历每个参数的因子,最大嵌套深度仅3层
1900
+ for param_name, param_factors in factors.items():
1901
+ if not isinstance(param_factors, dict):
1902
+ continue
1903
+ param_type = param_factors.get("type", "")
1904
+ factor_dict = param_factors.get("factors", {})
1905
+
1906
+ # 统一抽取三类因子数据,消除多层if嵌套
1907
+ _collect_factor_items(factor_dict, param_name, "dtype", dtypes)
1908
+ _collect_factor_items(factor_dict, param_name, "format", formats)
1909
+ _collect_factor_items(factor_dict, param_name, "dimensions", dimensions)
1910
+
1911
+ # 分类记录参数
1912
+ if param_type in ("aclTensor", "aclTensorList"):
1913
+ tensor_params.append(param_name)
1914
+ elif param_type == "aclScalar":
1915
+ scalar_params.append(param_name)
1916
+
1917
+ return {
1918
+ "dtypes": sorted(list(dtypes)),
1919
+ "formats": sorted(list(formats)),
1920
+ "dimensions": sorted(list(dimensions)),
1921
+ "tensor_params": tensor_params,
1922
+ "scalar_params": scalar_params
1923
+ }
1924
+
1925
+
1926
+ def extract_constraint_info(constraints_def: Dict) -> Dict:
1927
+ """
1928
+ 从05_约束定义.yaml提取约束信息(辅助入口)
1929
+
1930
+ Args:
1931
+ constraints_def: 约束定义(05_约束定义.yaml)
1932
+
1933
+ Returns:
1934
+ Dict: {'max_dimensions': int, 'constraint_count': int, 'dtype_constraints': [...], 'shape_constraints': [...]}
1935
+ """
1936
+ max_dimensions = 8 # 默认最大维度
1937
+ dtype_constraints = []
1938
+ shape_constraints = []
1939
+
1940
+ # 提取约束列表
1941
+ constraints = constraints_def.get('constraints', [])
1942
+ constraint_count = len(constraints)
1943
+
1944
+ for constraint in constraints:
1945
+ constraint_type = constraint.get('type', '')
1946
+ target = constraint.get('target', '')
1947
+
1948
+ # 从约束中提取维度限制
1949
+ if 'dim' in target.lower() or 'dimension' in target.lower():
1950
+ # 查找维度约束
1951
+ if constraint_type == 'calculate':
1952
+ expression = constraint.get('expression', '')
1953
+ # 解析维度限制
1954
+
1955
+ # 收集dtype约束
1956
+ if 'dtype' in target.lower():
1957
+ dtype_constraints.append({
1958
+ 'id': constraint.get('id', ''),
1959
+ 'type': constraint_type,
1960
+ 'target': target,
1961
+ 'sources': constraint.get('sources', []),
1962
+ })
1963
+
1964
+ # 收集shape约束
1965
+ if 'shape' in target.lower():
1966
+ shape_constraints.append({
1967
+ 'id': constraint.get('id', ''),
1968
+ 'type': constraint_type,
1969
+ 'target': target,
1970
+ 'sources': constraint.get('sources', []),
1971
+ })
1972
+
1973
+ # 从metadata提取信息
1974
+ metadata = constraints_def.get('metadata', {})
1975
+
1976
+ return {
1977
+ 'max_dimensions': max_dimensions,
1978
+ 'constraint_count': constraint_count,
1979
+ 'dtype_constraints': dtype_constraints,
1980
+ 'shape_constraints': shape_constraints,
1981
+ 'metadata': metadata
1982
+ }
1983
+
1984
+
1985
+ def _process_acl_tensor_v(param, dtypes, formats):
1986
+ """处理 aclTensor 类型参数,提取 dtype、format、维度信息"""
1987
+ # 处理 dtype
1988
+ dtype_ranges = param.get('dtype_with_ranges', [])
1989
+ for dr in dtype_ranges:
1990
+ dtype = dr.get('dtype', '')
1991
+ if dtype:
1992
+ dtypes.add(dtype)
1993
+
1994
+ # 处理 format
1995
+ param_formats = param.get('format', [])
1996
+ if isinstance(param_formats, list):
1997
+ formats.update(param_formats)
1998
+
1999
+ # 处理维度
2000
+ dimensions = param.get('dimensions', [])
2001
+ current_max = 8
2002
+ if dimensions:
2003
+ current_max = max(dimensions) if isinstance(dimensions, list) else dimensions
2004
+ return current_max
2005
+
2006
+
2007
+ def _process_acl_scalar(param, dtypes):
2008
+ """处理 aclScalar 类型参数,提取 dtype"""
2009
+ dtype_values = param.get('dtype_with_values', [])
2010
+ for dv in dtype_values:
2011
+ dtype = dv.get('dtype', '')
2012
+ if dtype:
2013
+ dtypes.add(dtype)
2014
+
2015
+
2016
+ def extract_supported_info(param_def: Dict) -> Dict:
2017
+ """
2018
+ 从参数定义提取支持的dtype和format
2019
+
2020
+ Args:
2021
+ param_def: 参数定义
2022
+
2023
+ Returns:
2024
+ Dict: {'dtypes': [...], 'formats': [...], 'max_dimensions': int}
2025
+ """
2026
+ dtypes = set()
2027
+ formats = set()
2028
+ max_dimensions = 8
2029
+
2030
+ params = param_def.get('parameters', [])
2031
+ if not isinstance(params, list):
2032
+ return {
2033
+ 'dtypes': sorted(list(dtypes)),
2034
+ 'formats': sorted(list(formats)),
2035
+ 'max_dimensions': max_dimensions
2036
+ }
2037
+
2038
+ for param in params:
2039
+ param_type = param.get('type', '')
2040
+ io_type = param.get('io_type', 'input')
2041
+
2042
+ # 只处理输入参数
2043
+ if io_type != 'input':
2044
+ continue
2045
+
2046
+ if param_type == 'aclTensor':
2047
+ dim = _process_acl_tensor_v(param, dtypes, formats)
2048
+ max_dimensions = max(max_dimensions, dim)
2049
+
2050
+ elif param_type == 'aclScalar':
2051
+ _process_acl_scalar(param, dtypes)
2052
+
2053
+ return {
2054
+ 'dtypes': sorted(list(dtypes)),
2055
+ 'formats': sorted(list(formats)),
2056
+ 'max_dimensions': max_dimensions
2057
+ }
2058
+
2059
+
2060
+ def _get_input_params(param_def):
2061
+ """提取输入的 Tensor 和 Scalar 参数(拆分深度)"""
2062
+ tensor_params = []
2063
+ scalar_params = []
2064
+ params = param_def.get('parameters', [])
2065
+
2066
+ if not isinstance(params, list):
2067
+ return tensor_params, scalar_params
2068
+
2069
+ for param in params:
2070
+ if param.get('io_type') != 'input':
2071
+ continue
2072
+
2073
+ param_type = param.get('type')
2074
+ param_name = param.get('name', '')
2075
+
2076
+ if param_type == 'aclTensor':
2077
+ tensor_params.append(param_name)
2078
+ elif param_type == 'aclScalar':
2079
+ scalar_params.append(param_name)
2080
+
2081
+ return tensor_params, scalar_params
2082
+
2083
+
2084
+ def generate_dtype_error_cases(param_def: Dict, unsupported_dtypes: List[str],
2085
+ aclnn_name: str, verbose: bool) -> List[Dict]:
2086
+ """
2087
+ 生成dtype不支持异常用例(每种场景只生成一条)
2088
+
2089
+ Args:
2090
+ param_def: 参数定义
2091
+ unsupported_dtypes: 不支持的dtype列表
2092
+ aclnn_name: 算子名称
2093
+ verbose: 详细输出
2094
+
2095
+ Returns:
2096
+ List[Dict]: dtype异常用例列表
2097
+ """
2098
+ cases = []
2099
+
2100
+ # 提取输入参数(拆分成函数,深度大幅下降)
2101
+ tensor_params, scalar_params = _get_input_params(param_def)
2102
+
2103
+ # 1. Tensor参数dtype不支持
2104
+ if unsupported_dtypes and tensor_params:
2105
+ dtype = unsupported_dtypes[0]
2106
+ param_name = tensor_params[0]
2107
+ case = create_error_case_template(param_def, aclnn_name)
2108
+ case[f"{param_name}.dtype"] = dtype
2109
+ case[f"{param_name}.shape"] = generate_random_shape(3)
2110
+ case['error_type'] = 'dtype_not_supported'
2111
+ case['error_param'] = param_name
2112
+ case['case_name'] = f"{aclnn_name}_{dtype}_random_{param_name}_dtype_exception"
2113
+ cases.append(case)
2114
+
2115
+ # 2. Scalar参数dtype不支持
2116
+ if unsupported_dtypes and scalar_params:
2117
+ dtype = unsupported_dtypes[0]
2118
+ param_name = scalar_params[0]
2119
+ case = create_error_case_template(param_def, aclnn_name)
2120
+ case[f"{param_name}.dtype"] = dtype
2121
+ case[f"{param_name}.value"] = generate_random_value(dtype)
2122
+ case['error_type'] = 'dtype_not_supported'
2123
+ case['error_param'] = param_name
2124
+ case['case_name'] = f"{aclnn_name}_{dtype}_random_{param_name}_dtype_exception"
2125
+ cases.append(case)
2126
+
2127
+ if verbose and cases:
2128
+ logging.info(f"[INFO] 生成dtype不支持异常用例: {len(cases)}条")
2129
+
2130
+ return cases
2131
+
2132
+
2133
+ def generate_dtype_combo_error_cases(param_def: Dict, supported_dtypes: List[str],
2134
+ constraint_info: Dict, aclnn_name: str, verbose: bool) -> List[Dict]:
2135
+ """
2136
+ 生成dtype组合不匹配异常用例(只生成一条)
2137
+
2138
+ Args:
2139
+ param_def: 参数定义
2140
+ supported_dtypes: 支持的dtype列表(从04_测试因子.yaml提取)
2141
+ constraint_info: 约束信息(从05_约束定义.yaml提取)
2142
+ aclnn_name: 算子名称
2143
+ verbose: 详细输出
2144
+
2145
+ Returns:
2146
+ List[Dict]: dtype组合异常用例列表
2147
+ """
2148
+ cases = []
2149
+
2150
+ # 【替换重复代码】调用通用函数
2151
+ tensor_params = _get_tensor_input_params(param_def)
2152
+
2153
+ if len(tensor_params) < 2:
2154
+ return cases
2155
+
2156
+ p0, p1 = tensor_params[0], tensor_params[1]
2157
+
2158
+ # 只生成一条不兼容组合用例(选第一个不兼容组合)
2159
+ for dtype1, dtype2 in INCOMPATIBLE_DTYPE_COMBOS:
2160
+ if dtype1 in supported_dtypes or dtype2 in supported_dtypes:
2161
+ case = create_error_case_template(param_def, aclnn_name)
2162
+ case[f"{p0['name']}.dtype"] = dtype1
2163
+ _set_param_shape(case, p0['name'], p0['type'], generate_random_shape(3))
2164
+ case[f"{p1['name']}.dtype"] = dtype2
2165
+ _set_param_shape(case, p1['name'], p1['type'], generate_random_shape(3))
2166
+ case['error_type'] = 'dtype_combo_mismatch'
2167
+ case['error_param'] = f"{p0['name']},{p1['name']}"
2168
+ case['case_name'] = f"{aclnn_name}_{dtype1}_{dtype2}_random_dtype_combo_exception"
2169
+ cases.append(case)
2170
+ break # 只生成一条
2171
+
2172
+ if verbose and cases:
2173
+ print(f"[INFO] 生成dtype组合异常用例: {len(cases)}条")
2174
+
2175
+ return cases
2176
+
2177
+
2178
+ def generate_dimension_error_cases(param_def: Dict, max_dimensions: int,
2179
+ aclnn_name: str, verbose: bool) -> List[Dict]:
2180
+ """
2181
+ 生成维度超限异常用例(只生成一条)
2182
+ """
2183
+ cases = []
2184
+ overflow_dims = [d for d in OVERFLOW_DIMENSIONS if d > max_dimensions]
2185
+
2186
+ if not overflow_dims:
2187
+ return cases
2188
+
2189
+ if verbose:
2190
+ print(f"[INFO] 维度限制: <= {max_dimensions}, 超限维度: {overflow_dims}")
2191
+
2192
+ # 公共方法
2193
+ tensor_params = _get_tensor_input_params(param_def)
2194
+ if not tensor_params:
2195
+ return cases
2196
+
2197
+ supported_dtype = _get_supported_tensor_dtype(param_def)
2198
+
2199
+ # 生成用例
2200
+ dim = overflow_dims[0]
2201
+ p0 = tensor_params[0]
2202
+ case = create_error_case_template(param_def, aclnn_name)
2203
+ case[f"{p0['name']}.dtype"] = supported_dtype
2204
+ _set_param_shape(case, p0['name'], p0['type'], generate_overflow_shape(dim))
2205
+ case[f"{p0['name']}.dimensions"] = dim
2206
+ case['error_type'] = 'dimension_overflow'
2207
+ case['error_param'] = p0['name']
2208
+ case['case_name'] = f"{aclnn_name}_{supported_dtype}_random_{p0['name']}_dim_exception"
2209
+ cases.append(case)
2210
+
2211
+ if verbose and cases:
2212
+ print(f"[INFO] 生成维度超限异常用例: {len(cases)}条")
2213
+
2214
+ return cases
2215
+
2216
+
2217
+ def generate_format_error_cases(param_def: Dict, unsupported_formats: List[str],
2218
+ aclnn_name: str, verbose: bool) -> Tuple[List[Dict], ErrorCaseConfig]:
2219
+ """
2220
+ 生成格式不支持异常用例(只生成一条)
2221
+ """
2222
+ cases = []
2223
+ if not unsupported_formats:
2224
+ return cases, None
2225
+
2226
+ tensor_params = _get_tensor_input_params(param_def)
2227
+ if not tensor_params:
2228
+ return cases, None
2229
+
2230
+ supported_dtype = _get_supported_tensor_dtype(param_def)
2231
+ format_name = unsupported_formats[0]
2232
+ p0 = tensor_params[0]
2233
+ param_name = p0['name']
2234
+ case_name_str = f"{aclnn_name}_{supported_dtype}_random_{param_name}_format_exception"
2235
+
2236
+ # 通用函数创建用例
2237
+ config = ErrorCaseConfig(
2238
+ param_def=param_def,
2239
+ aclnn_name=aclnn_name,
2240
+ param_name=param_name,
2241
+ supported_dtype=supported_dtype,
2242
+ error_type="format_not_supported",
2243
+ error_param=param_name,
2244
+ case_name=case_name_str,
2245
+ shape_values={param_name: generate_random_shape(3)}
2246
+ )
2247
+ case = _create_and_fill_error_case(config)
2248
+
2249
+ # 单独设置 format
2250
+ case[f"{param_name}.format"] = format_name
2251
+ cases.append(case)
2252
+
2253
+ if verbose and cases:
2254
+ print(f"[INFO] 生成格式不支持异常用例: {len(cases)}条")
2255
+
2256
+ return cases, config
2257
+
2258
+
2259
+ def _get_tensor_input_params(param_def: Dict) -> list:
2260
+ """获取所有输入 Tensor 参数名及类型(含 aclTensor / aclTensorList)
2261
+
2262
+ Returns:
2263
+ list[dict]: 每项为 {'name': str, 'type': str},type 为 'aclTensor' 或 'aclTensorList'
2264
+ """
2265
+ tensor_params = []
2266
+ params = param_def.get('parameters', [])
2267
+ if isinstance(params, list):
2268
+ for param in params:
2269
+ if param.get('io_type') == 'input' and param.get('type') in ('aclTensor', 'aclTensorList'):
2270
+ tensor_params.append({
2271
+ 'name': param.get('name', ''),
2272
+ 'type': param.get('type', '')
2273
+ })
2274
+ return tensor_params
2275
+
2276
+
2277
+ def _set_param_shape(case: Dict, param_name: str, param_type: str, shape, list_length: int = 2):
2278
+ """根据参数类型设置 shape (aclTensor) 或 shape_list (aclTensorList)
2279
+
2280
+ 对于 aclTensorList,将单个 shape 复制为 list_length 份组成 shape_list;
2281
+ 若 shape 本身已是列表的列表(如 [[2,3],[2,3]])则直接使用。
2282
+ """
2283
+ if param_type == 'aclTensorList':
2284
+ if isinstance(shape, list) and shape and isinstance(shape[0], list):
2285
+ shape_list = shape
2286
+ else:
2287
+ shape_list = [list(shape) for _ in range(list_length)]
2288
+ case[f"{param_name}.shape_list"] = shape_list
2289
+ case[f"{param_name}.length"] = len(shape_list)
2290
+ else:
2291
+ case[f"{param_name}.shape"] = shape
2292
+
2293
+
2294
+ def _get_supported_tensor_dtype(param_def: Dict) -> str:
2295
+ """获取 Tensor 支持的第一个 dtype(抽取重复代码)"""
2296
+ params = param_def.get('parameters', [])
2297
+ for param in params:
2298
+ if param.get('type') in ('aclTensor', 'aclTensorList'):
2299
+ dtype_ranges = param.get('dtype_with_ranges', [])
2300
+ if dtype_ranges:
2301
+ return dtype_ranges[0].get('dtype', 'float32')
2302
+ return 'float32'
2303
+
2304
+
2305
+ def generate_shape_mismatch_cases(param_def: Dict, constraint_info: Dict,
2306
+ aclnn_name: str, verbose: bool) -> List[Dict]:
2307
+ """
2308
+ 生成形状不匹配异常用例(只生成一条)
2309
+ """
2310
+ cases = []
2311
+
2312
+ # 公共方法获取参数
2313
+ tensor_params = _get_tensor_input_params(param_def)
2314
+
2315
+ if len(tensor_params) < 2:
2316
+ if verbose:
2317
+ print(f"[INFO] 单Tensor算子,不生成形状不匹配异常用例")
2318
+ return cases
2319
+
2320
+ # 公共方法获取 dtype
2321
+ supported_dtype = _get_supported_tensor_dtype(param_def)
2322
+ p0, p1 = tensor_params[0], tensor_params[1]
2323
+
2324
+ # 生成用例
2325
+ case = create_error_case_template(param_def, aclnn_name)
2326
+ case[f"{p0['name']}.dtype"] = supported_dtype
2327
+ _set_param_shape(case, p0['name'], p0['type'], [2, 3])
2328
+ case[f"{p1['name']}.dtype"] = supported_dtype
2329
+ _set_param_shape(case, p1['name'], p1['type'], [2, 3, 4])
2330
+ case['error_type'] = 'shape_dimension_mismatch'
2331
+ case['error_param'] = f"{p0['name']},{p1['name']}"
2332
+ case['case_name'] = f"{aclnn_name}_{supported_dtype}_ND_ND_ND_exception_shape_dim_error"
2333
+ cases.append(case)
2334
+
2335
+ if verbose and cases:
2336
+ print(f"[INFO] 生成形状不匹配异常用例: {len(cases)}条")
2337
+
2338
+ return cases
2339
+
2340
+
2341
+ def generate_empty_tensor_cases(param_def: Dict, aclnn_name: str,
2342
+ verbose: bool) -> List[Dict]:
2343
+ """
2344
+ 生成空张量异常用例(只生成一条)
2345
+ """
2346
+ cases = []
2347
+ tensor_params = _get_tensor_input_params(param_def)
2348
+
2349
+ if len(tensor_params) < 2:
2350
+ return cases
2351
+
2352
+ supported_dtype = _get_supported_tensor_dtype(param_def)
2353
+ p0, p1 = tensor_params[0], tensor_params[1]
2354
+ case_name_str = f"{aclnn_name}_{supported_dtype}_ND_empty_tensor_exception"
2355
+
2356
+ config = ErrorCaseConfig(
2357
+ param_def=param_def,
2358
+ aclnn_name=aclnn_name,
2359
+ param_name=p0['name'],
2360
+ supported_dtype=supported_dtype,
2361
+ error_type="empty_tensor",
2362
+ error_param=p0['name'],
2363
+ case_name=case_name_str,
2364
+ shape_values={p0['name']: [0, 3], p1['name']: [2, 3]},
2365
+ )
2366
+
2367
+ # 通用函数创建用例
2368
+ case = _create_and_fill_error_case(config)
2369
+
2370
+ cases.append(case)
2371
+
2372
+ if verbose and cases:
2373
+ print(f"[INFO] 生成空张量异常用例: {len(cases)}条")
2374
+
2375
+ return cases
2376
+
2377
+
2378
+ def _create_and_fill_error_case(config: ErrorCaseConfig):
2379
+ """通用:创建并填充异常用例(抽取所有重复代码)"""
2380
+ case = create_error_case_template(config.param_def, config.aclnn_name)
2381
+ case[f"{config.param_name}.dtype"] = config.supported_dtype
2382
+
2383
+ # 如果传了 shape 字典,批量设置 shape(按参数类型选择 .shape / .shape_list)
2384
+ if config.shape_values:
2385
+ param_def_dict = _build_param_def_dict(config.param_def)
2386
+ for pname, shape_val in config.shape_values.items():
2387
+ param_type = param_def_dict.get(pname, {}).get('type', 'aclTensor')
2388
+ _set_param_shape(case, pname, param_type, shape_val)
2389
+
2390
+ case["error_type"] = config.error_type
2391
+ case["error_param"] = config.error_param
2392
+ case["case_name"] = config.case_name
2393
+ return case
2394
+
2395
+
2396
+ def _set_tensor_default(case, param_name, param):
2397
+ """设置 aclTensor 默认值"""
2398
+ dtype_ranges = param.get('dtype_with_ranges', [])
2399
+ if dtype_ranges:
2400
+ case[f"{param_name}.dtype"] = dtype_ranges[0].get('dtype', 'float32')
2401
+ case[f"{param_name}.format"] = param.get('format', ['ND'])[0]
2402
+ case[f"{param_name}.dimensions"] = 2
2403
+ case[f"{param_name}.shape"] = [2, 3]
2404
+ case[f"{param_name}.value_range"] = [-1, 1]
2405
+
2406
+
2407
+ def _set_scalar_default(case, param_name, param):
2408
+ """设置 aclScalar 默认值"""
2409
+ dtype_values = param.get('dtype_with_values', [])
2410
+ if dtype_values:
2411
+ case[f"{param_name}.dtype"] = dtype_values[0].get('dtype', 'float32')
2412
+ case[f"{param_name}.value"] = 1.0
2413
+
2414
+
2415
+ def _set_tensor_list_default(case, param_name, param):
2416
+ """设置 aclTensorList 默认值"""
2417
+ dtype_ranges = param.get('dtype_with_ranges', [])
2418
+ if dtype_ranges:
2419
+ case[f"{param_name}.dtype"] = dtype_ranges[0].get('dtype', 'float32')
2420
+ case[f"{param_name}.length"] = 2
2421
+ case[f"{param_name}.shape_list"] = [[2, 3], [2, 3]]
2422
+
2423
+
2424
+ def _set_array_default(case, param_name, param_type):
2425
+ """设置数组/基础类型默认值"""
2426
+ if param_type in ['aclIntArray', 'aclFloatArray', 'aclBoolArray']:
2427
+ case[f"{param_name}.value"] = [1, 2]
2428
+ else:
2429
+ case[f"{param_name}.value"] = 1
2430
+
2431
+
2432
+ def _set_output_tensor_default(case, param_name, param):
2433
+ """设置输出 Tensor 默认值"""
2434
+ dtype_ranges = param.get('dtype_with_ranges', [])
2435
+ if dtype_ranges:
2436
+ case[f"{param_name}.dtype"] = dtype_ranges[0].get('dtype', 'float32')
2437
+ case[f"{param_name}.format"] = param.get('format', ['ND'])[0]
2438
+ case[f"{param_name}.dimensions"] = 2
2439
+ case[f"{param_name}.shape"] = [2, 3]
2440
+
2441
+
2442
+ def _set_output_tensor_list_default(case, param_name, param):
2443
+ """设置输出 TensorList 默认值"""
2444
+ dtype_ranges = param.get('dtype_with_ranges', [])
2445
+ if dtype_ranges:
2446
+ case[f"{param_name}.dtype"] = dtype_ranges[0].get('dtype', 'float32')
2447
+ case[f"{param_name}.length"] = 2
2448
+ case[f"{param_name}.shape_list"] = [[2, 3], [2, 3]]
2449
+
2450
+
2451
+ def create_error_case_template(param_def: Dict, aclnn_name: str) -> Dict:
2452
+ """
2453
+ 创建异常用例模板
2454
+
2455
+ Args:
2456
+ param_def: 参数定义
2457
+ aclnn_name: 算子名称
2458
+
2459
+ Returns:
2460
+ Dict: 用例模板
2461
+ """
2462
+ case = {
2463
+ 'aclnn_name': aclnn_name,
2464
+ 'case_name': '',
2465
+ 'error_type': '',
2466
+ 'error_param': '',
2467
+ }
2468
+
2469
+ params = param_def.get('parameters', [])
2470
+ if not isinstance(params, list):
2471
+ return case
2472
+
2473
+ for param in params:
2474
+ param_name = param.get('name', '')
2475
+ param_type = param.get('type', '')
2476
+ io_type = param.get('io_type', 'input')
2477
+ case[f"{param_name}.exist"] = True
2478
+
2479
+ # 输入参数
2480
+ if io_type == 'input':
2481
+ if param_type == 'aclTensor':
2482
+ _set_tensor_default(case, param_name, param)
2483
+ elif param_type == 'aclScalar':
2484
+ _set_scalar_default(case, param_name, param)
2485
+ elif param_type == 'aclTensorList':
2486
+ _set_tensor_list_default(case, param_name, param)
2487
+ else:
2488
+ _set_array_default(case, param_name, param_type)
2489
+
2490
+ # 输出参数
2491
+ elif io_type == 'output' and param_type == 'aclTensor':
2492
+ _set_output_tensor_default(case, param_name, param)
2493
+ elif io_type == 'output' and param_type == 'aclTensorList':
2494
+ _set_output_tensor_list_default(case, param_name, param)
2495
+
2496
+ return case
2497
+
2498
+
2499
+ def generate_random_shape(dimensions: int) -> List[int]:
2500
+ """生成随机shape"""
2501
+ return [random.randint(1, 100) for _ in range(dimensions)]
2502
+
2503
+
2504
+ def generate_overflow_shape(dimensions: int) -> List[int]:
2505
+ """生成超限shape(维度>8)"""
2506
+ return [random.randint(1, 10) for _ in range(dimensions)]
2507
+
2508
+
2509
+ def generate_random_value(dtype: str) -> Any:
2510
+ """根据dtype生成随机值"""
2511
+ if dtype in ['float32', 'float', 'float16', 'bfloat16', 'float64', 'double']:
2512
+ return random.uniform(-10, 10)
2513
+ elif dtype in ['int32', 'int64', 'int16', 'int8']:
2514
+ return random.randint(-100, 100)
2515
+ elif dtype in ['uint8', 'uint16', 'uint32', 'uint64']:
2516
+ return random.randint(0, 100)
2517
+ elif dtype == 'bool':
2518
+ return random.choice([True, False])
2519
+ elif dtype in ['complex64', 'complex128']:
2520
+ return complex(random.uniform(-10, 10), random.uniform(-10, 10))
2521
+ else:
2522
+ return 1
2523
+
2524
+
2525
+ def generate_attr_error_cases(param_def: Dict, supported_dtypes: List[str],
2526
+ aclnn_name: str, verbose: bool) -> List[Dict]:
2527
+ """
2528
+ 生成attr属性异常用例(Scalar参数value异常)
2529
+
2530
+ Args:
2531
+ param_def: 参数定义
2532
+ supported_dtypes: 支持的dtype列表
2533
+ aclnn_name: 算子名称
2534
+ verbose: 详细输出
2535
+
2536
+ Returns:
2537
+ List[Dict]: attr属性异常用例列表
2538
+
2539
+ 异常类型:
2540
+ 1. 特殊值异常:inf, -inf, nan(浮点类型)
2541
+ 2. 边界值异常:超出dtype范围的值
2542
+ 3. 非法值异常:如非因子数的groups等
2543
+ """
2544
+ cases = []
2545
+
2546
+ # 获取所有Scalar输入参数
2547
+ scalar_params = []
2548
+ params = param_def.get('parameters', [])
2549
+ if isinstance(params, list):
2550
+ for param in params:
2551
+ if param.get('io_type') == 'input' and param.get('type') == 'aclScalar':
2552
+ scalar_params.append(param.get('name', ''))
2553
+
2554
+ if not scalar_params:
2555
+ return cases
2556
+
2557
+ # 对所有Scalar参数生成attr异常(每个参数每个场景一条)
2558
+ for param_name in scalar_params:
2559
+ # 获取一个支持的浮点dtype(用于生成特殊值异常)
2560
+ float_dtype = next((d for d in supported_dtypes if d in ['float32', 'float16', 'float64', 'bfloat16']), None)
2561
+
2562
+ # 1. 特殊值异常(inf/nan等)- 只对浮点类型生成一条
2563
+ if float_dtype:
2564
+ case = create_error_case_template(param_def, aclnn_name)
2565
+ case[f"{param_name}.dtype"] = float_dtype
2566
+ case[f"{param_name}.value"] = 'nan'
2567
+ case['error_type'] = 'attr_special_value'
2568
+ case['error_param'] = param_name
2569
+ case['case_name'] = f"{aclnn_name}_{float_dtype}_random_{param_name}_attr_nan_exception"
2570
+ cases.append(case)
2571
+
2572
+ # 2. 边界值异常(超出范围)
2573
+ int_dtype = next((d for d in supported_dtypes if d in ['int32', 'int64', 'int16', 'int8']), None)
2574
+ if int_dtype and int_dtype in DTYPE_BOUNDARIES:
2575
+ boundaries = DTYPE_BOUNDARIES[int_dtype]
2576
+ case = create_error_case_template(param_def, aclnn_name)
2577
+ case[f"{param_name}.dtype"] = int_dtype
2578
+ overflow_value = boundaries['max'] + 1 if boundaries['max'] else 999999999
2579
+ case[f"{param_name}.value"] = overflow_value
2580
+ case['error_type'] = 'attr_boundary_overflow'
2581
+ case['error_param'] = param_name
2582
+ case['case_name'] = f"{aclnn_name}_{int_dtype}_random_{param_name}_attr_boundary_exception"
2583
+ cases.append(case)
2584
+
2585
+ if verbose and cases:
2586
+ logging.info(f"[INFO] 生成attr属性异常用例: {len(cases)}条")
2587
+
2588
+ return cases
2589
+
2590
+
2591
+ def _build_param_def_dict(param_def: Dict) -> Dict:
2592
+ """构建参数名映射字典,抽取前置解析逻辑"""
2593
+ params = param_def.get('parameters', [])
2594
+ if isinstance(params, list):
2595
+ return {p.get('name'): p for p in params if p.get('name')}
2596
+ return param_def
2597
+
2598
+
2599
+ def _process_single_param(
2600
+ param_name: str,
2601
+ param_info: Dict,
2602
+ error_case: Dict,
2603
+ param_def_dict: Dict,
2604
+ containers: TtkCaseData
2605
+ ):
2606
+ """统一处理单个参数分支,消除主函数大量if-elif"""
2607
+ io_type = param_info.get('io_type', 'input')
2608
+ param_type = param_info.get('type', '')
2609
+
2610
+ if param_type == 'aclTensor' and io_type == 'input':
2611
+ data = InputTensorData(
2612
+ input_shapes=containers.input_shapes,
2613
+ input_dtypes=containers.input_dtypes,
2614
+ input_ranges=containers.input_ranges
2615
+ )
2616
+ _process_input_tensor(param_name, error_case, data)
2617
+ elif param_type == 'aclTensorList' and io_type == 'input':
2618
+ container = TensorListOutputContainer(
2619
+ input_shapes=containers.input_shapes,
2620
+ input_dtypes=containers.input_dtypes,
2621
+ input_ranges=containers.input_ranges,
2622
+ tensor_list_lengths=containers.tensor_list_lengths
2623
+ )
2624
+ _process_input_tensor_list(param_name, error_case, container)
2625
+ elif param_type == 'aclTensor' and io_type == 'output':
2626
+ _process_output_tensor(param_name, error_case, containers, param_def_dict)
2627
+ elif param_type == 'aclTensorList' and io_type == 'output':
2628
+ out_container = OutputTensorListContainer(
2629
+ output_shapes=containers.output_shapes,
2630
+ output_dtypes=containers.output_dtypes,
2631
+ tensor_list_lengths=containers.tensor_list_lengths,
2632
+ output_indexes=containers.output_indexes
2633
+ )
2634
+ _process_output_tensor_list(
2635
+ param_name, error_case, param_def_dict, out_container
2636
+ )
2637
+ else:
2638
+ _process_scalar_types(param_name, param_info, error_case,
2639
+ containers.scalar_dtypes_list, containers.attrs_dict)
2640
+
2641
+
2642
+ def _build_single_ttk_case(
2643
+ idx: int,
2644
+ error_case: Dict,
2645
+ param_def_dict: Dict
2646
+ ):
2647
+ """构建单条TTK用例,提取循环内部核心逻辑"""
2648
+ testcase_name = error_case.get('case_name', f"error_case_{idx:03d}")
2649
+ api_name = error_case.get('aclnn_name', '')
2650
+ case = _init_ttk_case_base(testcase_name, api_name)
2651
+
2652
+ # 初始化容器(复用 TtkCaseData,__post_init__ 自动填充默认值)
2653
+ containers = TtkCaseData(
2654
+ input_shapes=[], input_dtypes=[], input_ranges=[],
2655
+ output_shapes=[], output_dtypes=[]
2656
+ )
2657
+
2658
+ # 遍历所有参数并处理
2659
+ for param_name, param_info in param_def_dict.items():
2660
+ _process_single_param(
2661
+ param_name=param_name,
2662
+ param_info=param_info,
2663
+ error_case=error_case,
2664
+ param_def_dict=param_def_dict,
2665
+ containers=containers
2666
+ )
2667
+
2668
+ # containers 本身就是 TtkCaseData,直接填充
2669
+ _build_ttk_case_data(case, containers)
2670
+ return case
2671
+
2672
+
2673
+ def create_error_ttk_dataframe(error_cases: List[Dict], param_def: Dict) -> pd.DataFrame:
2674
+ """
2675
+ 创建TTK格式的异常用例DataFrame
2676
+
2677
+ Args:
2678
+ error_cases: 异常用例列表
2679
+ param_def: 参数定义
2680
+
2681
+ Returns:
2682
+ pd.DataFrame: TTK格式用例DataFrame
2683
+ """
2684
+ cases = []
2685
+ param_def_dict = _build_param_def_dict(param_def)
2686
+
2687
+ # 循环生成每条用例
2688
+ for idx, error_case in enumerate(error_cases):
2689
+ single_case = _build_single_ttk_case(idx, error_case, param_def_dict)
2690
+ cases.append(single_case)
2691
+
2692
+ # 生成DataFrame
2693
+ if cases:
2694
+ return pd.DataFrame(cases)[_TTK_DATAFRAME_COLUMNS]
2695
+ return pd.DataFrame(columns=_TTK_DATAFRAME_COLUMNS)
2696
+
2697
+
2698
+ def _init_ttk_case_base(testcase_name, api_name):
2699
+ """初始化 TTK 用例通用空模板(消除重复代码)"""
2700
+ return {
2701
+ 'testcase_name': testcase_name,
2702
+ 'api_name': api_name,
2703
+ 'tensor_view_shapes': '',
2704
+ 'tensor_dtypes': '',
2705
+ 'scalar_dtypes': '',
2706
+ 'attributes': '',
2707
+ 'output_tensor_indexes': '',
2708
+ 'precision_tolerances': '',
2709
+ 'absolute_precision': '',
2710
+ 'input_data_ranges': '',
2711
+ 'scalar_data_ranges': '',
2712
+ 'tensor_list_distribution': ''
2713
+ }
2714
+
2715
+
2716
+ def _process_input_tensor(param_name, error_case, data: InputTensorData):
2717
+ """处理输入 Tensor"""
2718
+ shape = error_case.get(f"{param_name}.shape", [])
2719
+ dtype = error_case.get(f"{param_name}.dtype", 'float32')
2720
+ value_range = error_case.get(f"{param_name}.value_range", [])
2721
+
2722
+ if shape:
2723
+ data.input_shapes.append(list(shape) if isinstance(shape, (list, tuple)) else shape)
2724
+
2725
+ data.input_dtypes.append(dtype)
2726
+ data.input_ranges.append(list(value_range) if value_range else [-2, 2])
2727
+
2728
+
2729
+ def _process_output_tensor(param_name, error_case, containers: TtkCaseData, param_def_dict):
2730
+ """处理输出 Tensor"""
2731
+ shape = error_case.get(f"{param_name}.shape", [])
2732
+ dtype = error_case.get(f"{param_name}.dtype", 'float32')
2733
+ if shape:
2734
+ containers.output_shapes.append(list(shape) if isinstance(shape, (list, tuple)) else shape)
2735
+ containers.output_dtypes.append(dtype)
2736
+ param_names = list(param_def_dict.keys())
2737
+ if param_name in param_names:
2738
+ containers.output_indexes.append(param_names.index(param_name))
2739
+
2740
+
2741
+ def _process_input_tensor_list(
2742
+ param_name: str,
2743
+ error_case: Dict,
2744
+ output_container: TensorListOutputContainer
2745
+ ):
2746
+ """处理输入 TensorList"""
2747
+ shape_list = error_case.get(f"{param_name}.shape_list", [[2, 3], [2, 3]])
2748
+ if not isinstance(shape_list, list):
2749
+ shape_list = [[2, 3], [2, 3]]
2750
+ dtype = error_case.get(f"{param_name}.dtype", 'float32')
2751
+ length = len(shape_list) if shape_list else 1
2752
+ value_range = error_case.get(f"{param_name}.value_range", [-2, 2])
2753
+ single_range = list(value_range) if value_range else [-2, 2]
2754
+
2755
+ output_container.input_shapes.append(shape_list)
2756
+ output_container.input_dtypes.append(tuple([dtype] * length))
2757
+ output_container.input_ranges.append(tuple([single_range] * length))
2758
+ output_container.tensor_list_lengths.append(length)
2759
+
2760
+
2761
+ def _process_output_tensor_list(
2762
+ param_name: str,
2763
+ error_case: Dict,
2764
+ param_def_dict: Dict,
2765
+ output_container: OutputTensorListContainer
2766
+ ):
2767
+ """处理输出 TensorList"""
2768
+ shape_list = error_case.get(f"{param_name}.shape_list", [[2, 3], [2, 3]])
2769
+ if not isinstance(shape_list, list):
2770
+ shape_list = [[2, 3], [2, 3]]
2771
+ dtype = error_case.get(f"{param_name}.dtype", 'float32')
2772
+ length = len(shape_list) if shape_list else 1
2773
+
2774
+ output_container.output_shapes.append(shape_list)
2775
+ output_container.output_dtypes.append(tuple([dtype] * length))
2776
+ param_names = list(param_def_dict.keys())
2777
+ if param_name in param_names:
2778
+ output_container.output_indexes.append(param_names.index(param_name))
2779
+ output_container.tensor_list_lengths.append(length)
2780
+
2781
+
2782
+ def _process_scalar_types(param_name, param_info, error_case, scalar_dtypes_list, attrs_dict):
2783
+ """处理 Scalar / Array 类型参数"""
2784
+ param_type = param_info.get('type', '')
2785
+
2786
+ if param_type == 'aclScalar':
2787
+ dtype = error_case.get(f"{param_name}.dtype", 'float32')
2788
+ scalar_dtypes_list.append(dtype)
2789
+ value = error_case.get(f"{param_name}.value", '')
2790
+ if pd.notna(value) and value != '':
2791
+ attrs_dict[param_name] = format_ttk_attr_value(value, param_type)
2792
+
2793
+ elif param_type in ['aclIntArray', 'aclFloatArray', 'aclBoolArray']:
2794
+ value = error_case.get(f"{param_name}.value", '')
2795
+ if pd.notna(value) and value != '':
2796
+ attrs_dict[param_name] = format_ttk_attr_value(value, param_type)
2797
+
2798
+
2799
+ if __name__ == '__main__':
2800
+ main()