-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[None] [chore] cherry pick changes on slurm scripts from release/1.1.0rc2
#7750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[None] [chore] cherry pick changes on slurm scripts from release/1.1.0rc2
#7750
Conversation
Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
release/1.1.0rc2
release/1.1.0rc2release/1.1.0rc2
📝 WalkthroughWalkthroughMoves Nsys toggle definition in SLURM script before srun usage; tightens and restructures profiling wrapper in worker launcher to only profile GEN rank 0 and wrap the whole launch. Adds nested build_config blocks to generated worker configs. Revises dataset sampling loops for RandomDataset and VisionArenaDataset control flow. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant SLURM as SLURM
participant start as start_worker.sh
participant nsys as nsys (prefix)
participant launcher as trtllm-llmapi-launch
participant serve as trtllm-serve
SLURM->>start: Launch with env (ROLE, SLURM_PROCID, ...)
alt ROLE==GEN and SLURM_PROCID==0
start->>nsys: Prepare nsys prefix
nsys->>launcher: Execute wrapped launch
else
start->>launcher: Execute launch (no profiling)
end
launcher->>serve: Spawn serving process
serve-->>launcher: Runtime
launcher-->>start: Exit
sequenceDiagram
autonumber
participant Caller
participant RandomDataset
Caller->>RandomDataset: sample(num_requests)
RandomDataset->>RandomDataset: dataset_len = len(dataset)
loop i in range(num_requests)
RandomDataset->>RandomDataset: idx = i % dataset_len
RandomDataset->>RandomDataset: fetch prompt/len/cached
alt prompt empty
Note over RandomDataset: skip
else
RandomDataset-->>Caller: append request (deferred, collected)
end
end
RandomDataset-->>Caller: return collected requests (<= num_requests)
sequenceDiagram
autonumber
participant Caller
participant VisionArenaDataset
Caller->>VisionArenaDataset: sample(num_requests)
VisionArenaDataset->>VisionArenaDataset: sampled_requests = []
loop sampling
VisionArenaDataset->>VisionArenaDataset: build request
VisionArenaDataset->>VisionArenaDataset: append to sampled_requests
end
VisionArenaDataset->>VisionArenaDataset: maybe_oversample_requests(sampled_requests)
VisionArenaDataset-->>Caller: return results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
examples/disaggregated/slurm/benchmark/gen_worker_config.py (2)
25-49: Docstring arguments are out of sync with the signature.The docstring lists parameters like config_path, model_path, worker ports, etc., which aren’t in the signature. Update to the current arg list so downstream users don’t misconfigure.
Apply:
@@ - Args: - config_path: Path to save the config file - model_path: Path to the model - num_ctx_servers: Number of context servers - ctx_tp_size: Tensor parallel size for context servers - ctx_pp_size: Pipeline parallel size for context servers - ctx_batch_size: Batch size for context servers - ctx_max_num_tokens: Max number of tokens for context servers - ctx_max_seq_len: Max sequence length for context servers - ctx_free_gpu_memory_fraction: Free GPU memory fraction for context servers - ctx_enable_attention_dp: Enable attention DP for context servers - num_gen_servers: Number of generation servers - gen_tp_size: Tensor parallel size for generation servers - gen_pp_size: Pipeline parallel size for generation servers - gen_batch_size: Batch size for generation servers - gen_max_num_tokens: Max number of tokens for generation servers - gen_enable_attention_dp: Enable attention DP for generation servers - gen_gpu_memory_fraction: GPU memory fraction for generation servers - eplb_num_slots: Number of slots for eplb - worker_start_port: Start port for workers - server_port: Server port + Args: + work_dir: Directory where ctx/gen YAML configs are written. + ctx_tp_size: Tensor parallel size for context servers. + ctx_pp_size: Pipeline parallel size for context servers. + ctx_batch_size: Max batch size for context servers. + ctx_max_num_tokens: Max tokens per batch for context servers. + ctx_max_seq_len: Max sequence length for context servers. + ctx_free_gpu_memory_fraction: Free GPU memory fraction for ctx KV cache. + ctx_enable_attention_dp: Whether to enable attention DP on ctx. + gen_tp_size: Tensor parallel size for generation servers. + gen_pp_size: Pipeline parallel size for generation servers. + gen_batch_size: Max batch size for generation servers. + gen_max_num_tokens: Max tokens per batch for generation servers. + gen_max_seq_len: Max sequence length for generation servers. + gen_enable_attention_dp: Whether to enable attention DP on gen. + gen_gpu_memory_fraction: GPU memory fraction for gen KV cache. + eplb_num_slots: Number of MoE load balancer slots; 0 disables LB. + mtp_size: Number of next-n predict layers for speculative decoding (MTP). + cache_transceiver_max_num_tokens: Max tokens buffered in transceiver.
1-1: Add required NVIDIA Apache-2.0 header.Repository guideline mandates the header on all .py files.
Apply at the top of the file:
+# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License in the LICENSE file accompanying this source.tensorrt_llm/serve/scripts/benchmark_dataset.py (2)
1134-1152: Break condition uses an unmodified list; loop will scan the entire dataset.You added sampled_requests but the loop still checks len(prompts). Since prompts isn’t updated here, the loop never early-breaks.
Apply:
- sampled_requests = [] - for item in self.data: - if len(prompts) >= num_requests: + sampled_requests = [] + for item in self.data: + if len(sampled_requests) >= num_requests: breakOptionally remove the unused prompts list above to avoid confusion.
1-4: Add required NVIDIA Apache-2.0 header and ensure Python 3.8 typing compatibility.This file lacks the mandated header and uses PEP 585 generics (list[str]) which require Python 3.9+ unless postponed evaluation is enabled.
Apply at file top:
+# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License in the LICENSE file accompanying this source. +from __future__ import annotations
🧹 Nitpick comments (4)
examples/disaggregated/slurm/benchmark/gen_worker_config.py (2)
87-92: Same duplication in gen_config.Mirror of the ctx_config comment: either keep both locations intentionally with a deprecation plan, or consolidate to one to avoid value skew.
51-56: Keep or consolidate duplicated max_ fields — builder reads top-level keys.*tensorrt_llm/builder.py pops 'max_seq_len', 'max_batch_size', 'max_num_tokens' from the top-level config (≈lines 616–624) and then uses build_config.* across the module. If both top-level and build_config entries must exist for backward compatibility, add a clear TODO and centralize a single source-of-truth (derive one from the other) so values stay in sync; otherwise remove the redundant top-level keys and update consumers.
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm (1)
97-99: Place the “enable nsys” assignment after the final full_logdir value is known.If a user uncomments the line here, later mutations of full_logdir (e.g., in the PDL branch) won’t be reflected, causing profiles to land in the wrong folder.
Apply:
-nsys_on="" -# nsys_on=${full_logdir} # Uncomment this line to enable Nsys profiling +nsys_on=""Then add the enable line after mkdir -p and the “Log will be saved” echo:
@@ mkdir -p ${full_logdir} echo "Log will be saved to: ${full_logdir}" +# nsys_on=${full_logdir} # Uncomment to enable Nsys profilingtensorrt_llm/serve/scripts/benchmark_dataset.py (1)
510-527: Tokenization consistency for exact lengths (minor).When recomputing token IDs, use add_special_tokens=False consistently so slicing to input_lens[i] yields precise lengths. This also aligns with past guidance for random token flows.
Apply:
- prompt_token_ids_for_truncation = tokenizer.encode(prompt) + prompt_token_ids_for_truncation = tokenizer.encode( + prompt, add_special_tokens=False)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm(1 hunks)examples/disaggregated/slurm/benchmark/gen_worker_config.py(2 hunks)examples/disaggregated/slurm/benchmark/start_worker.sh(1 hunks)tensorrt_llm/serve/scripts/benchmark_dataset.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use only spaces, no tabs; indent with 4 spaces.
Files:
examples/disaggregated/slurm/benchmark/gen_worker_config.pytensorrt_llm/serve/scripts/benchmark_dataset.py
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.
Files:
examples/disaggregated/slurm/benchmark/gen_worker_config.pytensorrt_llm/serve/scripts/benchmark_dataset.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).
Files:
examples/disaggregated/slurm/benchmark/gen_worker_config.pytensorrt_llm/serve/scripts/benchmark_dataset.py
🧠 Learnings (1)
📚 Learning: 2025-08-18T08:42:02.640Z
Learnt from: samuellees
PR: NVIDIA/TensorRT-LLM#6974
File: tensorrt_llm/serve/scripts/benchmark_dataset.py:558-566
Timestamp: 2025-08-18T08:42:02.640Z
Learning: In TensorRT-LLM's RandomDataset (tensorrt_llm/serve/scripts/benchmark_dataset.py), when using --random-token-ids option, sequence length accuracy is prioritized over semantic correctness for benchmarking purposes. The encode/decode operations should use skip_special_tokens=True and add_special_tokens=False to ensure exact target token lengths.
Applied to files:
tensorrt_llm/serve/scripts/benchmark_dataset.py
🧬 Code graph analysis (1)
tensorrt_llm/serve/scripts/benchmark_dataset.py (1)
tensorrt_llm/executor/result.py (1)
prompt_token_ids(528-529)
🪛 Shellcheck (0.10.0)
examples/disaggregated/slurm/benchmark/start_worker.sh
[warning] 70-70: Quotes/backslashes will be treated literally. Use an array.
(SC2089)
[warning] 75-75: Quotes/backslashes in this variable will not be respected.
(SC2090)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (1)
examples/disaggregated/slurm/benchmark/start_worker.sh (1)
68-72: Profiling gate LGTM.Profiling only GEN rank 0 reduces noise and overhead while preserving a representative trace.
Confirm that TLLM_PROFILE_START_STOP=200-250 matches actual iteration numbering; otherwise adjust to capture warm steady-state.
|
/bot skip --comment "slurm scripts are not currently protected by pipeline" |
1 similar comment
|
/bot skip --comment "slurm scripts are not currently protected by pipeline" |
|
PR_Github #18740 [ skip ] triggered by Bot |
|
PR_Github #18740 [ skip ] completed with state |
….0rc2` (NVIDIA#7750) Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
….0rc2` (NVIDIA#7750) Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
Summary by CodeRabbit
New Features
Bug Fixes
Description
Cherry-pick #7409 and #7453.
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.