mindspore-ai/akg/pypto-case-matmul-2d
Claude Code and agent skill by mindspore-ai/akg
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
模式 B 示例:2D 矩阵乘法 + M 维 loop 分块 + 尾部处理
Install
npx vskill@latest install mindspore-ai/akg/pypto-case-matmul-2dSKILL.md
The same SKILL.md was published earlier as mindspore-ai/akg/pypto-case-matmul-2d.
模式 B:Matmul + Loop(含尾部处理)
forward:assert → contiguous → 读 shape → 调 kernel
3D 输入 + 2D B:forward 中计算 nm = N * M,A.reshape(nm, K) → 将 nm 传入工厂函数(不要分别传 N、M):
Matmul + Bias(Linear)两阶段写法
linear = matmul + bias 不要把 add 直接塞在 cube 阶段。matmul 是 cube op,add/expand_clone 是 vec op,必须显式切换 tile。
要点
- 禁止把
BASIC_BATCH当固定答案;先定loop_count,再反推BASIC_BATCH。 - 当
loop_count范围约为1~128且候选按 2 倍步长变化时,中段优先试16/32(对数刻度中间,不是算术中点)。 - 例:
m=16384时,loop=16/32对应BASIC_BATCH=1024/512;再扩loop=8/64对应2048/256。 - 避免两端极值:既不要盲目追求
loop_count=1,也不要默认用最小 batch 让loop_count接近最大。 - view shape 必须是编译期常量:
BASIC_BATCH、tail都是闭包常量 - 禁止
min(BASIC_BATCH, m - offset)作为 view shape(offset 含 loop 变量 = 运行时值) a_trans=True/b_trans=True支持转置,结构不变- 三角/对称矩阵:直接标准 matmul
- M ≤ 128 时可不 loop:
c[:] = pypto.matmul(a, b, ...) matmul + elementwise混合时使用两阶段 tile:set_cube_tile_shapes(...)后,进入 vec 阶段前再set_vec_tile_shapes(...)。
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingakg_agents/python/akg_agents/op/resources/skills/pypto/cases/pypto-case-matmul-2d/SKILL.md
Popularity
- Repository stars
- 259
- Repository forks
- 48
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mindspore-ai/akg/pypto-case-matmul-2d)