Core Workflow
需求分析 → 阅读 catlass 仓库 → 组件选型 → 输出设计文档
Prerequisites
| Check Item | Description |
|---|---|
| catlass repository | Must be accessible under OPS_PROJECT_ROOT (including catlass/) include/、examples/) |
| Required Reading | Before design,you mustread the references/ files of this skill |
Required Reading
| File | Purpose |
|---|---|
| design-document.md | Design document template |
| matmul-templates.md | Template list and selection guide |
| epilogue-components.md | Epilogue component classification and composition patterns |
| custom-epilogue.md | Custom Epilogue contract |
Operator Naming (Mandatory)
op_name(snake_case) must contain the substringcatlass, for example:catlass_matmul_add、catlass_fused_gemm_bias- Prohibitedto use alone short names that easily conflict with framework or other vendors' operators (such as
matmul_add、gemm_add) - OpDef / class name (CamelCase) must map consistently with the directory name, such as
CatlassMatmulAdd、ops/catlass_matmul_add/
Selection and Adaptation Principles
- Determine the templates to use from catlass example and include ,do notpaste the entire example into the operator project
- Most operator projects are based on the msopgen small project; the Host invocation code in the example needs to be rewritten into the op_host/op_kernel separated structure in the project
- At the design stage, produce onlyselection decisions; code is generated by code-gen
NEVER / ALWAYS
NEVER: finalize the design using an operator name that does not contain catlass ; copy the entire example verbatim; write a large number of code blocks in the design document; speculate about requirements when information is insufficient
ALWAYS: the operator name contains catlass, the directory name maps consistently with the class name; ask follow-up questions if conditions are unclear; ensure the catlass repository exists before design and read its documentation and code; the design document usesselection tablesto describe components
Requirement Input
The user maystate the requirement directly, or maynot state it. When executing this skill:if the information is deemed insufficient, continue asking follow-up questions。
Information to confirm:op_name(must include catlass), function points, I/O and dtype, layout, target SoC, reference example (if any), constraints.
Requirement Analysis
- Determine
op_name: must includecatlass - Extract: operator function, mathematical formula, I/O, dtype, layout, target SoC, constraints
Read catlass and select
- Read the catlass repository:
examples/、include/documentation and code - In
examples/, findsimilar examplesby function, and state in the design document: the selected example path, and the reason for selection - If there is no exact match: based on matmul-templates.md and existing samples in the repository, explain theworkaround
- Epilogue: search in epilogue-components.md and
catlass/include/catlass/epilogue/tile/;if there is noready-made Tile, follow custom-epilogue.md to first write the design contract
Component Selection
Use the selection result asConcept TableRecord in the design document; do not write code.
The design document mustexplicitly statethe selection table: ArchTag, BlockMmad (L1/L0 TileShape, data type), BlockEpilogue (Tile/Block components for each stage), BlockScheduler, Kernel type.
Output the design document
Document Section Requirements
- Overview: functionality, scenarios, mathematical formulas
- Input/Output Information Table: variable name, data type, Shape, layout, description
- Core Component Selection: describe the components of each layer using the selection table
- Reference Example and Template Selection: the selected example, reasons for the selection
- TilingKey Branch Design: the conditions corresponding to each key and the Kernel branch content
- Workspace: source of the size calculation logic
- Interface and Usage: aclnn interface, Host Tiling process, Kernel entry concept
- Extensibility: replaceable components
- Implementation Plan Outline: key points on the Host side and the Kernel side
Output Format
The design document must be a standalone Markdown file, naming suggested design_<op_name>.md, stored in USER_OP_PROJECT or a user-specified path.
Quality Verification
Design Document Checklist
- The operator name contains
catlass, the snake_case directory name matches the CamelCase class name - Contains a complete input/output information table
- Core component selection is specified: ArchTag, BlockMmad, BlockEpilogue, BlockScheduler, Kernel
- The reference example is stated, and the reasons for the selection are clear
- The TilingKey branch design is listed
- The delivery path USER_OP_PROJECT is specified
References
| File | Purpose |
|---|---|
| design-document.md | Design document template and section specification |
| matmul-templates.md | Template list and selection guide |
| epilogue-components.md | Epilogue component classification and selection |
| custom-epilogue.md | Design contract for custom Tile Epilogue |
| catlass/examples/ | Development forms and multiple template references |
| catlass/docs/3_API/gemm_api.md | Gemm API layered model, component comparison table |