ソース情報
- リポジトリ
- mindspore-ai/akg
- ソースの最終更新活動
- 2026年3月2日 02:46
- 検出された SKILL.md の言語
- 中国語
- スター
- 259
- フォーク
- 48
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
メニュー
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/mindspore-ai/akg --skill pypto-case-elemwise-geluコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
矩阵乘法矩阵乘法 A[M, K] @ B[K, N] = C[M, N]中,大K维度矩阵乘法(K>>M,N)优化:针对M/N较小但K极大(如M=N=256,K=131072)的场景,Split-K切分K维度并行化、Workspace+Reduce替代全局同步,实现显著性能提升
Triton Ascend hard API restrictions and forbidden syntax. MUST-follow rules that apply to every kernel: forbidden control flow (return/break/continue/lambda/while), tensor slice/index restrictions, scalar conversion rules, BLOCK_SIZE upper bound. Violating any of these produces a compile or runtime error on Ascend.
Triton Ascend 性能优化通用策略: BLOCK_SIZE 选择 (1024-2048 for elementwise, must be <65536), grid configuration (use VEC_CORE_NUM / CUBE_CORE_NUM, 2D/3D grid for matmul / conv / reduce, 1D grid + inner loop for elementwise / pointwise), 256B alignment for memory transfers, autotune block-size patterns, fp16 / fp32 precision conversion. Bind via keywords like matmul, elementwise, reduce, block_size, grid, autotune, alignment, fp16, fp32, tile, interleaved-loop, cube-core, vec-core.
SOC 職業分類に基づく
SKILL.md を表示中
| name | pypto-case-elemwise-gelu |
| description | 模式 A 示例:1D elementwise — GELU 激活,展示展平、无 tanh 时的手写公式、运算符使用 |
| category | example |
| version | 1.0.0 |
| metadata | {"backend":"ascend","dsl":"pypto","operator_patterns":"elementwise,activation"} |
def create_gelu_kernel(flat_size):
@pypto.frontend.jit(runtime_options=..., debug_options=...)
def gelu_kernel(
x: pypto.Tensor((flat_size,), pypto.DT_FP32),
) -> pypto.Tensor((flat_size,), pypto.DT_FP32):
output = pypto.tensor([flat_size], pypto.DT_FP32)
pypto.set_vec_tile_shapes(8192)
x_cubed = x * x * x
inner = x + x_cubed * 0.044715
tanh_arg = inner * 0.7978845608028654
exp_pos = pypto.exp(tanh_arg * 2.0)
tanh_val = (exp_pos - 1.0) / (exp_pos + 1.0)
output[:] = x * 0.5 * (1.0 + tanh_val)
return output
return gelu_kernel
forward:reshape(-1) → kernel → reshape(x.shape)
assert dim + shape,reshape(-1) 展平为 1Dset_vec_tile_shapes(8192) — 1D 只需一个参数(exp(2x)-1)/(exp(2x)+1) — 注意 exp_pos - 1.0 中 Tensor 在左,合法Tensor op scalar 合法;若需 scalar op Tensor 则改写