[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7984PRE5N1CWZBCXVC6G1K9":3,"skill-same:01M7984PRE5N1CWZBCXVC6G1K9":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M7984PRE5N1CWZBCXVC6G1K9","triton-npu-cann-ext-api-patterns",null,"A5-only specialized optimization pattern references for Triton Ascend NPU kernels that use CANN Triton extension APIs. This skill does not define the optimize workflow; it only provides pattern material for optimize to consume.","Piagari\u002Fhelix","Piagari","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F129916910?v=4","01M7980QB9Y8WK5TSSRJDC7H1X","01M7980QCA2FWSBBSSM695Y10B",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: triton-npu-cann-ext-api-patterns\ndescription: A5-only specialized optimization pattern references for Triton Ascend NPU kernels that use CANN Triton extension APIs. This skill does not define the optimize workflow; it only provides pattern material for optimize to consume.\n---\n\n# CANN Triton Extension API Patterns\n\n## Purpose\n\nThis skill is a pattern library for optimize runs that explicitly enable CANN extension API access.\n\n## Scope\n\n- This skill does not define optimize workflow behavior.\n- The optimize workflow contract remains owned by `triton-npu-optimize`.\n- This skill only provides specialized A5-oriented pattern references for CANN Triton extension APIs.\n- Treat the pattern material here as A5-specific unless the detailed pattern reference states otherwise.\n\n## How To Use This Skill\n\n1. Use this skill only when optimize explicitly stages it.\n2. Read `references\u002Fpatterns\u002Findex.md` first.\n3. Pick only the most relevant detailed pattern file for the current bottleneck.\n4. Avoid bulk-loading all detailed pattern references unless the kernel genuinely shows multiple independent extension-API opportunities.\n\n## Quick Orientation\n\n### Kernel structure\n\nEvery CV-fusion kernel has two `al.scope` blocks at the top level:\n\n```python\nwith al.scope(core_mode=\"cube\"):\n    for block_idx in range(start, end, step):\n        _qk_matmul(...)   # tl.dot + al.fixpipe → qk_ub\n        _pv_matmul(...)   # tl.dot + al.fixpipe → pv_ub\n\nwith al.scope(core_mode=\"vector\"):\n    for block_idx in range(start, end, step):\n        _softmax(...)     # qk_ub → p_nz → al.copy → p_l1\n        _flash_update(...)# pv_ub → acc\n```\n\nBuffers (`qk_ub`, `p_l1`, `pv_ub`) are allocated with `bl.alloc` **before** the scopes and are visible in both.\n\n### Sync handshake pattern\n\nFor each buffer handoff between cube and vector, issue a matching `set`\u002F`wait` pair:\n\n```python\n# Cube done writing → vector can read:\nal.sync_block_set(\"cube\", \"vector\", event_id, PIPE_FIX, PIPE_V)   # in cube scope\nal.sync_block_wait(\"cube\", \"vector\", event_id, PIPE_FIX, PIPE_V)  # in vector scope\n\n# Vector done writing → cube can read:\nal.sync_block_set(\"vector\", \"cube\", event_id, PIPE_MTE3, PIPE_MTE1)   # in vector scope\nal.sync_block_wait(\"vector\", \"cube\", event_id, PIPE_MTE3, PIPE_MTE1)  # in cube scope\n```\n\nSee [references\u002Fpatterns\u002Fal_sync.md](references\u002Fpatterns\u002Fal_sync.md) for the full event ID table and pre\u002Fpost-loop initialization.\n\n### NZ format — key sizes\n\n| Dtype | N0 | M0 | p_l1 shape for [BM, BN] |\n|---|---|---|---|\n| fp16\u002Fbf16 | 16 | 16 | `[BN\u002F\u002F16, BM\u002F\u002F16, 16, 16]` |\n| fp32 | 8 | 16 | `[BN\u002F\u002F8, BM\u002F\u002F16, 16, 8]` |\n\nSet at kernel launch: `fractal_n0 = 8 if dtype == float32 else 16`.\n\n### fp32 NZ conversion: always outside outlined scopes\n\nFor fp32, build softmax output as ND (`p_temp`) inside the VF scope, then convert to NZ with `tl.permute(reshape(...), (2,0,1,3))` outside. See [references\u002Fpatterns\u002Fal_scope_args.md](references\u002Fpatterns\u002Fal_scope_args.md) and [references\u002Fpatterns\u002Fal_copy_fractal.md](references\u002Fpatterns\u002Fal_copy_fractal.md).\n\n### Ping-pong buffering\n\nAllocate `_ping` and `_pong` variants of `qk_ub`, `p_l1`, `pv_ub`. Select with `(sid & 1)` and `(pvid & 1)`. Requires 6 sync helper functions and pre\u002Fpost-loop credit initialization. See [references\u002Fpatterns\u002Fal_sync.md](references\u002Fpatterns\u002Fal_sync.md).\n\n### 1:2 sub_vec_id lane split\n\n```python\nsub_vec_id = al.sub_vec_id()\np_l1_sub = bl.subview(p_l1, [0, sub_vec_id * ((BLOCK_M\u002F\u002F2)\u002F\u002FFRACTAL_M0), 0, 0], ...)\nal.copy(bl.to_buffer(p_nz_4d, UB), p_l1_sub)\n```\n\nEach vector lane writes its half of the P matrix to a disjoint L1 sub-region; cube reads the full `[BM, BN]` tile. See [references\u002Fpatterns\u002Fsub_vec_id_1to2.md](references\u002Fpatterns\u002Fsub_vec_id_1to2.md).\n\n### Kernel complexity levels\n\n| Kernel | Sync events | Buffers | Extra features |\n|---|---|---|---|\n| `fa_fwd_Affinity` | 3 (0, 1, 2) | single-buffer | basic sub_vec_id, non-outlined VF |\n| `fa_fwd_parallel` | 12 (0,2,4,6,8,10) | ping-pong | outlined VF scopes, no_inline alpha |\n| `fa_fwd_preload` | 12×2 (doubled) | ping-pong + L0C | task-ring, al.parallel, triple-buffer m\u002Fl\u002Falpha |\n\nStart with `fa_fwd_Affinity` as the template when adding a new kernel; escalate to `fa_fwd_parallel` when ping-pong is needed for throughput.\n\n## Reading Contract\n\n- Treat this skill as reference material only.\n- Follow optimize workflow, validation, and reporting rules from `triton-npu-optimize`.\n- Use the detailed pattern files only when round evidence supports the rewrite direction.\n","# CANN Triton Extension API Patterns\n\n## Purpose\n\nThis skill is a pattern library for optimize runs that explicitly enable CANN extension API access.\n\n## Scope\n\n- This skill does not define optimize workflow behavior.\n- The optimize workflow contract remains owned by `triton-npu-optimize`.\n- This skill only provides specialized A5-oriented pattern references for CANN Triton extension APIs.\n- Treat the pattern material here as A5-specific unless the detailed pattern reference states otherwise.\n\n## How To Use This Skill\n\n1. Use this skill only when optimize explicitly stages it.\n2. Read `references\u002Fpatterns\u002Findex.md` first.\n3. Pick only the most relevant detailed pattern file for the current bottleneck.\n4. Avoid bulk-loading all detailed pattern references unless the kernel genuinely shows multiple independent extension-API opportunities.\n\n## Quick Orientation\n\n### Kernel structure\n\nEvery CV-fusion kernel has two `al.scope` blocks at the top level:\n\n```python\nwith al.scope(core_mode=\"cube\"):\n    for block_idx in range(start, end, step):\n        _qk_matmul(...)   # tl.dot + al.fixpipe → qk_ub\n        _pv_matmul(...)   # tl.dot + al.fixpipe → pv_ub\n\nwith al.scope(core_mode=\"vector\"):\n    for block_idx in range(start, end, step):\n        _softmax(...)     # qk_ub → p_nz → al.copy → p_l1\n        _flash_update(...)# pv_ub → acc\n```\n\nBuffers (`qk_ub`, `p_l1`, `pv_ub`) are allocated with `bl.alloc` **before** the scopes and are visible in both.\n\n### Sync handshake pattern\n\nFor each buffer handoff between cube and vector, issue a matching `set`\u002F`wait` pair:\n\n```python\n# Cube done writing → vector can read:\nal.sync_block_set(\"cube\", \"vector\", event_id, PIPE_FIX, PIPE_V)   # in cube scope\nal.sync_block_wait(\"cube\", \"vector\", event_id, PIPE_FIX, PIPE_V)  # in vector scope\n\n# Vector done writing → cube can read:\nal.sync_block_set(\"vector\", \"cube\", event_id, PIPE_MTE3, PIPE_MTE1)   # in vector scope\nal.sync_block_wait(\"vector\", \"cube\", event_id, PIPE_MTE3, PIPE_MTE1)  # in cube scope\n```\n\nSee [references\u002Fpatterns\u002Fal_sync.md](references\u002Fpatterns\u002Fal_sync.md) for the full event ID table and pre\u002Fpost-loop initialization.\n\n### NZ format — key sizes\n\n| Dtype | N0 | M0 | p_l1 shape for [BM, BN] |\n|---|---|---|---|\n| fp16\u002Fbf16 | 16 | 16 | `[BN\u002F\u002F16, BM\u002F\u002F16, 16, 16]` |\n| fp32 | 8 | 16 | `[BN\u002F\u002F8, BM\u002F\u002F16, 16, 8]` |\n\nSet at kernel launch: `fractal_n0 = 8 if dtype == float32 else 16`.\n\n### fp32 NZ conversion: always outside outlined scopes\n\nFor fp32, build softmax output as ND (`p_temp`) inside the VF scope, then convert to NZ with `tl.permute(reshape(...), (2,0,1,3))` outside. See [references\u002Fpatterns\u002Fal_scope_args.md](references\u002Fpatterns\u002Fal_scope_args.md) and [references\u002Fpatterns\u002Fal_copy_fractal.md](references\u002Fpatterns\u002Fal_copy_fractal.md).\n\n### Ping-pong buffering\n\nAllocate `_ping` and `_pong` variants of `qk_ub`, `p_l1`, `pv_ub`. Select with `(sid & 1)` and `(pvid & 1)`. Requires 6 sync helper functions and pre\u002Fpost-loop credit initialization. See [references\u002Fpatterns\u002Fal_sync.md](references\u002Fpatterns\u002Fal_sync.md).\n\n### 1:2 sub_vec_id lane split\n\n```python\nsub_vec_id = al.sub_vec_id()\np_l1_sub = bl.subview(p_l1, [0, sub_vec_id * ((BLOCK_M\u002F\u002F2)\u002F\u002FFRACTAL_M0), 0, 0], ...)\nal.copy(bl.to_buffer(p_nz_4d, UB), p_l1_sub)\n```\n\nEach vector lane writes its half of the P matrix to a disjoint L1 sub-region; cube reads the full `[BM, BN]` tile. See [references\u002Fpatterns\u002Fsub_vec_id_1to2.md](references\u002Fpatterns\u002Fsub_vec_id_1to2.md).\n\n### Kernel complexity levels\n\n| Kernel | Sync events | Buffers | Extra features |\n|---|---|---|---|\n| `fa_fwd_Affinity` | 3 (0, 1, 2) | single-buffer | basic sub_vec_id, non-outlined VF |\n| `fa_fwd_parallel` | 12 (0,2,4,6,8,10) | ping-pong | outlined VF scopes, no_inline alpha |\n| `fa_fwd_preload` | 12×2 (doubled) | ping-pong + L0C | task-ring, al.parallel, triple-buffer m\u002Fl\u002Falpha |\n\nStart with `fa_fwd_Affinity` as the template when adding a new kernel; escalate to `fa_fwd_parallel` when ping-pong is needed for throughput.\n\n## Reading Contract\n\n- Treat this skill as reference material only.\n- Follow optimize workflow, validation, and reporting rules from `triton-npu-optimize`.\n- Use the detailed pattern files only when round evidence supports the rewrite direction.\n",{"name":5,"description":7},"main","5d6a3de8bf1eb43267adffc8e27a87d85fd81a4b","skills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix","https:\u002F\u002Fgithub.com\u002FPiagari","2026-07-16 20:07:51",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add Piagari\u002Fhelix --skill triton-npu-cann-ext-api-patterns",{"tool":35,"command":36},"bunx","bunx skills add Piagari\u002Fhelix --skill triton-npu-cann-ext-api-patterns",{"tool":38,"command":39},"pnpm","pnpm dlx skills add Piagari\u002Fhelix --skill triton-npu-cann-ext-api-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002FSKILL.md",true,[43,49,53,57,61,65],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"references\u002Fpatterns\u002Fal_copy_fractal.md","REFERENCE","参考文档",9227,"https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002Freferences\u002Fpatterns\u002Fal_copy_fractal.md",{"path":50,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fpatterns\u002Fal_scope_args.md",9179,"https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002Freferences\u002Fpatterns\u002Fal_scope_args.md",{"path":54,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fpatterns\u002Fal_scope.md",7648,"https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002Freferences\u002Fpatterns\u002Fal_scope.md",{"path":58,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fpatterns\u002Fal_sync.md",9568,"https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002Freferences\u002Fpatterns\u002Fal_sync.md",{"path":62,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fpatterns\u002Findex.md",4266,"https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002Freferences\u002Fpatterns\u002Findex.md",{"path":66,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fpatterns\u002Fsub_vec_id_1to2.md",12345,"https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-cann-ext-api-patterns\u002Freferences\u002Fpatterns\u002Fsub_vec_id_1to2.md",[70,77,84,91,98,103],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M7985HE7EHEXX41M79MSZCMJ","triton-npu-repair-guide","Heuristic fixes for Ascend Triton compile\u002FJIT\u002Fkernel errors and numerical precision mismatches when editing or converting the operator. Does not replace ascend-npu-gen-test, ascend-npu-gen-bench, or harness specs.","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-repair-guide\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M7985DFYH5RRCDFTWAFYDFGA","triton-npu-optimize","Iteratively optimize a Triton Ascend NPU operator with correctness and performance gates. Use for operator optimization tasks that need repeated correctness validation, benchmark validation, multi-round experiment tracking, reusable optimization notes, and profiler-backed performance analysis when benchmark results need deeper explanation.","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-optimize\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M79858YFWE96X7ZA1BJRVDEX","triton-npu-optimize-knowledge","Generic reference-only optimize knowledge for pattern triage and evidence-backed symptom routing. This skill does not define optimize workflow or own round artifacts.","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-optimize-knowledge\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":18},"01M79854BZPJ0XY5PTPQWTCY7Q","triton-npu-optimize-knowledge-v3","Generic reference-only optimize knowledge (v3 working copy) for pattern triage and evidence-backed symptom routing. This skill does not define optimize workflow or own round artifacts; prefer this tree for ongoing knowledge updates.","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-optimize-knowledge-v3\u002FSKILL.md",[],[],{"skillNo":99,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":18},"01M79850QM6QZP8VP6ZRQBQHCT","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-optimize-knowledge-v2\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":18},"01M7984W6SW3BZM5EXGRJ1VBXY","triton-npu-convert-pytorch-operator","Convert one PyTorch operator into a Triton NPU-backed PyTorch operator, preserve the trailing input-helper block, and validate the converted output through standalone or differential testing.","https:\u002F\u002Fgithub.com\u002FPiagari\u002Fhelix\u002Fblob\u002Fmain\u002Fskills\u002Ftriton\u002Ftriton-npu-convert-pytorch-operator\u002FSKILL.md",[],[]]