Repository navigation
Conversation
…flash attention The HF Pixtral vision tower concatenates every image in a vLLM multimodal batch into one sequence and runs SDPA with a dense block-diagonal mask. Run the tower once per image and drop the mask for a single image so SDPA can select flash attention. Per-image outputs keep the stock order and shape. Text+image admission now counts expanded prompt tokens from the image size and the tokenizer instead of running the processor's pixel preprocessing a second time before vLLM. Images smaller than one merged patch still use the processor so its resize and error behavior is unchanged. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
… with two UDF threads The synchronous LLM.embed loop idles the GPU while an actor prepares its next batch. AsyncEmbedEngine wraps vLLM AsyncLLM on a private event loop, submits each prompt as its own request, and keeps LLM.embed's call shape. The GPU embed actor runs two Ray UDF threads on a true multithreaded actor pool, so one batch prepares while the other waits on the engine. Models that do not support concurrent calls stay serialized per actor, and the shared fast tokenizer is guarded because mixed truncation settings mutate it. CUDA graphs stay enabled. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Set NRL_NVTX=1 to split GPU actor time across NRL, vLLM, Ray, and torch NVTX domains. Ranges are context managers or wrappers with finally blocks, so exceptions close them. Third-party vLLM, Ray, torch, Page Elements, and OCR targets are wrapped once per process, in GPU actors and through vLLM model registration in EngineCore, only when the variable is set. When it is unset, span() returns a shared no-op context and nothing is patched. The performance guide documents the domains and a profile command. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Wrap prompt rendering, request building, output validation, image decode, routing, group embedding, result assembly and per-image vision calls in with-block ranges so exceptions close them. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
NRL_NVTX=1 keeps NRL, vLLM and model-forward ranges. Tensor host syncs, torch.cuda syncs, Ray serialization and vLLM msgpack ranges move to NRL_NVTX=full. install() takes target groups so OCR and Page Elements actors no longer import vLLM, and the embed actor no longer imports the OCR and Page Elements packages. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…on test Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
There was a problem hiding this comment.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Early close defers async generator cleanup — Reversing the earlier rejection after jperez999 reproduced it: the wrapper now iterates under contextlib.aclosing, so aclose() awaits the target's finally; the early-close test asserts the inner async finally ran.
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…nvtx-profiling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…readed operators Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
… array Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…-async-vllm Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
|
Devin Review finding "Profiling drops generator input values" ( |
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…-async-vllm Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Run each prompt in an asyncio.TaskGroup so a failing prompt cancels the rest of the call before its error propagates, and document the AsyncEmbedEngine, create_vllm_llm and supports_concurrent_calls APIs. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com> # Conflicts: # nemo_retriever/src/nemo_retriever/models/inference/vllm.py
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com> # Conflicts: # nemo_retriever/src/nemo_retriever/models/local/nemotron35_embedder.py
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
AsyncEmbedEngine keeps its loop thread; shutdown() and garbage collection stop the loop, join the thread and close the loop. Nemotron35Embedder loads the model under a lock, so concurrent first calls build one engine. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
…ling Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
[Medium impact] The PR appears safe to merge; the remaining documentation finding is fixed. SummaryAdds opt-in NVTX ranges to help separate library, vLLM, PyTorch, and Ray time.
Reviews (7) · Last reviewed commit: "Document span and install arguments and ..." · Reviewed by Greptile |
…async-range docs Tensor.to no longer formats tensor arguments to decide whether a call copies to the CPU. Tests cover async-generator completion, early close and cancellation plus the tensor wrappers, and the performance guide no longer says async ranges nest. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
vLLM 0.32 uses Model Runner V2 by default, so the V1 GPUModelRunner targets emitted no runner ranges. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Ray caches actor methods when the actor is created, before the GPU actor installs its wrappers, so _MapWorker.submit was never wrapped for running tasks. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
to("cpu", non_blocking=True) only queues the copy; vLLM waits on it later in the runner.output_copy_sync range.
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
aclose() on the wrapper now waits for the target's finally (via contextlib.aclosing) instead of leaving it to async-generator finalization. Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
Adds opt-in NVTX ranges that split GPU actor time by owner.
NRL_NVTX=1emits NRL, vLLM, and model-forward ranges for timing runs, andNRL_NVTX=fulladds torch host-sync and Ray serialization ranges.When the variable is unset, nothing is patched and
span()returns a shared no-op context.Stacked on #2837.
NRL_NVTXunsetNRL_NVTX=1NRL_NVTX=fullSetup: NVIDIA RTX PRO 6000 Blackwell Server Edition (8x and 1x), Nemotron 3.5 Embed BF16, default settings, one run per arm, no
nsysattached. Startup time is flat across levels (164-166 s).What changed
nemo_retriever/common/nvtx_layers.pywithspan(layer, name)and an idempotentinstall(*groups). Each caller names only its own target group (page_elements,ocr,vllm), so actors do not import unrelated packages.register_nemotron35_vllm(the existing vLLM plugin entry point, which also runs in EngineCore).fulladds thetorchandraygroups and vLLM msgpack ranges.NRLranges wrap the embed call sites inwithblocks: prompt rendering, request building, output validation, image decode, routing, group embed, and result assembly.vLLMranges wrapAsyncLLM.waitand each per-image vision call. The spike opened three of these ranges by hand, and they leaked on exceptions.performance_guide.mdgets a short "Split GPU stage time by owner" section.Why it's safe
withblock or a wrapper that closes infinally, so exceptions close ranges (no hand-opened ranges).NRL_NVTXis1orfull, once per group per process. Missing targets are logged and skipped.Not tested:
nsystraces of this exact head. Range coverage comes from earlier spike traces and an in-process check that every target is wrapped.Details
install()takes per-actor groups.nsyswas not attached. Range coverage comes from earliernsystraces of the spike on L40S and RTX PRO 6000 hosts, plus an in-process check against the pinned vLLM, Ray, and torch:1wraps thevllm/ocr/page_elementstargets,fulladdsTensor.itemand msgpack, and OCR/Page Elements installs do not import vLLM.tests/test_nvtx_layers.py(disabled no-op, range closes on exception, function/generator/coroutine wrappers, idempotent install with missing targets,fulladds sync and serialization targets); pre-commit.Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/57f5368b39844a038449e009f6bdd631
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/57f5368b39844a038449e009f6bdd631?variant=devin
Requested by: @jioffe502
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work