Repository navigation
[https://nvbugs/7128759][fix] Give each single-GPU disagg test worker its own FlashInfer workspace - #22800
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. WalkthroughMpiPoolSession accepts an optional ChangesMPI pool configuration and test usage
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk:
|
trtllm-agent-review
left a comment
There was a problem hiding this comment.
Thanks for the PR. Spawns the single-GPU disaggregated test workers through MpiPoolSession so that each gets its own FlashInfer workspace, and lets MpiPoolSession pass an optional mpi_info through to MPIPoolExecutor.
Reviewed at commit f26528dbcb (5 files, +117/−51).
Reviewed the whole diff at the PR head: 5 files, 168 changed lines.
Approve: no Blocker found. 5 suggestions below are nice to have.
Nice to have (5): 5 inline, 0 below
- (N1: Architecture and design) Other bare MPI pools in the test suites still share FlashInfer's default workspace, so the same cold-cache warmup failure can recur outside this module (test_disaggregated_single_gpu.py:127)
- (N2: Test design and organization) The
defaultcase of the new unit test runs the same changed lines ascaller-infoand adds no coverage of the change (test_mpi_session.py:345) - (R1: PR process) Open PR #22458 and draft #22729 edit the same lines; whichever merges second must re-apply its change by hand, and a one-sided resolution drops a fix (test_disaggregated_single_gpu.py:485)
- (R6: Required documentation) The helper's docstring omits that an exported FLASHINFER_CUBIN_DIR still makes both workers download into one directory under FlashInfer's 30 s lock (test_disaggregated_single_gpu.py:130)
- (R3: Repository rules)
mpi_info: Anyand three unannotated new functions break the Static Typing rules in CODING_GUIDELINES.md (mpi_session.py:510)
What this review checked
mpi_info=Nonespawns exactly as before: mpi4py 3.1.5, the version the CI image installs, substitutes itssoft=1:Ndefault only whenmpi_infois None, so every productionMpiPoolSessionspawn is unchanged, and thecaller-infocase of the new cpu_only test fails on the parent withTypeError.- All eight call sites keep their worker env, and the spec-decoding case keeps both
OMPI_MCA_rmaps_base_oversubscribeand the sameMPI.Info; teardown is stillshutdown(wait=True), now in afinallyaround theyield, as the oldwith MPIPoolExecutor(...)exit did, and every stand-in that calls_start_mpi_poolsets_mpi_info. - The root cause matches FlashInfer 0.7.3:
download_filegives up its per-file lock after 30 s and returns False, and CI sets none of the variables that turn per-worker isolation off. - Not covered: No GPU run: the cold-cache B200 failure and the fix were not reproduced.
- Not covered: The other spawns named in the design comment were not traced to an actual FlashInfer artifact download on their stages.
- Not covered: #22458 and #22729 were read only as patches to the shared files, not reviewed.
Automated review by trtllm-agent-review. If a point is wrong, reply in its thread. After you push fixes or reply, the bot re-checks the Blockers within a few hours.
|
/bot run |
brnguyen2
left a comment
There was a problem hiding this comment.
Approving — the comments below are optional touch-ups, not blockers.
This change does more than swap the workspace. Moving the workers from a bare MPIPoolExecutor to MpiPoolSession also changes three other things about how they spawn:
- they get
path=sys.path - they inherit the forwarded
TRTLLM*/TLLM*/FLASHINFER_*environment - they run the
_WORKER_ENV_BOOTSTRAPpre-import script
These all look harmless, and they bring the tests closer to how an LLM spawns its workers. The description only mentions the workspace, though. Please add one sentence so a later bisect over these tests isn't surprised.
The real fragility is FlashInfer's behavior: a lock wait that times out returns an empty result instead of retrying or raising a clear error. This PR avoids it for these tests by not sharing a workspace. Any setup that still shares one keeps the same failure mode, for example an explicit FLASHINFER_CUBIN_DIR, which the new docstring says to pre-populate. If there isn't already an upstream FlashInfer issue for this, please open one and link it from the PR so the workaround has a pointer to the root cause.
|
PR_Github #86776 [ run ] triggered by Bot. Commit: |
|
Thanks for the review. Both points are in the description now:
|
|
/bot run |
|
PR_Github #86795 [ run ] triggered by Bot. Commit: |
|
PR_Github #86776 [ run ] completed with state |
mikeiovine
left a comment
There was a problem hiding this comment.
Stamp on behalf of runtime devs, delegating proper review to @NVIDIA/trt-llm-disagg-devs
|
PR_Github #86795 [ run ] completed with state
|
|
/bot run |
|
PR_Github #86827 [ run ] triggered by Bot. Commit: |
|
PR_Github #86827 [ run ] completed with state
|
|
/bot run |
|
PR_Github #86875 [ run ] triggered by Bot. Commit: |
|
@NVIDIA/trt-llm-disagg-devs, this PR still needs a code-owner review from your team for |
|
PR_Github #86875 [ run ] completed with state
|
|
PR_Github #87254 [ run ] completed with state
|
|
/bot run |
|
PR_Github #87324 [ run ] triggered by Bot. Commit: |
|
PR_Github #87324 [ run ] completed with state
|
… its own FlashInfer workspace The single-GPU disaggregated tests start their context and generation workers with a bare MPIPoolExecutor, so both workers share FlashInfer's default workspace. On a cold cache one worker waits on the other's download of each FlashInfer artifact, and FlashInfer gives up that wait after 30 seconds with an empty result: when the download of the TRTLLM-Gen FMHA metadata header takes longer, the waiting worker fails warmup with "flashInferMetaInfo.h not found". Since NVIDIA#22569 single-worker MpiPoolSession pools, too, isolate their FlashInfer workspaces by default, so the single-GPU tests that run earlier in the same pytest process no longer fill the default workspace for these workers. Spawn the workers through MpiPoolSession at all eight places in the module that start a two-worker pool, which serve its ten tests. MpiPoolSession by default gives each worker its own FlashInfer workspace, as it does for the workers of an LLM. It now takes an optional mpi_info for the spawn, so the spec-decoding batch-slot test keeps its oversubscription setting. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> Signed-off-by: Jie Li <lijie@nvidia.com>
…SHINFER_CUBIN_DIR Annotate MpiPoolSession's mpi_info parameter with the types its docstring names instead of Any, through an alias that is a plain Mapping[str, str] in builds without multi-device support, so the hint resolves there too. Annotate mpi_worker_pool and the unit test's recording executor. The mpi_worker_pool docstring now names the settings that turn the per-worker FlashInfer workspace off, and says that an explicit FLASHINFER_CUBIN_DIR is shared by both workers and has to be populated before they start. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> Signed-off-by: Jie Li <lijie@nvidia.com>
…hat the helper does Describe how the helper spawns its workers and that an explicit FLASHINFER_CUBIN_DIR is shared by both, and leave the explanation of why a bare MPIPoolExecutor fails to the PR description. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com> Signed-off-by: Jie Li <lijie@nvidia.com>
3a99dba to
d63c7f2
Compare
|
/bot run |
|
PR_Github #87388 [ run ] triggered by Bot. Commit: |
|
PR_Github #87388 [ run ] completed with state
|
…ironment Signed-off-by: Jie Li <lijie@nvidia.com>
|
/bot run |
|
PR_Github #87419 [ run ] triggered by Bot. Commit: |
|
PR_Github #87419 [ run ] completed with state
|
|
/bot run |
|
PR_Github #87513 [ run ] triggered by Bot. Commit: |
|
PR_Github #87513 [ run ] completed with state
|
|
/bot run |
|
PR_Github #87523 [ run ] triggered by Bot. Commit: |
|
PR_Github #87523 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #87601 [ run ] triggered by Bot. Commit: |
|
PR_Github #87601 [ run ] completed with state
|
|
/bot run |
|
PR_Github #87654 [ run ] triggered by Bot. Commit: |
|
PR_Github #87654 [ run ] completed with state |
Description
disaggregated/test_disaggregated_single_gpu.pystarts each test's context and generation workers with a bareMPIPoolExecutor, so both workers use FlashInfer's default workspace. On a cold cache, one worker waits for the other's download of each FlashInfer artifact. FlashInfer gives up that wait after 30 seconds and returns an empty result, because the file is not there yet. When the download of the TRTLLM-Gen FMHA metadata header takes longer, the waiting worker fails warmup on B200, where attention runs FlashInfer's TRTLLM-Gen FMHA:FlashInfer's 30-second wait that ends in an empty result has an open upstream fix, flashinfer-ai/flashinfer#9851; this repository pins
flashinfer-python==0.7.3, which does not have it.Before #22569, single-worker
MpiPoolSessionpools also used FlashInfer's default workspace, so the single-GPU tests that run earlier in the same pytest process filled it for these workers. Since #22569 those pools, too, give each worker its own workspace by default, and these workers start on an empty default workspace.This change spawns the workers through
MpiPoolSessionat all eight places in the module that start a two-worker pool, which serve its ten tests. Unless the FlashInfer workspace is set explicitly or per-process isolation is turned off,MpiPoolSessiongives each worker its own FlashInfer workspace, as it does for the workers of anLLM. With the default artifact cache (FLASHINFER_CUBIN_DIRunset), each worker then downloads and retries the metadata header independently.MpiPoolSessiontakes a new optionalmpi_infoand spawns its pool with it, sotest_disaggregated_spec_dec_batch_slot_limitkeeps its oversubscription setting. With the default,None, the pool spawns as before. Spawning throughMpiPoolSessionalso changes three other things for these workers, as for anLLM's: they get the parent'ssys.path; they get the parent's currentTRTLLM*/TLLM*variables and the othersMpiPoolSessionforwards, such asFLASHINFER_CUBIN_DIRand the cache directories, with the test'senvapplied over them, so the test's own values take precedence; and they first run its_WORKER_ENV_BOOTSTRAP, which drops the values of those variables inherited from the MPI runtime.Test Coverage
disaggregated/test_disaggregated_single_gpu.py::test_disaggregated_logits[True-Qwen3-0.6B], the failing case,test_disaggregated_spec_dec_batch_slot_limit[False-Qwen3-8B-eagle3-Qwen3-8B], and the module's other cases, as listed inqa/functional/llm_function_core.txtandl0_h100.yml.unittest/llmapi/test_mpi_session.py::test_mpi_pool_session_spawns_with_caller_mpi_info:MpiPoolSessionspawns its pool with the caller'smpi_info, and with nompi_infoby default. It records the spawn options instead of spawning workers, so it iscpu_only, takes milliseconds, and runs in the pre-merge CPU stages through the existingl0_cpu.ymlentryunittest/llmapi/test_mpi_session.py ISOLATION. Without the new parameter it fails withTypeError: MpiPoolSession.__init__() got an unexpected keyword argument 'mpi_info'.unittest/llmapi/test_flashinfer_workspace.pyandunittest/test_unified_cache.pyrunMpiPoolSession._start_mpi_poolon stand-in sessions, which now also set_mpi_info=None.Verified with the post-merge CI package of the PR's original base (main at d9d5e18), in the CI image, each run starting with an empty FlashInfer cache. "After" is that installation with
tensorrt_llm/llmapi/mpi_session.pyreplaced by this PR's, which is the only installed file that differs from the wheel, and this PR's test code. The 400 kB/s runs of both cases, one run against the repository, the B200 module run and the unit tests were repeated on the PR's second commit, which changes only type annotations and documentation, with the same results; the third commit changes only a docstring. The PR has since been rebased onto main at 7a8a077, whose #22458 changed the environment that the module's two-worker pools pass to their workers; the PR keepsmpi_worker_poolat all eight places, with main's new environment, and its fourth commit only reformats one of those environments. The same runs gave the same results on the rebased code, with the post-merge CI package of main at 3c66aec and everytensorrt_llm/file that the rebased PR changes over that commit copied in; none of them is native code.test_disaggregated_logits[True-Qwen3-0.6B]andtest_disaggregated_spec_dec_batch_slot_limit[False-Qwen3-8B-eagle3-Qwen3-8B]:flashInferMetaInfo.h not found, after FlashInfer logsFailed to acquire lock for .../include/flashInferMetaInfo.h within 30 seconds. Both pass after, each worker downloading the header into its own workspace.test_disaggregated_logits[True-Qwen3-0.6B]against the repository directly: passes 2/2 before and 2/2 after.TRTLLM_TEST_PREFETCH_SESSION=0andTRTLLM_TEST_REUSE_SESSION=0: passes before and after. Before, the earlier tests fetched the header only into their own workspaces, and the case's two workers fetched it into the empty default workspace, one waiting on the other. After, one of the case's workers reused the workspace an earlier test had filled, and the other downloaded the header into its own without waiting.qa/functional/llm_function_core.txtplustest_disaggregated_gen_preemption_greedy_parity[False|True], in one pytest process on 1x B200: 11 passed before and 11 after; the 8 Hopper-only cases skip. After, FlashInfer logged nothing in its default workspace: the workers of every case used their own, and the header was downloaded only once into each, by the module's first case, sotest_disaggregated_spec_dec_batch_slot_limitfound it there.l0_h100.yml, in one pytest process on 1x H100: 17 passed before and after.unittest/llmapi/test_mpi_session.pyandunittest/test_unified_cache.py,cpu_only, on a node without GPUs: 56 and 17 passed before; 58 and 17 passed after, the new cases included.unittest/llmapi/test_flashinfer_workspace.pyon 1x B200: 21 passed after.Fixes https://nvbugs/7128759
Dev Engineer Review
MpiPoolSession.__init__addsmpi_info, stores it, and passes it toMPIPoolExecutor. The defaultNoneleaves spawning unchanged._MpiSpawnInfois defined in both the multi-device and fallback branches. This is a type-alias change only.mpi_worker_poolcallssession.shutdown()infinally. All eight call sites use this helper.MpiPoolSession.QA Engineer Review
test_disaggregated_single_gpu.py(eight sites moved tompi_worker_pool),test_mpi_session.py(+35),test_flashinfer_workspace.py(+2),test_unified_cache.py(+4/-2).test_mpi_pool_session_spawns_with_caller_mpi_info, which checks default and caller-suppliedmpi_infospawn kwargs.Per-File QA Perspective
mpi_session.py: Newmpi_infopass-through. Verify default spawning is unchanged.test_disaggregated_single_gpu.py: Verify workers start and warmup completes, including the oversubscribe case.test_mpi_session.py: New spawn-option test. Verify it runs in CI.test_flashinfer_workspace.py,test_unified_cache.py: Mocks gain_mpi_info=None. Verify they match the startup code.