Repository navigation
[https://nvbugs/7139159][fix] Release failed parallel JIT probe tensors - #22848
Conversation
AutoTuner._parallel_jit_warmup only uses failures for their count and type/message summary. Retaining exception objects also retains traceback frames, including profile inputs and runner temporaries. Count failures without storing exceptions, and format only the first diagnostic so later unprintable errors do not interrupt serial profiling. Extend test_parallel_jit_warmup_worker_failure_is_left_to_profiling in tests/unittest/_torch/misc/test_autotuner.py to check that failed probe inputs and workspaces are released before serial profiling without cyclic GC. Cover a later unprintable failure and retain the serial fallback and first-failure diagnostic assertions. Fixes https://nvbugs/7139159 Signed-off-by: trtllm-agent <[email protected]>
|
No actionable comments were generated in the recent review. WalkthroughParallel JIT warmup now counts worker failures and retains the formatted type and message of the first failure instead of storing exception objects. The expanded test checks exception formatting, tensor release before profiling, caller-thread profiling, and failure logging. ChangesWarmup failure handling
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk:
|
trtllm-agent-review
left a comment
There was a problem hiding this comment.
Thanks for the PR. Stops the autotuner's parallel JIT warmup from keeping the exception objects of failed probes, so their input tensors and workspaces are freed before serial profiling, and strengthens the worker-failure test to check that release with cyclic GC disabled.
Reviewed at commit 54f911d344 (2 files, +68/−18).
The overlap with #22374 and #21628 was checked against their heads as of 2026-11-24.
Approve: no Blocker found. 3 suggestions below are nice to have.
Nice to have (3): 3 inline, 0 below
- (N2: Test design and organization) The
[False]case runs the same changed lines as[True]and checks nothing[True]misses, so the parametrization only adds a second sweep. (test_autotuner.py:3485) - (R1: PR process) Open PR #22374 (and #21628 on top of it) rewrites these same warmup lines and still does
failures.append(e); whichever merges second must keep the counter. (autotuner.py:2010) - (N5: Code tidiness) Nothing in the code says why no exception object may be kept here; a short comment would stop a later edit from collecting exceptions again. (autotuner.py:1993)
What this review checked
- Dropping the stored exceptions breaks the reference cycle (failures list -> exception -> traceback ->
warmframe -> closure cell -> list) that kept every failed probe's input and workspace alive until cyclic GC. With GC disabled, a torch-free replica of both versions keeps 12 of 12 probe objects alive after the old warmup returns and 0 of 12 after the new one, and the log message is unchanged. - The strengthened test fails on the old code. With one runner and one tactic, profiling takes the single-pair shortcut (
tensorrt_llm/_torch/autotuner.py:1785), so the first caller-thread forward runs eagerly, and the autotuner never callsgc.collect(); the old cycle is still alive whenretained_while_profilingis first recorded. The test runs pre-merge through theunittest/_torch/miscentry intests/integration/test_lists/test-db/l0_h100.yml. - Freeing a failed probe's blocks without
stream.synchronize()is safe. All workers allocate on the one shared stream (tensorrt_llm/_torch/autotuner.py:1992), which the profiling loop also uses, so the caching allocator reuses those blocks in stream order.failure_countonly changes under the lock, andfirst_failurehas a single writer and is read after the pool joins. - Not covered: No GPU run: the changed test was not executed.
- Not covered: No CI results for this PR yet.
- Not covered: Overlapping open PRs were found by keyword search only.
Automated review by trtllm-agent-review. If a point is wrong, reply in its thread. Once you have pushed code changes and replied in every Blocker thread, the bot re-checks the Blockers within a few hours.
|
/bot run |
|
PR_Github #87022 [ run ] triggered by Bot. Commit: |
|
PR_Github #87022 [ run ] completed with state |
Conflicts: - autotuner.py: _parallel_jit_warmup keeps this branch's shared-sweep claims and its count of the profiles it ran, with main's failure count and first failure message in place of the list of exceptions (NVIDIA#22848). Signed-off-by: chenfeiz0326 <[email protected]>
Description
AutoTuner._parallel_jit_warmuponly needs the number of failed probes and thefirst failure's type/message, but retains the exception objects themselves.
Their tracebacks keep failed-probe input tensors and any runner workspace
allocated before an error alive into serial profiling; the strengthened
test_parallel_jit_warmup_worker_failure_is_left_to_profilingreproduces thiswith cyclic GC disabled.
Count failed probes without storing exceptions. Format only the first
failure's type/message, as the diagnostic already does; later failures
contribute to the count without rendering their messages. Keep serial fallback
without changing the warmup sweep, thread configuration or profiling criteria.
Fixes https://nvbugs/7139159
Test Coverage
tests/unittest/_torch/misc/test_autotuner.py::test_parallel_jit_warmup_worker_failure_is_left_to_profilingthrough the real
AutoTuner.choose_onecaller. Verify that failed worker inputsand a temporary CUDA workspace are released before serial profiling without
cyclic GC. Also exercise a later failure with an unprintable message, keeping
serial fallback, the complete failure count and the first diagnostic.
the original baseline failed the strengthened lifetime assertion with 11
controls passing (before the later-error parameter was added). With the final
fixture, a two-case focused run of the all-exceptions-formatting control
passed the printable parameter but failed the later-unprintable-error
parameter with
ReferenceError. The candidate passed both focused casesand all 13 cases in a separate nearby batch, with no skips. The nearby
controls cover successful and disabled warmup, the environment override,
default thread selection, shared-build selection and excluded-op cache reuse.
unittest/_torch/miscentry intests/integration/test_lists/test-db/l0_h100.ymlselects this GPU test inpre-merge CI. Strengthening the existing test adds no CI stage or test process.
These are local verification results, not a claim about this PR's CI.
Dev Engineer Review
_parallel_jit_warmupnow counts failures under a lock and formats only the first failure. This avoids retaining exception objects during serial profiling.str(exc)raises for the first failure, the exception escapeswarm(). The count is already incremented, butfirst_failurestays empty, so the log line shows an empty detail. This is a minor edge case.QA Engineer Review
tests/unittest/_torch/misc/test_autotuner.py. Test functiontest_parallel_jit_warmup_worker_failure_is_left_to_profilingis now parametrized overunprintable_later(False, True).unittest/_torch/miscentry inl0_h100.ymlalready selects this test.Per-File QA Perspective
tensorrt_llm/_torch/autotuner.py: Failure log now reports a count and the first failure only. Verify the log line format and that serial fallback still runs.tests/unittest/_torch/misc/test_autotuner.py: Adds a lifetime check and an unprintable later-failure case. Already covered by the existing CI test-db entry, per the objectives.