Skip to content

[https://nvbugs/6337224][fix] Update PERF_SANITY_DIR to include aggregated/; in recipe_to_server_config - #15484

Merged
chenfeiz0326 merged 2 commits into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6337224
Jul 29, 2026
Merged

[https://nvbugs/6337224][fix] Update PERF_SANITY_DIR to include aggregated/; in recipe_to_server_config#15484
chenfeiz0326 merged 2 commits into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6337224

Conversation

@tensorrt-cicd

@tensorrt-cicd tensorrt-cicd commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Summary by CodeRabbit

  • Chores
    • Updated internal test configuration generation with improved directory structure and enhanced environment variable handling for performance testing infrastructure.

…h committed YAMLs

Two issues caused tests/unittest/tools/test_config_database_sync.py::
test_config_database_tests_sync to fail:

1. PERF_SANITY_DIR pointed at tests/scripts/perf-sanity/ but the committed
   config_database_*.yaml files were moved to perf-sanity/aggregated/ in
   PR NVIDIA#11802 (commit 22c4706). The sync test's glob found no files,
   while the regenerator emitted two, producing a filename-set mismatch.

2. PR NVIDIA#14438 (commit 26c099f) hand-edited the committed b200/h200
   YAMLs to add server_env_var: "TLLM_SPEC_DECODE_FORCE_NUM_ACCEPTED_TOKENS=<N>"
   on every entry whose recipe had speculative_config.max_draft_len, but
   the regenerator was never updated. After fix NVIDIA#1, the test surfaced this
   content drift on per-file YAML comparison.

Fix the regenerator to:
- write/glob from tests/scripts/perf-sanity/aggregated/
- emit server_env_var = "TLLM_SPEC_DECODE_FORCE_NUM_ACCEPTED_TOKENS=<max_draft_len>"
  whenever the recipe's loaded LLM API config has speculative_config.max_draft_len,
  with the value emitted as a double-quoted YAML scalar to match the committed
  style (consistent with sibling YAMLs in the same directory).

Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The script adds a _DoubleQuoted string subclass with a YAML representer to force double-quoted output. PERF_SANITY_DIR is updated to a deeper aggregated subdirectory. In recipe_to_server_config, when max_draft_len is present in speculative_config, a server_env_var entry with TLLM_SPEC_DECODE_FORCE_NUM_ACCEPTED_TOKENS is injected into the generated server configuration.

Changes

Spec-decode env var injection in generated test configs

Layer / File(s) Summary
Double-quoted YAML helper and output dir update
scripts/generate_config_database_tests.py
Defines _DoubleQuoted str subclass and registers a YAML representer for forced double-quote emission; updates PERF_SANITY_DIR to point at perf-sanity/aggregated.
Spec-decode env var injection in recipe_to_server_config
scripts/generate_config_database_tests.py
Reads max_draft_len from llm_api_config["speculative_config"]; when present, builds server_env_var with TLLM_SPEC_DECODE_FORCE_NUM_ACCEPTED_TOKENS=<max_draft_len> using _DoubleQuoted and merges it into server_config.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the two main changes: updating PERF_SANITY_DIR to include aggregated/ and modifying recipe_to_server_config with environment variable injection.
Description check ✅ Passed The description includes a clear summary of the issues, fixes applied, and test plan. It references related PRs and provides the bug tracking link, which aligns well with the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/generate_config_database_tests.py (1)

99-114: ⚡ Quick win

Make server_env_var precedence explicit to avoid silent overwrite.

server_env_var is injected first, but then the llm_api_config copy loop can overwrite it. Moving forced env injection after the copy loop makes the deterministic override behavior explicit.

♻️ Proposed refactor
-    spec_env = (
-        {
-            "server_env_var": _DoubleQuoted(
-                f"TLLM_SPEC_DECODE_FORCE_NUM_ACCEPTED_TOKENS={max_draft_len}"
-            )
-        }
-        if max_draft_len is not None
-        else {}
-    )
-
     server_config = {
         "name": generate_server_name(recipe),
-        **spec_env,
         "model_name": model_name,
         "gpus": recipe.num_gpus,
         # Enable scenario-only matching for baseline comparison
         "match_mode": "scenario",
     }

     # Copy LLM API config fields
     for key, value in llm_api_config.items():
         server_config[key] = value
+
+    if max_draft_len is not None:
+        server_config["server_env_var"] = _DoubleQuoted(
+            f"TLLM_SPEC_DECODE_FORCE_NUM_ACCEPTED_TOKENS={max_draft_len}"
+        )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/generate_config_database_tests.py` around lines 99 - 114, The
server_env_var from spec_env is currently being unpacked into server_config
early (using **spec_env), but this can be silently overwritten by subsequent
operations that copy llm_api_config into server_config. Move the unpacking of
spec_env to after the llm_api_config is copied into server_config so that the
forced speculative decoding environment variable takes explicit precedence and
is not accidentally overwritten. This ensures the deterministic max_draft_len
override is guaranteed to be preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/generate_config_database_tests.py`:
- Line 56: The deeper nested path in PERF_SANITY_DIR can cause FileNotFoundError
when writing generated YAML files if the directory doesn't exist beforehand. Add
an explicit mkdir call for test_config_dir near the beginning of the
generate_tests function to ensure the full directory structure is created before
any file write operations occur, particularly when using custom output
directories.

---

Nitpick comments:
In `@scripts/generate_config_database_tests.py`:
- Around line 99-114: The server_env_var from spec_env is currently being
unpacked into server_config early (using **spec_env), but this can be silently
overwritten by subsequent operations that copy llm_api_config into
server_config. Move the unpacking of spec_env to after the llm_api_config is
copied into server_config so that the forced speculative decoding environment
variable takes explicit precedence and is not accidentally overwritten. This
ensures the deterministic max_draft_len override is guaranteed to be preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0552d63c-4dc6-4596-a355-274054536913

📥 Commits

Reviewing files that changed from the base of the PR and between 4a8b7af and 252e5e9.

📒 Files selected for processing (1)
  • scripts/generate_config_database_tests.py

Comment thread scripts/generate_config_database_tests.py
@chenfeiz0326
chenfeiz0326 enabled auto-merge (squash) July 10, 2026 06:00
@chenfeiz0326

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast --stage-list "A10-PyTorch-1"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #58611 [ run ] triggered by Bot. Commit: 252e5e9 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #58611 [ run ] completed with state SUCCESS. Commit: 252e5e9
/LLM/main/L0_MergeRequest_PR pipeline #47201 (Partly Tested) completed with status: 'SUCCESS'

CI Report

Link to invocation

@brnguyen2
brnguyen2 requested review from a team as code owners July 29, 2026 13:05
@brnguyen2
brnguyen2 requested review from kaiyux and laikhtewari July 29, 2026 13:05
@brnguyen2

Copy link
Copy Markdown
Collaborator

/bot run --disable-fail-fast --stage-list "A10-PyTorch-1"

@brnguyen2

Copy link
Copy Markdown
Collaborator

/bot kill

@brnguyen2

Copy link
Copy Markdown
Collaborator

/bot skip --comment "Fix a ut, no need to run the whole CI pipeline"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #62517 [ run ] triggered by Bot. Commit: 057c8a6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #62519 [ kill ] triggered by Bot. Commit: 057c8a6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #62517 [ run ] completed with state ABORTED. Commit: 057c8a6

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #62519 [ kill ] completed with state SUCCESS. Commit: 057c8a6
Successfully killed previous jobs for commit 057c8a6

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #62520 [ skip ] triggered by Bot. Commit: 057c8a6 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator Author

PR_Github #62520 [ skip ] completed with state SUCCESS. Commit: 057c8a6
Skipping testing for commit 057c8a6

Link to invocation

@chenfeiz0326
chenfeiz0326 merged commit f20ea65 into NVIDIA:main Jul 29, 2026
7 checks passed
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.

4 participants