Skip to content

Commit cf9a25a

Browse files
committed
[None][ci] tighten VisualGen CBTS routing
Move remaining public VisualGen config imports to the public args module so _torch.visual_gen.config stays internal to VisualGen. Treat the public tensorrt_llm/visual_gen package as outward-facing for CBTS fallback, while keeping internal _torch/visual_gen changes on VG-only narrowing with the current VG test-db families covered. Signed-off-by: Zhenhua Wang <zhenhuaw@nvidia.com>
1 parent 84b349f commit cf9a25a

8 files changed

Lines changed: 51 additions & 52 deletions

File tree

jenkins/scripts/cbts/rules/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,32 +163,35 @@ Block selection — entry-pattern based only:
163163
VisualGen has no `condition.terms.backend` of its own; VG entries
164164
live in `backend: pytorch` and `backend: tensorrt` blocks. A block
165165
"belongs to VG" iff any of its `tests:` entries matches one of the
166-
three stable VG path families:
166+
stable VG path families:
167167

168-
- `unittest/_torch/visual_gen/...` (28 entries)
169-
- `examples/test_visual_gen.py...` (1 entry)
170-
- `visual_gen/test_visual_gen_benchmark.py` (1 entry)
168+
- `visual_gen/...`
169+
- `examples/test_visual_gen.py...`
170+
- `examples/test_visual_gen_multi_gpu.py...`
171+
- `perf/test_visual_gen_perf_sanity.py...`
172+
- `unittest/media/test_encoding.py`
171173

172174
For each matched block, `block_filters` keeps only the VG entries.
173175
Non-VG siblings in the same block stay governed by other rules.
174176

175-
Outward-facing fallback: unlike AutoDeploy, VG is imported eagerly
176-
(top-level `from tensorrt_llm._torch.visual_gen.config import ...`
177-
in `commands/serve.py`, `commands/utils.py`,
178-
`serve/openai_server.py`). The 5 files that define / re-export the
179-
public API symbols (`VisualGenArgs`, `ParallelConfig`, `VisualGen`,
180-
`VisualGenParams`) are listed in `_VG_OUTWARD_FILES`; touching any
181-
of them claims the changed files but emits `scope=None` so Selector
182-
falls back to baseline. This protects trtllm-serve / trtllm-bench
183-
startup paths from VG signature drift slipping through pre-merge.
177+
Outward-facing fallback: unlike AutoDeploy, VG public symbols are
178+
imported eagerly by non-VG startup paths such as `commands/serve.py`,
179+
`commands/utils.py`, and `serve/openai_server.py`. The public API
180+
package prefix (`tensorrt_llm/visual_gen/`) is listed in
181+
`_VG_OUTWARD_PREFIXES`; touching any non-doc file under it claims the
182+
changed files but emits `scope=None` so Selector falls back to baseline.
183+
This protects trtllm-serve / trtllm-bench startup paths from VG
184+
signature drift slipping through pre-merge.
184185

185186
Outcomes:
186187

187188
- No VG source files in the diff → rule returns `None`.
188-
- VG source touched, all internal → `scope=visualgenonly`; sanity
189-
off (VG changes don't affect wheel sanity); perfsanity on iff a
190-
matched block lives in `l0_perf` or `*perf_sanity*`.
191-
- VG source touched, any outward-facing file → `scope=None`
189+
- VG source touched, all internal (`examples/visual_gen/**` or
190+
`tensorrt_llm/_torch/visual_gen/**`) → `scope=visualgenonly`;
191+
sanity off (VG changes don't affect wheel sanity); perfsanity on iff
192+
a matched block lives in `l0_perf` or `*perf_sanity*`.
193+
- VG source touched, any outward-facing path under
194+
`tensorrt_llm/visual_gen/``scope=None`
192195
(fallback).
193196
- VG source touched but no VG block found anywhere (defensive) →
194197
`scope=None` (fallback).

jenkins/scripts/cbts/rules/visual_gen_rule.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@
2121
VisualGen does NOT have its own `condition.terms.backend`; VG test
2222
entries live in `backend: pytorch` and `backend: tensorrt` blocks.
2323
A block "belongs to VG" iff any of its `tests:` entries matches one
24-
of the three stable VG entry path families:
25-
- `unittest/_torch/visual_gen/...` (28 entries)
26-
- `examples/test_visual_gen.py...` (1 entry)
27-
- `visual_gen/test_visual_gen_benchmark.py` (1 entry)
24+
of the stable VG entry path families:
25+
- `visual_gen/...`
26+
- `examples/test_visual_gen.py...`
27+
- `examples/test_visual_gen_multi_gpu.py...`
28+
- `perf/test_visual_gen_perf_sanity.py...`
29+
- `unittest/media/test_encoding.py`
2830
2931
Outward-facing fallback:
3032
Unlike AutoDeploy, VG is imported eagerly (module-level) by non-VG
3133
code: `commands/serve.py`, `commands/utils.py`, and
3234
`serve/openai_server.py` import `VisualGenArgs` / `ParallelConfig` /
3335
`VisualGen` / `VisualGenParams` at top level. A signature change to
3436
those symbols can break trtllm-serve startup, which would affect
35-
non-VG tests. The 5 files that define / re-export those symbols are
36-
listed in `_VG_OUTWARD_FILES`; touching any of them forces fallback
37-
even if the rest of the diff is VG-internal.
37+
non-VG tests. The public API package prefix is listed in
38+
`_VG_OUTWARD_PREFIXES`; touching any file under it forces fallback even
39+
if the rest of the diff is VG-internal.
3840
"""
3941

4042
from __future__ import annotations
@@ -55,27 +57,19 @@
5557
"tensorrt_llm/visual_gen/",
5658
)
5759

58-
# Files inside _VG_SRC_PREFIXES that are imported eagerly by non-VG
59-
# code (top-level `from ... import VisualGenArgs / ParallelConfig /
60-
# VisualGen / VisualGenParams`). Touching any of these can break
61-
# trtllm-serve / trtllm-bench startup paths, so the rule defers to
62-
# baseline rather than narrowing.
63-
_VG_OUTWARD_FILES: frozenset[str] = frozenset(
64-
{
65-
"tensorrt_llm/_torch/visual_gen/config.py",
66-
"tensorrt_llm/visual_gen/__init__.py",
67-
"tensorrt_llm/visual_gen/args.py",
68-
"tensorrt_llm/visual_gen/params.py",
69-
"tensorrt_llm/visual_gen/visual_gen.py",
70-
}
71-
)
60+
# Public VisualGen API package imported eagerly by non-VG code. Touching
61+
# any non-doc file under this prefix can break trtllm-serve / trtllm-bench
62+
# startup paths, so the rule defers to baseline rather than narrowing.
63+
_VG_OUTWARD_PREFIXES: tuple[str, ...] = ("tensorrt_llm/visual_gen/",)
7264

73-
# Substrings that mark a test entry as VG. Cover all three path
74-
# families that appear in test-db YAMLs (audited 2026-05).
65+
# Substrings that mark a test entry as VG. Cover all VG path families
66+
# that appear in test-db YAMLs (audited 2026-06).
7567
_VG_ENTRY_PATTERNS: tuple[str, ...] = (
76-
"unittest/_torch/visual_gen/",
68+
"visual_gen/",
7769
"examples/test_visual_gen.py",
78-
"visual_gen/test_visual_gen_benchmark.py",
70+
"examples/test_visual_gen_multi_gpu.py",
71+
"perf/test_visual_gen_perf_sanity.py",
72+
"unittest/media/test_encoding.py",
7973
)
8074

8175

@@ -122,19 +116,19 @@ def apply(self, pr: PRInputs) -> Optional[RuleResult]:
122116
if not claimed:
123117
return None
124118

125-
# Outward-facing VG files break the "self-contained subsystem"
119+
# Outward-facing VG paths break the "self-contained subsystem"
126120
# assumption — they are imported eagerly by trtllm-serve /
127121
# trtllm-bench. Claim the files (so they don't go unhandled and
128122
# silently fallback) but emit scope=None so Selector falls back
129123
# to baseline coverage instead of narrowing to VG-only stages.
130-
outward = claimed & _VG_OUTWARD_FILES
124+
outward = {f for f in claimed if f.startswith(_VG_OUTWARD_PREFIXES)}
131125
if outward:
132126
return RuleResult(
133127
handled_files=claimed,
134128
affected_stages=set(),
135129
scope=None,
136130
reason=(
137-
f"visualgen: {len(outward)} outward-facing VG file(s) "
131+
f"visualgen: {len(outward)} outward-facing VG path(s) "
138132
f"touched ({sorted(outward)[0]}{'...' if len(outward) > 1 else ''}); "
139133
"fallback to baseline"
140134
),

tensorrt_llm/bench/benchmark/visual_gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ def visual_gen_command(
199199
"""Benchmark VisualGen (image/video generation) models offline."""
200200
import yaml
201201

202-
from tensorrt_llm._torch.visual_gen.config import VisualGenArgs
203202
from tensorrt_llm.visual_gen import VisualGen, VisualGenParams
203+
from tensorrt_llm.visual_gen.args import VisualGenArgs
204204

205205
if prompt is None and prompt_file is None:
206206
raise click.UsageError("Either --prompt or --prompt_file must be specified.")

tensorrt_llm/commands/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import click
88
from click.core import ParameterSource
99

10-
from tensorrt_llm._torch.visual_gen.config import ParallelConfig
1110
from tensorrt_llm.llmapi.utils import download_hf_partial
11+
from tensorrt_llm.visual_gen.args import ParallelConfig
1212

1313
logger = logging.getLogger(__name__)
1414

tests/integration/defs/examples/test_visual_gen_multi_gpu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
)
4141

4242
try:
43-
from tensorrt_llm._torch.visual_gen.config import ParallelConfig
4443
from tensorrt_llm._utils import get_free_port
44+
from tensorrt_llm.visual_gen.args import ParallelConfig
4545

4646
MODULES_AVAILABLE = True
4747
except ImportError:

tests/unittest/_torch/visual_gen/multi_gpu/test_tp_attention.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@
4040

4141
try:
4242
from tensorrt_llm._torch.device_mesh import DeviceMeshTopologyImpl
43-
from tensorrt_llm._torch.visual_gen.config import AttentionConfig, DiffusionModelConfig
43+
from tensorrt_llm._torch.visual_gen.config import DiffusionModelConfig
4444
from tensorrt_llm._torch.visual_gen.mapping import VisualGenMapping
4545
from tensorrt_llm._torch.visual_gen.modules.attention import Attention, QKVMode
4646
from tensorrt_llm._utils import get_free_port
4747
from tensorrt_llm.mapping import Mapping
48+
from tensorrt_llm.visual_gen.args import AttentionConfig
4849

4950
MODULES_AVAILABLE = True
5051
except ImportError:

tests/unittest/_torch/visual_gen/test_cosmos3_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import torch
2929

3030
from tensorrt_llm._torch.modules.linear import Linear
31-
from tensorrt_llm._torch.visual_gen.config import DiffusionModelConfig, VisualGenArgs
31+
from tensorrt_llm._torch.visual_gen.config import DiffusionModelConfig
3232
from tensorrt_llm._torch.visual_gen.models.cosmos3.transformer_cosmos3 import Cosmos3VFMTransformer
3333
from tensorrt_llm._torch.visual_gen.pipeline_loader import PipelineComponent, PipelineLoader
34-
from tensorrt_llm.visual_gen.args import TorchCompileConfig
34+
from tensorrt_llm.visual_gen.args import TorchCompileConfig, VisualGenArgs
3535

3636
pytestmark = pytest.mark.cosmos3
3737

tests/unittest/_torch/visual_gen/test_qwen_image_registry.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
# decorator on ``QwenImagePipeline`` being applied, which is what we are
1818
# testing here.
1919
from tensorrt_llm._torch.visual_gen import models # noqa: F401
20-
from tensorrt_llm._torch.visual_gen.config import AttentionConfig, DiffusionModelConfig
20+
from tensorrt_llm._torch.visual_gen.config import DiffusionModelConfig
2121
from tensorrt_llm._torch.visual_gen.models.qwen_image import (
2222
QwenImagePipeline,
2323
QwenImageTransformer2DModel,
2424
)
2525
from tensorrt_llm._torch.visual_gen.pipeline_registry import PIPELINE_REGISTRY, AutoPipeline
26+
from tensorrt_llm.visual_gen.args import AttentionConfig
2627

2728

2829
def test_qwen_image_pipeline_is_registered():

0 commit comments

Comments
 (0)