Skip to content

kali20gakki/msAgent / skills/operator/ops-performance-tuning

ops-performance-tuning

Verified

Compile, profile, diagnose, optimize, and compare Ascend NPU operators across CANN versions and A2/A3/A5 for Ascend C, CATLASS, Triton-Ascend, TileLang-Ascend, PyPTO, and SHMEM/MC2. Use when an operator already has a runnable implementation and the user asks for msOpProf collection, bottleneck analysis, source-level tuning, or a reproducible before/after performance report. Do not use as the primary workflow for operator creation, migration, or unresolved correctness failures.

FileKindSize
SKILL.mdskill md15.4 KB
evals/evals.jsonconfig3.6 KB
references/case-routing.mdmarkdown30.0 KB
references/cases/ascendc/pr_ascendc_allgathermm_scalar_align.mdmarkdown1.7 KB
references/cases/ascendc/pr_ascendc_cann_samples_perf_story.mdmarkdown3.9 KB
references/cases/ascendc/pr_ascendc_cgdr_vf_inverse.mdmarkdown1.6 KB
references/cases/ascendc/pr_ascendc_conv3ddx_tque_tbuf.mdmarkdown1.6 KB
references/cases/ascendc/pr_ascendc_layernorm_areg.mdmarkdown1.6 KB
references/cases/ascendc/pr_ascendc_logit_a5_microapi.mdmarkdown1.9 KB
references/cases/ascendc/pr_ascendc_matmul_case_18x.mdmarkdown1.5 KB
references/cases/ascendc/pr_ascendc_matmul_full_load_wiki.mdmarkdown1.6 KB
references/cases/ascendc/pr_ascendc_matmul_vcv_wiki.mdmarkdown1.8 KB
references/cases/ascendc/pr_ascendc_mc2_fusion.mdmarkdown1.4 KB
references/cases/ascendc/pr_ascendc_mhc_24x.mdmarkdown1.2 KB
references/cases/ascendc/pr_ascendc_msopprof_add_block_imbalance.mdmarkdown1.7 KB
references/cases/ascendc/pr_ascendc_quantize_a2_micro_opt.mdmarkdown2.0 KB
references/cases/ascendc/pr_ascendc_rotate_quant_blaze.mdmarkdown2.8 KB
references/cases/ascendc/pr_ascendc_tiling_l2_official.mdmarkdown1.6 KB
references/cases/catlass/pr_catlass_baseline.mdmarkdown1.3 KB
references/cases/catlass/pr_catlass_fixpipe_dualdst.mdmarkdown1.6 KB
references/cases/catlass/pr_catlass_grouped_matmul_tiling.mdmarkdown1.5 KB
references/cases/catlass/pr_catlass_mstuner_3p8x.mdmarkdown1.9 KB
references/cases/catlass/pr_catlass_swizzle_balance.mdmarkdown1.6 KB
references/cases/pypto/pr_pypto_gqa_decode_vector_merge.mdmarkdown2.4 KB
references/cases/pypto/pr_pypto_l2_hit_layout_s13.mdmarkdown1.9 KB
references/cases/pypto/pr_pypto_per_matmul_tile_shapes.mdmarkdown2.4 KB
references/cases/pypto/pr_pypto_small_shape_matmul.mdmarkdown2.3 KB
references/cases/pypto/pr_pypto_weight_none_cacheable.mdmarkdown2.6 KB
references/cases/shmem/pr_shmem_alltoallv_mr152.mdmarkdown2.4 KB
references/cases/shmem/pr_shmem_reduce_scatter_serial.mdmarkdown2.6 KB
references/cases/tilelang/pr_tilelang_benchmark_vs_ascendc.mdmarkdown1.7 KB
references/cases/tilelang/pr_tilelang_compiler_prs.mdmarkdown2.3 KB
references/cases/tilelang/pr_tilelang_fa_pr698.mdmarkdown1.5 KB
references/cases/tilelang/pr_tilelang_gqa_bwd_pr1494.mdmarkdown1.3 KB
references/cases/tilelang/pr_tilelang_persistent_mqa_decode.mdmarkdown2.2 KB
references/cases/tilelang/pr_tilelang_sfa_pr665.mdmarkdown914 B
references/cases/triton/pr_triton_atomic_simd_24x.mdmarkdown1.8 KB
references/cases/triton/pr_triton_autotune_background.mdmarkdown1.0 KB
references/cases/triton/pr_triton_constexpr_recompile.mdmarkdown1.1 KB
references/cases/triton/pr_triton_lgamma_simt.mdmarkdown1.6 KB
references/compile/compile-ascendc.mdmarkdown9.0 KB
references/compile/compile-catlass.mdmarkdown2.4 KB
references/compile/compile-pypto.mdmarkdown2.0 KB
references/compile/compile-shmem.mdmarkdown2.6 KB
references/compile/compile-tilelang.mdmarkdown2.7 KB
references/compile/compile-triton.mdmarkdown4.4 KB
references/diagnose/diagnose-l2-cache.mdmarkdown2.2 KB
references/diagnose/diagnose-occupancy.mdmarkdown4.0 KB
references/diagnose/diagnose-pipeline.mdmarkdown4.1 KB
references/diagnose/diagnose-roofline.mdmarkdown3.1 KB
references/optimize/optimize-api-usage.mdmarkdown1.7 KB
references/optimize/optimize-ascendc-regbase-vf.mdmarkdown5.9 KB
references/optimize/optimize-ascendc-tiling.mdmarkdown935 B
references/optimize/optimize-catlass.mdmarkdown3.0 KB
references/optimize/optimize-data-copy.mdmarkdown870 B
references/optimize/optimize-index.mdmarkdown3.6 KB
references/optimize/optimize-memory-hierarchy.mdmarkdown599 B
references/optimize/optimize-pipeline.mdmarkdown1.0 KB
references/optimize/optimize-pypto.mdmarkdown1.5 KB
references/optimize/optimize-shmem.mdmarkdown5.1 KB
references/optimize/optimize-tilelang.mdmarkdown1.7 KB
references/optimize/optimize-triton.mdmarkdown3.8 KB
references/profile/benchmark-harness.mdmarkdown2.2 KB
references/profile/profile-msopprof.mdmarkdown7.4 KB
references/troubleshooting.mdmarkdown5.8 KB
scripts/bound_analyzer.pyscript9.8 KB
scripts/delta_report.pyscript5.5 KB
scripts/env_check.shscript5.7 KB
scripts/result_saver.pyscript5.8 KB

references/cases/ascendc/pr_ascendc_rotate_quant_blaze.md

View on GitHub
# MR !168(cann/ops-tensor)+ MR !7782(cann/ops-nn)RotateQuant Blaze 组件化迁移试点【PR】

## 基本信息
- 算子类别:matmul(rotate_quant,量化 matmul)
- DSL/框架:ascendc
- 类型:PR
- 来源可信度:一手 PR 原文

## 来源链接
- PR/出处链接:实现 PR <https://gitcode.com/cann/ops-tensor/pull/168>( 已验证可达,验证日期 2026-08);接入 PR <https://gitcode.com/cann/ops-nn/pull/7782>(依赖前一个 PR; 已验证可达,验证日期 2026-08)
- 优化代码查看:实现 PR 代码改动页 <https://gitcode.com/cann/ops-tensor/pull/168/files>( 已验证可达,验证日期 2026-08);接入 PR 代码改动页 <https://gitcode.com/cann/ops-nn/pull/7782/files>( 已验证可达,验证日期 2026-08)

## 问题与瓶颈
`matmul/rotate_quant` 算子(FP16/BF16 输入,MX FP4 E2M1 / FP8 E4M3FN/E5M2 输出,K 32/64/128,2D/3D 旋转 + 分组截断量化)原为私有 CMCT 实现,需迁移为 ops-tensor Blaze 公共组件;原组件无法组合出 M/批次交错调度、A 行交错与 B 全载复用的 Fixpipe MMAD、单 AIC 对两个 AIV 的交替单消费者协议。环境:Ascend 950 / DAV_3510,CANN 9.1.0,BiSheng/CCEC clang 15.0.5。

## 优化方法(理论手段)
本案例价值在"性能不回归的组件化"与验收协议:
1. **Fixpipe MMAD + B 全载/A 交错**:B 常驻 L0 复用,A 按批次交错载入,MTE2 与 MMAD 流水重叠;逐层新增 4 个组件:`BlockSchedulerMatmulInterleavedBatch`、`BlockMmadMatmulBFullLoadInterleavedAFixpipe`、`KernelMatmulFixpipeAlternatingAiv`(1:2 MIX,AIC 每轮只通知一个交替 AIV)、`BlockEpilogueMxQuantGroupClamp`。
2. **AIC 对双 AIV 交替单消费者协议**:AIC 每轮只唤醒一个 AIV 消费 fixpipe 输出,避免双 AIV 争用导致的同步抖动。
3. **严格验收协议**:逐字节一致性比对(含独立 256 字节物理越界防护区检查、重复运行确定性);性能采用同设备、同 CANN、同 tiling、正反交错采集顺序,每用例每进程预热 5 次、采集 20 条目标任务、3 个独立进程取中位数均值——可复现性能比对的方法论模板。

## 性能对比
| 指标 | 优化前(原实现) | 优化后(迁移实现) | 变化 |
|---|---|---|---|
| 任务中位数均值(稳定验收用例 BF16/E4) | 29.159 us | 29.305 us | 回退约 0.50% |

(pilot 记录 G3 节原文)MTE2/MMAD/Fixpipe 流水活跃时间无增加,性能负责人按例外验收通过(结论明确记录"不是'无差异'")。

## 适用范围与警示
- 适用:Ascend 950 / DAV_3510,CANN 9.1.0;FP16/BF16 输入,MX FP4 E2M1 / FP8 E4M3FN/E5M2 输出,K 32/64/128。
- ** 风险说明**:本案例是"迁移性能持平"案例而非提速案例,引用时勿表述为优化收益。
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall