Skip to content

Add tools/expand_graph_paths.sh#80

Open
JewelRoam wants to merge 13 commits into
PaddlePaddle:developfrom
JewelRoam:midtrain
Open

Add tools/expand_graph_paths.sh#80
JewelRoam wants to merge 13 commits into
PaddlePaddle:developfrom
JewelRoam:midtrain

Conversation

@JewelRoam
Copy link
Copy Markdown
Contributor

@JewelRoam JewelRoam commented Apr 21, 2026

根据 sample_lists 找到 graph_list,从而找到子图路径

Usage:

  bash expand_graph_paths.sh

JewelRoam and others added 8 commits April 21, 2026 17:54
Move the 498-line monolithic bash script logic into
tools/triton_kernel_extractor/, a structured Python module with clear
separation of concerns (config, sample enumeration, multi-GPU compilation,
speedup filtering, kernel extraction, cleanup). The bash entry script is
reduced to a thin launcher that sets machine-specific paths and delegates
to `python3 -m tools.triton_kernel_extractor`. CLI interface unchanged:
`bash extract_triton_kernels.sh <source> [gpu_ids]`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend Step 4 of the extraction pipeline to locate and pair each triton
kernel with its PTX assembly from the inductor cache.  When multiple
autotuning candidates exist, the winning configuration is identified via
the .best_config triton_cache_hash field.  Add package README documenting
the full pipeline, PTX resolution algorithm, and output structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add cache_analyzer.py: replaces analyze_inductor_cache.sh with a Python
  module that concatenates logs, computes speedup statistics, and generates
  distribution plots.
- Add 'analyze' subcommand to CLI with backward-compatible implicit 'extract'
  for the old --source-first invocation style.
- Add --enable-cache-analysis flag to run analysis after extraction pipeline.
- Harden kernel_extractor.py: guard file reads with try/except OSError,
  deduplicate kernel names across multiple output_code.py files per sample,
  remove dead KeyError from exception handler.
- Extract shared is_sample_dir() into config.py, remove duplicates from
  speedup_filter.py and cache_analyzer.py.
- Replace assert with explicit raise ValueError in pipeline.py for -O safety.
- Update README with simplified cache analysis section and CLI arguments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Thread the GraphNet inductor config template through the compilation
pipeline: CLI flag → PipelineConfig → base64-encoded --config arg on
test_compiler subprocess.  The flag is off by default; the bash launcher
enables it alongside --enable-cache-analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename ai4c_base → passnet_dir, graphnet_hf_dir → passnet_hf_dir
- Update DATASET_NAMES to match actual dirs in graphs/hf_subgraphs_v2/
- Fix stale max-autotune config: use {"mode": "max-autotune"} for
  current GraphNet InductorBackend API
- Keep all graph_net_bench/graph_net_visual/--kernel-time references
  (still calls into external GraphNet repo)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Comment thread tools/triton_kernel_extractor/__main__.py Outdated
Comment thread tools/triton_kernel_extractor/__main__.py Outdated
Comment thread tools/triton_kernel_extractor/cache_analyzer.py Outdated
JewelRoam and others added 4 commits May 14, 2026 14:31
Move SPEEDUP_E2E_PATTERN to config.py alongside SPEEDUP_KERNEL_PATTERN
so all GraphNet log-parsing patterns are defined in one place.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove DATASET_NAMES, --source, --graphnet-dir from Python CLI/config
- Rename --data-dir to --graph-dir; --allow-list determines scan behavior
- Rename ambiguous graph_dir loop variables to sample_cache_dir
- Fix compute_unique_dir fallback producing _-prefixed names (skipped by filter)
- Fix max_autotune config key to use {"mode": "max-autotune"} (GraphNet API change)
- Bash launcher simplified: always uses list mode, no MODE parameter
- README rewritten: Python-only usage, default values in CLI args table
- Format all files with black

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Align CLI flag and config field with the actual torch.compile mode value.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@JewelRoam
Copy link
Copy Markdown
Contributor Author

--max-autotune CLI 参数已改为 --max-autotune-no-cudagraphs

The tool is tightly coupled to GraphNet's graph_net_bench and
graph_net_visual modules. Moving it to GraphNet eliminates cross-repo
API breakage and simplifies PYTHONPATH management.

See: https://github.com/JewelRoam/GraphNet/tree/feat/triton-kernel-extractor

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@JewelRoam JewelRoam changed the title Add mid train dataset generation scripts Add tools/expand_graph_paths.sh May 14, 2026
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