KEMBAR78
[None] [chore] cherry pick changes on slurm scripts from `release/1.1.0rc2` by kaiyux · Pull Request #7750 · NVIDIA/TensorRT-LLM · GitHub
Skip to content

Conversation

@kaiyux
Copy link
Member

@kaiyux kaiyux commented Sep 16, 2025

Summary by CodeRabbit

  • New Features

    • Added build_config options (max_batch_size, max_num_tokens, max_seq_len) for both context and generation configurations.
  • Bug Fixes

    • Improved dataset sampling to cycle through prompts, avoid early termination, and handle empty prompts more robustly; may return fewer requests when inputs are filtered.
    • Stabilized profiling behavior: ensured the profiling toggle is set before job launch, applied the profiler to the full process, and restricted profiling to the generator on rank 0 to reduce overhead.

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 the stage-list parameter 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.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip 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-pipeline

Reuse 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.

Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
@kaiyux kaiyux requested review from a team as code owners September 16, 2025 02:24
@kaiyux kaiyux changed the title chore: cherry pick changes on slurm scripts chore: cherry pick changes on slurm scripts from release/1.1.0rc2 Sep 16, 2025
@kaiyux kaiyux changed the title chore: cherry pick changes on slurm scripts from release/1.1.0rc2 [None] [chore] cherry pick changes on slurm scripts from release/1.1.0rc2 Sep 16, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

📝 Walkthrough

Walkthrough

Moves 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

Cohort / File(s) Summary of changes
SLURM profiling/toggling
examples/disaggregated/slurm/benchmark/disaggr_torch.slurm, examples/disaggregated/slurm/benchmark/start_worker.sh
Relocated nsys_on initialization below full_logdir; profiling remains disabled by default. In start_worker.sh, gate profiling to role==GEN and SLURM_PROCID==0; apply nsys as a prefix wrapping the entire trtllm-llmapi-launch invocation.
Worker config build_config additions
examples/disaggregated/slurm/benchmark/gen_worker_config.py
Added ctx_config.build_config and gen_config.build_config with max_batch_size, max_num_tokens, max_seq_len mapped from existing parameters. No signature or other logic changes.
Dataset sampling control flow
tensorrt_llm/serve/scripts/benchmark_dataset.py
RandomDataset.sample now cycles dataset with modulo over num_requests, removes strict length assertion, continues skipping empty prompts and using cached tokens. VisionArenaDataset.sample introduces sampled_requests accumulator and returns via maybe_oversample_requests.

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
Loading
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)
Loading
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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title follows the repository tagging style and concisely states a chore to cherry-pick slurm-script changes from release/1.1.0rc2. It is related to the changeset because several modified files are slurm-related (e.g., examples/disaggregated/slurm/benchmark/disaggr_torch.slurm and start_worker.sh). However, the PR also includes non-slurm edits (gen_worker_config.py and tensorrt_llm/serve/scripts/benchmark_dataset.py), so the title is only partially descriptive of the full scope and could be broadened for clarity.
Description Check ✅ Passed The PR body includes the repository template and a short Description that explicitly states this is a cherry-pick of PRs 7409 and 7453, so the core intent is present. The Test Coverage section is empty and the description lacks a concise, explicit summary of the file-level changes, test impact, and why the cherry-pick is required. Because the template is mostly present and the cherry-pick targets are identified, the description can pass but should be completed before merging.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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:
                 break

Optionally 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 profiling
tensorrt_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

📥 Commits

Reviewing files that changed from the base of the PR and between e5cead1 and e030e00.

📒 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.py
  • tensorrt_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.py
  • tensorrt_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.py
  • tensorrt_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.

@kaiyux kaiyux enabled auto-merge (squash) September 16, 2025 02:57
@kaiyux
Copy link
Member Author

kaiyux commented Sep 16, 2025

/bot skip --comment "slurm scripts are not currently protected by pipeline"

1 similar comment
@kaiyux
Copy link
Member Author

kaiyux commented Sep 16, 2025

/bot skip --comment "slurm scripts are not currently protected by pipeline"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18740 [ skip ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #18740 [ skip ] completed with state SUCCESS
Skipping testing for commit e030e00

@kaiyux kaiyux merged commit 6eef192 into NVIDIA:main Sep 16, 2025
8 of 15 checks passed
@kaiyux kaiyux deleted the user/kaiyu/cherry-pick-slurm-scripts branch September 16, 2025 08:25
Wong4j pushed a commit to Wong4j/TensorRT-LLM that referenced this pull request Sep 20, 2025
….0rc2` (NVIDIA#7750)

Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
MrGeva pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request Sep 21, 2025
….0rc2` (NVIDIA#7750)

Signed-off-by: Kaiyu Xie <26294424+kaiyux@users.noreply.github.com>
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.

3 participants