Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add mindspore-ai/akg --skill triton-ascend-attentiongit clone --depth 1 https://github.com/mindspore-ai/akgWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-attention)<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-attention"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-attention/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mindspore-ai/akg/triton-ascend-attention"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/triton-ascend-attention.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00122 | $0.00873 |
| Opus 5 | $0.00061 | $0.00436 |
| Sonnet 5 | $0.00024 | $0.00175 |
| Haiku 4.5 | $0.00012 | $0.00087 |
Grade A, and why
triton-ascend-attention scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Attention 算子优化
标准 Attention 计算流程
标准的 Scaled Dot-Product Attention:
Attention(Q, K, V) = softmax(Q @ K^T / sqrt(d_k)) @ V
三个阶段
- QK^T 计算:
scores = Q @ K^T / sqrt(d_k),计算注意力分数 - Softmax 归一化:
attn_weights = softmax(scores),确保权重和为1 - 加权求和:
output = attn_weights @ V,得到最终输出
标准实现的问题
# 朴素实现(内存开销大)
scores = (Q @ K.T) / sqrt(d_k) # (seq_len, seq_len)
attn_weights = softmax(scores) # 需要存储完整注意力矩阵
output = attn_weights @ V
问题:
- 需要存储
(seq_len, seq_len)的注意力矩阵 - 内存占用: O(seq_len²)
- 对于长序列(seq_len = 4096),内存占用巨大
Flash Attention 优化策略
Flash Attention 通过分块计算和在线 Softmax 避免存储完整注意力矩阵。
核心思想
- 分块计算: 将大矩阵分块处理,减少内存占用
- 在线 Softmax: 使用增量式 softmax 算法,分块计算,维护全局最大值和归一化因子
- 避免存储: 不存储完整注意力矩阵
在线 Softmax 算法
关键是维护全局统计量,逐块更新:
# 初始化全局统计量
m_i = -float("inf") # 全局最大值
l_i = 0.0 # 全局 exp 和
acc = 0.0 # 输出累加器
# 分块处理
for start_n in range(0, seq_len, BLOCK_SIZE):
# 1. 加载当前块的分数
scores = tl.load(scores_ptr + start_n, mask=load_mask, other=-float("inf"))
# 2. 更新全局最大值
m_ij = tl.maximum(m_i, tl.max(scores, 0))
# 3. 计算当前块的 exp 值(数值稳定化)
scores = scores - m_ij
p = tl.math.exp2(scores * 1.44269504) # log2(e)
# 4. 更新全局 exp 和
l_ij = tl.sum(p, 0)
alpha = tl.math.exp2((m_i - m_ij) * 1.44269504)
l_i = l_i * alpha + l_ij
# 5. 更新输出累加器
acc = acc * alpha + p
# 6. 更新全局最大值
m_i = m_ij
# 最终归一化
acc = acc / l_i
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 88 lines · 122 tokens per session scan A 90b28a41c892
triton-ascend-attention is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 122 tokens to every session and 873 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
fs-notebook-tabs
A computer-science capstone: an on-device ML keyboard that predicts next words privately — problem, method, evaluation, and defense answers. Built as a decision-grade coursework defense deck for professor, defense committee.
implementing-llms-litgpt
Implements and trains LLMs using Lightning AI's LitGPT with 20+ pretrained architectures (Llama, Gemma, Phi, Qwen, Mistral). Use when need clean model implementations, educational understanding of architectures, or production fine-tuning with LoRA/QLoRA. Single-file implementations, no abstraction layers.
nanogpt
Educational GPT implementation in 300 lines. Reproduces GPT-2 (124M) on OpenWebText. Clean, hackable code for learning transformers. By Andrej Karpathy. Perfect for understanding GPT architecture from scratch. Train on Shakespeare (CPU) or OpenWebText (multi-GPU).
rwkv-architecture
RNN+Transformer hybrid with O(n) inference. Linear time, infinite context, no KV cache. Train like GPT (parallel), infer like RNN (sequential). Linux Foundation AI project. Production at Windows, Office, NeMo. RWKV-7 (March 2025). Models up to 14B parameters.
lesson-quiz
Test a learner on a single Claude Code tutorial lesson (01-10) with 10 questions, scoring answers and flagging weak spots. Use before, during, or after a lesson. Don't use for whole-tutorial assessment or explaining a topic instead of testing it.
kaggle-learner
This skill should be used when the user asks to "learn from Kaggle", "study Kaggle solutions", "analyze Kaggle competitions", or mentions Kaggle competition URLs. Provides access to extracted knowledge from winning Kaggle solutions across NLP, CV, time series, tabular, and multimodal domains.