catlass-epilogue-composition

Compose CATLASS matmul epilogues for fused elementwise operators on Ascend hardware.

6|1|Updated Apr 19, 2026
One-click install
npx skills add https://github.com/xchang1121/op-autoresearch --skill catlass-epilogue-composition-xchang1121
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: catlass-epilogue-composition
Source: https://github.com/xchang1121/op-autoresearch/tree/main/skills/ascendc-catlass/guides/catlass-epilogue-composition
Command: npx skills add https://github.com/xchang1121/op-autoresearch --skill catlass-epilogue-composition-xchang1121

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When a reference operator is D = matmul(A,B) plus elementwise fusion (Add, Bias, ReLU, GELU), writing F.relu(matmul(...)) in Python deviates from CATLASS optimization goals and may fail static checks. This Skill guides you to attach the correct BlockEpilogue or EVG TreeVisitor to the GEMM kernel instead. ## Core Features & Use Cases - Kernel Selection Guidance: Choose among BasicMatmul, MatmulEpilogue, BasicMatmulTlaVisitor, and BasicMatmulTlaUbVisitor based on fusion complexity and GM round-trip constraints. - Standard Epilogue Assembly: Step-by-step type composition for BlockEpilogue with TileElemWiseAdd, dispatch policies, and tile copy configuration on Atlas A2/A3/A5. - EVG TreeVisitor Fusion: Build complex fusion graphs with VisitorAccLoad, VisitorAuxLoad, VisitorCompute<Op>, and UB-resident accumulation variants. - Use Case: Given a reference relu(A@B+X), implement the fusion inside the .asc CATLASS kernel with a custom Tile Epilogue so ModelNew calls the matching torch.ops.catlass.* op. ## Quick Start Ask the agent to implement a matmul with Add and ReLU fusion using a CATLASS MatmulEpilogue or EVG TreeVisitor instead of composing torch ops in Python.

Frequently Asked Questions about catlass-epilogue-composition

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

FAQPage Schema
How do I fuse Add or ReLU into a CATLASS matmul kernel?▼

Attach a BlockEpilogue to the GEMM using MatmulEpilogue with a TileElemWise component such as TileElemWiseAdd. For ReLU or multi-op chains, use the EVG TreeVisitor path with VisitorCompute<Relu> instead of composing torch ops in Python.

Which CATLASS kernel should I use for matmul with elementwise fusion?▼

Use BasicMatmul for pure GEMM, MatmulEpilogue for simple elementwise fusion done on AIC, BasicMatmulTlaVisitor for complex fusion graphs executed on AIV, and BasicMatmulTlaUbVisitor when you want accumulation to stay in UB and reduce GM round trips.

What is the difference between EVG GM and EVG UB visitor modes?▼

EVG GM (BasicMatmulTlaVisitor) routes MMAD results through a workspace with AIV performing tree fusion, while EVG UB (BasicMatmulTlaUbVisitor) keeps accumulation in UB by switching EpilogueVisitor<false> to <true>, reducing global memory traffic.

Can I implement matmul fusion in Python with torch instead of CATLASS epilogue?▼

No. Writing F.relu(matmul(...)) in kernel.py deviates from CATLASS optimization goals and may trigger static check failures. The fusion logic must live in the .asc kernel, a custom epilogue header, or catlass_torch.cpp, with ModelNew calling the matching torch.ops.catlass op.

What if the fusion Tile Epilogue I need does not exist in the repository?▼

You can add a custom Tile Epilogue header following existing examples and attach it to BlockEpilogue in the .asc file. However, if the AR task does not list that header in editable_files, you are limited to combining existing Tile components.