Skip to content

Commit 0807be9

Browse files
committed
test(trtllm): pin two tests to a deterministic TRT-LLM capability state
Both passed only by accident against the sandboxed/old-pin CI environment and failed when actually run against an installed TRT-LLM carrying the full RL refit lifecycle: - test_collective_refit_runs_at_async_engine_boundary asserted a call order that only holds when WorkerExtension.finalize_weight_update is absent, but never forced that fallback path (unlike the sibling test_refit_finalization_falls_back_for_older_trtllm, which does). Force it explicitly. - test_collective_refit_always_resets_prefix_cache used a bare MagicMock engine, which auto-creates recompute_active_requests and masks the reset_prefix_cache fallback its name asserts. Delete the attribute so absence is real. Verified: all 72 trtllm-marked tests in tests/unit/models/generation/trtllm/ pass against a real tekit-backed TRT-LLM install (job 3074375). Signed-off-by: Erin Ho <14718778+hchings@users.noreply.github.com>
1 parent a0f1cdb commit 0807be9

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎tests/unit/models/generation/trtllm/test_trtllm_backend.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ def test_collective_refit_runs_at_async_engine_boundary(
127127
from nemo_rl.models.generation.trtllm import trtllm_backend as backend
128128

129129
extension, module, model, model_loader, engine = _extension(backend)
130+
# Force the manual finalize fallback so the asserted call order is
131+
# deterministic. On an installed TRT-LLM that actually has
132+
# WorkerExtension.finalize_weight_update, _finalize_weight_update takes
133+
# that fast path instead and never drives process/post individually.
134+
monkeypatch.setattr(
135+
backend.WorkerExtension, "finalize_weight_update", None, raising=False
136+
)
130137
call_order = []
131138
incoming = [("model.weight", torch.tensor([1.0]))]
132139
converted = {"converted.weight": torch.tensor([2.0])}

‎tests/unit/models/generation/trtllm/test_trtllm_refit.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def test_collective_refit_always_resets_prefix_cache():
1919
engine = MagicMock()
2020
engine.model_engine = SimpleNamespace(model=model, model_loader=model_loader)
2121
engine.control_action.return_value = nullcontext()
22+
# Force the reset_prefix_cache fallback: a bare MagicMock auto-creates
23+
# recompute_active_requests, which would mask it entirely.
24+
del engine.recompute_active_requests
2225

2326
extension.engine = engine
2427
extension.device_id = 0

0 commit comments

Comments
 (0)