catlass-op-design

Selects CATLASS components for designing Ascend C operators on Ascend NPU hardware.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill catlass-op-design-wangwindow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: catlass-op-design
Source: https://github.com/WangWindow/CANN-BatchMatMulMaxsum/tree/main/.agents/skills/catlass-op-design
Command: npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill catlass-op-design-wangwindow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Designing a CATLASS-based Ascend C operator requires choosing the correct combination of ArchTag, DispatchPolicy, TileShape, BlockMmad, BlockEpilogue, BlockScheduler, and Kernel type from a large template library, where wrong choices cause precision loss, deadlocks, or severe performance regressions. ## Core Features & Use Cases - Component Selection Methodology: Step-by-step decision trees route operator requirements (matmul, grouped matmul, FlashAttention, linear attention, quant matmul) to the correct DispatchPolicy, Kernel type, TileShape, and BlockScheduler. - Epilogue Slot Analysis: Enforces slot-by-slot verification of BlockEpilogue template parameters, UB budget checks, hardware event ID limits, and cross-N-block operand topology checks for gated activations like SwiGLU. - Design Document Output: Produces structured design tables covering component selection, branch instantiation conditions, workspace estimation, and custom Tile contracts. - Use Case: When implementing a fused matmul+GELU operator for Ascend910B, use this Skill to determine that a multi-stage rotating workspace kernel with MmadAtlasA2PreloadAsyncWithCallback outperforms the example-level MatmulActivation path, and to verify L1/L0 capacity constraints for the chosen TileShape. ## Quick Start Ask the assistant to design a CATLASS component selection plan for your target operator, specifying the operator type, input dtypes, layouts, and target Ascend chip.

Frequently Asked Questions about catlass-op-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose CATLASS components for a new Ascend C operator?

First read the catlass repository README, docs, and the closest example, then follow the decision trees: identify the operator type, select DispatchPolicy, Kernel type, BlockScheduler, and TileShape, and finally analyze BlockEpilogue slots. Output the result as component selection tables.

Which DispatchPolicy should I use for fused matmul and epilogue operators?

MmadAtlasA2PreloadAsyncWithCallback is the performance-optimal DispatchPolicy for fused matmul plus epilogue pipelines, paired with a multi-stage rotating workspace kernel. MmadAtlasA2Pingpong is only a baseline for one-time verification.

Does CATLASS support FlashAttention operator design on Ascend910B?

Yes, the skill routes FlashAttention, MHA, GQA, and MLA designs through a dedicated guide covering BlockMmadQK/PV selection, online softmax epilogues, AIC/AIV collaboration, and BNSD interface conversion. On A2, PAGED must be true with an identity block table.

Why does a SwiGLU epilogue produce wrong results on large N dimensions?

SwiGLU pairs columns separated by H=N/2, which fall into different N-blocks when N exceeds L1TileShape::N, so per-block rotating workspaces compute incorrectly. The fix is scheduling by output shape [M,H] and producing both left and right N-tiles per output block.

What are the TileShape capacity limits on AtlasA2?

AtlasA2 has 512KB L1 and 128KB L0C. For fp16 inputs, K-tile is limited to 256 with L1<128,256,256> and L0<128,256,64>; int8 inputs allow K=512. TileShape must be validated against these capacity formulas before selection.

When should I write a custom BlockEpilogue instead of a custom Tile?

Prefer granularity A, replacing a single Tile slot inside an existing BlockEpilogue specialization, whenever a slot's interface signature can hold the required computation. Only write a new BlockEpilogue specialization when no existing specialization matches, since it costs 500-700 lines and couples to catlass internals.