feat: add single-operator subgraph dataset generation script#635
Merged
lixinqi merged 7 commits intoPaddlePaddle:developfrom Feb 9, 2026
Merged
feat: add single-operator subgraph dataset generation script#635lixinqi merged 7 commits intoPaddlePaddle:developfrom
lixinqi merged 7 commits intoPaddlePaddle:developfrom
Conversation
This commit introduces `generate_single_op_dataset.sh` to automate the workflow for generating single-operator subgraph datasets.
|
Thanks for your contribution! |
Xreki
reviewed
Feb 5, 2026
| # Virtual Environment Python Executable Path | ||
| PYTHON_EXEC="/workspace/venv_graphnet/bin/python3" | ||
| # Project Root Directory | ||
| GRAPH_NET_ROOT="/workspace/GraphNet" |
Collaborator
There was a problem hiding this comment.
你参考下generate_subgraph_dataset.sh,这些都不要hardcode。
| "model_path_prefix": PROJECT_ROOT, | ||
| "output_dir": workspace | ||
| }) | ||
| run_stage_cmd(env, PROJECT_ROOT, [ |
Refactor script for dynamic path detection and improved error handling. Added logging and workspace setup enhancements.
Xreki
reviewed
Feb 9, 2026
| LOG_DIR="${WORKSPACE}/logs" # New: Dedicated log directory | ||
|
|
||
| export PYTHONPATH="${GRAPH_NET_ROOT}:${PYTHONPATH}" | ||
| export GRAPH_NET_ROOT PYTHON_EXEC WORKSPACE OP_NAMES_DIR RANGES_DIR RAW_SUBGRAPH_DIR RESUME LOG_DIR |
Collaborator
There was a problem hiding this comment.
这里多余了。L21能成功就不需要L54,另外L55什么作用?
| # ============================================================================== | ||
| # Core Logic: Single Model Processing (V3: Strict Error Checking) | ||
| # ============================================================================== | ||
| process_single_model() { |
Collaborator
There was a problem hiding this comment.
每个步骤都是批量执行模型的,不是single_model
| EOF | ||
| )" | ||
|
|
||
| run_step "OpNames" "$cmd_s1" || { rm -f "${tmp_list}"; return 1; } |
Collaborator
There was a problem hiding this comment.
不要再封装run_step函数了,这让整个脚本变得复杂,直接执行。
| split -l ${lines_per_gpu} -d "${WORKSPACE}/clean_list.txt" "${WORKSPACE}/gpu_chunk_" | ||
|
|
||
| # 3. Parallel Execution | ||
| for (( i=0; i<NUM_GPUS; i++ )); do |
Collaborator
There was a problem hiding this comment.
脚本里面不必加并行执行。若要支持并行支持,应该是在apply_sample_pass和model_path_handler层面统一添加。
即使在脚本里面加,也不需要L179和L188两层循环。所有处理步骤都是接受一个model_path_list,把总的model_list拆成NUM_GPUS,每个GPU处理一个list。
Xreki
reviewed
Feb 9, 2026
| exit 1 | ||
| fi | ||
|
|
||
| grep -v "^#" "${MODEL_LIST}" | grep -v "^$" > "${WORKSPACE}/clean_list.txt" |
| find ${RAW_SUBGRAPH_DIR} -name "model.py" \ | ||
| | xargs dirname \ | ||
| | xargs realpath --relative-to=${RAW_SUBGRAPH_DIR} \ | ||
| > "${WORKSPACE}/raw_list.txt" |
lixinqi
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Feature Enhancement
Summary
This PR adds a new shell script
generate_single_op_dataset.shto support the generation of single-operator subgraphs. This is a critical step for building the single-op dataset used in kernel benchmarking.Key Changes
generate_single_op_dataset.shTest Plan
Ran the script on 10 sample models (small scale).
bash generate_single_op_dataset.shChecklist