You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GLM-5.2 test now scopes rank environment overrides while constructing LLM and passes the yielded mapping as env_overrides. This avoids leaving those overrides in the caller’s process environment after the test. The waiver for test_modeling_v2_env_scope.py was removed. No unrelated files changed.
QA Engineer Review
The accuracy test changed its engine setup; its test ID did not change. The test-list change removes the waiver for unittest/_torch/modeling_v2/test_modeling_v2_env_scope.py. The GLM-5.2 test is listed in tests/integration/test_lists/test-db/l0_gb300_multi_nodes_node2_gpu8.yml. Coverage verdict: sufficient for the environment-scope correction. The full accuracy test was not rerun; reported stubbed checks do not establish end-to-end coverage.
Per-File QA Perspective
tests/integration/defs/accuracy/modeling_v2/glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py: The GSM8K TP8 test checks GLM-5.2 engine behavior with scoped environment overrides. It is listed in the test-db CI list.
tests/integration/test_lists/waives.txt: Removes the environment-scope test waiver, allowing that test to run without this skip entry. This list change does not alter test functions or selectors.
Description
LLM writes env_overrides into the calling process's os.environ (BaseLLM._process_env_overrides) and does not restore them. The modeling_v2 accuracy tests therefore open each engine inside scoped_env_overrides (tests/integration/defs/accuracy/modeling_v2/_env.py), and tests/unittest/_torch/modeling_v2/test_modeling_v2_env_scope.py checks that every LLM(...) call under accuracy/modeling_v2/ is built that way.
TestModelingV2Glm52Nvfp4Sm103Tp8, added in #20524 and moved to glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py in #21603, passes env_overrides to an engine built outside such a scope. TRTLLM_MODELING_V2_VALIDATE and TRTLLM_DSA_INDEXER_BF16 therefore stay set in the pytest process after the test, and on main the check fails:
AssertionError: glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py constructs LLM outside an environment scope at lines [73]
CI does not report it because the whole check file is waived under https://nvbugs/7024242. That waiver was added when the check failed on test_minimax_m3.py, whose engine #20623 has since scoped.
This PR opens the GLM-5.2 sm_103 tp8 engine inside scoped_env_overrides and passes it the yielded mapping, as _env.py documents, and removes the waiver.
unittest/_torch/modeling_v2/test_modeling_v2_env_scope.py, selected by tests/integration/test_lists/test-db/l0_cpu.yml for the CPU-Generic stages, covers this change. It was run on main and on this branch with the same waives.txt (main's without the line this PR removes), in the CI image with a wheel built from main using the jenkins/Build.groovy x86_64 flags, and the CPU stage's pytest command line:
main: test_accuracy_engines_are_inside_environment_scopes[glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py] fails, the other 31 cases pass;
this PR: all 32 cases pass.
The l0_cpu shard that holds the check (CPU-Generic-x86-2, 184 entries, one pytest process): main 1 failed (this check), 182 passed, 1 skipped; this PR 183 passed, 1 skipped (unittest/_torch/modeling, skipped by waives.txt in both runs).
TestModelingV2Glm52Nvfp4Sm103Tp8::test_gsm8k_tp8 runs on 2x4 GB300 (l0_gb300_multi_nodes_node2_gpu8.yml) and was not rerun. With this change its module collects, and with the engine and the GSM8K task stubbed, _evaluate passes the engine the same arguments as on main; the two variables are set while the engine is built, evaluated and closed, and are unset in the test process afterwards (on main they stay set).
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.
If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.
Any new dependencies have been scanned for license and vulnerabilities
Reviewing files that changed from the base of the PR and between d1a2d07 and 78d96b4.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The GLM-5.2 accuracy test now scopes rank environment overrides during LLM construction. The skip-list entry for test_modeling_v2_env_scope.py is removed.
Changes
GLM-5.2 environment scoping
Layer / File(s)
Summary
Scope environment overrides during LLM construction tests/integration/defs/accuracy/modeling_v2/glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py, tests/integration/test_lists/waives.txt
The test applies _SM103_RANK_ENV through scoped_env_overrides when constructing LLM, rather than returning the overrides from _llm_kwargs. The waiver for test_modeling_v2_env_scope.py is removed.
NVIDIA/TensorRT-LLM#21345: Adds scoped_env_overrides and updates Modeling V2 accuracy tests to use it.
NVIDIA/TensorRT-LLM#21812: Uses TRTLLM_DSA_INDEXER_BF16 to select BF16 projection behavior in the GLM indexer.
NVIDIA/TensorRT-LLM#21603: Expands test_modeling_v2_env_scope.py to check accuracy-test LLM() calls for use of scoped_env_overrides.
Merge Risk: Minimal · previous review d1a2d
The environment overrides are scoped around the engine lifecycle. No merge-blocking issue is established.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title follows the repository format and clearly describes the main change: scoping the GLM-5.2 sm_103 tp8 accuracy engine’s environment overrides.
Description check
The description explains the issue and solution, lists relevant test coverage and results, and includes the completed PR checklist. It also states that the GPU test was not rerun.
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Counts: 0 Blocker, 0 Possibly blocking, 0 Required, 1 Nice to have. The fix follows the _env.py convention the other modeling_v2 targets use: the engine is built, evaluated and shut down inside the scope, and every rank still gets the same overrides through llm_args.env_overrides (tensorrt_llm/executor/worker.py:398-401), so test_gsm8k_tp8 runs with the same arguments and environment as before. The re-enabled check fails on this file's line 73 at the merge base and passes all 32 cases on this branch (also after merging with current main), and the removed waive was the last reference to nvbugs/7024242.
[Nice to have] No /bot run yet. With the waive gone, unittest/_torch/modeling_v2/test_modeling_v2_env_scope.py (tests/integration/test_lists/test-db/l0_cpu.yml:126) runs in the pre-merge CPU-Generic x86/arm stages; please trigger CI and confirm those shards pass. test_gsm8k_tp8 itself only runs post-merge (GB300-8_GPUs-2_Nodes-PyTorch-SingleNvlinkDomain-Post-Merge-1); adding that stage with --stage-list is optional.
Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements.
…ngine's environment overrides
LLM writes env_overrides into the calling process's os.environ and does
not restore them, so the modeling_v2 accuracy tests open each engine
inside scoped_env_overrides, and test_modeling_v2_env_scope.py checks
that every LLM(...) call under accuracy/modeling_v2 is built that way.
TestModelingV2Glm52Nvfp4Sm103Tp8 passed env_overrides to an engine built
outside such a scope, so TRTLLM_MODELING_V2_VALIDATE and
TRTLLM_DSA_INDEXER_BF16 stayed set in the pytest process after the test,
and the check fails on
glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py. The file-level
waiver of this bug hid that failure; it was added when the check failed
on test_minimax_m3.py, which NVIDIA#20623 has since scoped.
Open the engine inside scoped_env_overrides and pass it the yielded
mapping, as _env.py documents, and remove the waiver.
Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
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
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.
Dev Engineer Review
The GLM-5.2 test now scopes rank environment overrides while constructing
LLMand passes the yielded mapping asenv_overrides. This avoids leaving those overrides in the caller’s process environment after the test. The waiver fortest_modeling_v2_env_scope.pywas removed. No unrelated files changed.QA Engineer Review
The accuracy test changed its engine setup; its test ID did not change. The test-list change removes the waiver for
unittest/_torch/modeling_v2/test_modeling_v2_env_scope.py. The GLM-5.2 test is listed intests/integration/test_lists/test-db/l0_gb300_multi_nodes_node2_gpu8.yml. Coverage verdict: sufficient for the environment-scope correction. The full accuracy test was not rerun; reported stubbed checks do not establish end-to-end coverage.Per-File QA Perspective
tests/integration/defs/accuracy/modeling_v2/glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py: The GSM8K TP8 test checks GLM-5.2 engine behavior with scoped environment overrides. It is listed in thetest-dbCI list.tests/integration/test_lists/waives.txt: Removes the environment-scope test waiver, allowing that test to run without this skip entry. This list change does not alter test functions or selectors.Description
LLMwritesenv_overridesinto the calling process'sos.environ(BaseLLM._process_env_overrides) and does not restore them. The modeling_v2 accuracy tests therefore open each engine insidescoped_env_overrides(tests/integration/defs/accuracy/modeling_v2/_env.py), andtests/unittest/_torch/modeling_v2/test_modeling_v2_env_scope.pychecks that everyLLM(...)call underaccuracy/modeling_v2/is built that way.TestModelingV2Glm52Nvfp4Sm103Tp8, added in #20524 and moved toglm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.pyin #21603, passesenv_overridesto an engine built outside such a scope.TRTLLM_MODELING_V2_VALIDATEandTRTLLM_DSA_INDEXER_BF16therefore stay set in the pytest process after the test, and on main the check fails:CI does not report it because the whole check file is waived under https://nvbugs/7024242. That waiver was added when the check failed on
test_minimax_m3.py, whose engine #20623 has since scoped.This PR opens the GLM-5.2 sm_103 tp8 engine inside
scoped_env_overridesand passes it the yielded mapping, as_env.pydocuments, and removes the waiver.Fixes https://nvbugs/7024242
Test Coverage
unittest/_torch/modeling_v2/test_modeling_v2_env_scope.py, selected bytests/integration/test_lists/test-db/l0_cpu.ymlfor the CPU-Generic stages, covers this change. It was run on main and on this branch with the samewaives.txt(main's without the line this PR removes), in the CI image with a wheel built from main using thejenkins/Build.groovyx86_64 flags, and the CPU stage's pytest command line:test_accuracy_engines_are_inside_environment_scopes[glm_moe_dsa/glm_5_2_nvfp4__sm_103__tp8/test_accuracy.py]fails, the other 31 cases pass;l0_cpushard that holds the check (CPU-Generic-x86-2, 184 entries, one pytest process): main 1 failed (this check), 182 passed, 1 skipped; this PR 183 passed, 1 skipped (unittest/_torch/modeling, skipped bywaives.txtin both runs).TestModelingV2Glm52Nvfp4Sm103Tp8::test_gsm8k_tp8runs on 2x4 GB300 (l0_gb300_multi_nodes_node2_gpu8.yml) and was not rerun. With this change its module collects, and with the engine and the GSM8K task stubbed,_evaluatepasses the engine the same arguments as on main; the two variables are set while the engine is built, evaluated and closed, and are unset in the test process afterwards (on main they stay set).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)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
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
To see a list of available CI bot commands, please comment
/bot help.