SuperAPI AI Directory

external-gitcode-ascend-catlass-operator-design

Coding & development

View repository

Updated 10-15 17:19

About this skill

CATLASS Operator Design

Core Workflow

需求分析 → 阅读 catlass 仓库 → 组件选型 → 输出设计文档

Prerequisites

Check Item Description
catlass repository Must be accessible under OPS_PROJECT_ROOT access catlass/(including include/、examples/)
Required Reading Before designmustread this skill's references/ files

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 substring catlass, for example:catlass_matmul_add、catlass_fused_gemm_bias
  • ProhibitedUsing alone a short name that easily conflicts with frameworks or other vendors' operators (such as matmul_add、gemm_add)
  • OpDef / class name (CamelCase) maps consistently with the directory name, such as CatlassMatmulAdd、ops/catlass_matmul_add/

Selection and Adaptation Principles

  • From catlass example and include determine the template to use,do notpaste the entire example into the operator project
  • Most operator projects are based on small msopgen projects; 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, only produceselection decisions, and the 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 large numbers 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 further questions if conditions are unclear; before design, have a catlass repository 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 questions。

Information to confirm:op_name(must contain catlass), function points, I/O and dtype, layout, target SoC, reference example (if any), constraints.


Requirement Analysis

  • Determine op_name: must contain catlass
  • 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 under
  • In examples/ find by functionsimilar examples, 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 noready-made Tile exists, follow custom-epilogue.md to first write the design contract

Component Selection

Use the selection resultsConcept TableRecord in the design document; do not write code.

The design document mustexplicitly write outthe selection table: ArchTag, BlockMmad (L1/L0 TileShape, data types), BlockEpilogue (Tile/Block components for each stage), BlockScheduler, Kernel type.


Output design document

Document chapter requirements

  1. Overview: functionality, scenarios, mathematical formulas
  2. Input/output information table: variable name, data type, Shape, layout, description
  3. Core component selection: describe each layer's components using the selection table
  4. Reference Example and template selection: selected example, selection rationale
  5. TilingKey branch design: conditions corresponding to each key and Kernel branch content
  6. Workspace: source of size calculation logic
  7. Interface and usage: aclnn interface, Host Tiling process, Kernel entry concept
  8. Extensibility: replaceable components
  9. Implementation plan outline: key points on the Host side and Kernel side

Output format

The design document must be a standalone Markdown file; naming suggestion 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 clear: ArchTag, BlockMmad, BlockEpilogue, BlockScheduler, Kernel
  • The reference example is specified, and the selection rationale is clear
  • The TilingKey branch design is listed
  • The delivery path USER_OP_PROJECT is clear

References

File Purpose
design-document.md Design document template and chapter 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