Skip to content

feat(tools): add triton_kernel_extractor pipeline#706

Merged
Xreki merged 1 commit into
PaddlePaddle:developfrom
JewelRoam:feat/triton-kernel-extractor
May 14, 2026
Merged

feat(tools): add triton_kernel_extractor pipeline#706
Xreki merged 1 commit into
PaddlePaddle:developfrom
JewelRoam:feat/triton-kernel-extractor

Conversation

@JewelRoam
Copy link
Copy Markdown
Collaborator

@JewelRoam JewelRoam commented May 14, 2026

从 PassNet 仓库( PaddlePaddle/PassNet#80 )迁移 triton_kernel_extractor 到 GraphNet。该工具依赖 graph_net_bench.torch.test_compilergraph_net_visual ,遂放在同一仓库下。

功能

对子图样本执行五步流水线,产出配对的 subgraph, triton_kernel, ptx

  1. 多 GPU 并行编译(通过 graph_net_bench.torch.test_compiler --kernel-time
  2. 根据 [Speedup][kernel]: 指标筛选正优化样本
  3. 清除编译产物中的临时文件
  4. output_code.py 提取 autotuning 选中的 Triton kernel 源码 + 对应 PTX
  5. 清理无 Triton kernel 的空样本

用法

# 通过 bash launcher(按类别循环)
bash tools/extract_triton_kernels.sh [gpu_ids]

# 直接 Python 调用
python3 -m tools.triton_kernel_extractor extract \
    --allow-list paths.txt \
    --graph-dir /data/graphs \
    --output-dir /data/output \
    --max-autotune-no-cudagraphs

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 14, 2026

Thanks for your contribution!

@JewelRoam JewelRoam force-pushed the feat/triton-kernel-extractor branch from 1cefba0 to 5db658d Compare May 14, 2026 08:28
Xreki
Xreki previously approved these changes May 14, 2026
@JewelRoam JewelRoam force-pushed the feat/triton-kernel-extractor branch from 5db658d to 8638de1 Compare May 14, 2026 08:29
Migrate from PassNet. This tool compiles subgraphs via
graph_net_bench.torch.test_compiler, filters by speedup, and extracts
autotuning-selected (subgraph, triton_kernel, ptx) triples.

Now that it lives in GraphNet, PYTHONPATH for graph_net_bench is
resolved automatically from the repo root.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@JewelRoam JewelRoam force-pushed the feat/triton-kernel-extractor branch from 8638de1 to 6d28d69 Compare May 14, 2026 08:33
Copy link
Copy Markdown
Collaborator

@Xreki Xreki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先合入一版

@Xreki Xreki merged commit 540d57f into PaddlePaddle:develop May 14, 2026
3 checks passed
@JewelRoam JewelRoam deleted the feat/triton-kernel-extractor branch May 14, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants