Skip to content

Add experimental CUDA PDF rendering with GPU-resident Ray transport - #2870

Draft
jperez999 wants to merge 32 commits into
NVIDIA:mainfrom
jperez999:codex/cuda-pdf-renderer
Draft

jperez999 wants to merge 32 commits into
NVIDIA:mainfrom
jperez999:codex/cuda-pdf-renderer

Conversation

@jperez999

@jperez999 jperez999 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add opt-in CUDA PDF rendering to native NRL ingestion. --pdf-renderer cuda_rdt carries GPU RGB through stock Ray/NIXL transport into GPU Page Elements and OCR preprocessing, avoiding JPEG/base64 encoding and CPU image decoding. PDFium remains the default renderer. CPU PDF interpretation, resource preparation, detection metadata processing, and native indexing remain part of the pipeline.

The external compiled C++/CUDA provider replays owned PDF command scenes. Bounded ownership, registered source/receive pools, completion fences, and final-consumer acknowledgements protect buffer reuse; overflow stays on GPU. Rendering, transport, and model errors stop this path without CPU raster fallback. Supported scope is single-host PDF Ray batch ingestion with local Page Elements, OCR v2, and text embeddings; encoded image artifacts, image embeddings, Nemotron Parse, and additional image-routing stages remain outside this experimental path.

--page-elements-inference-batch-size controls neural invocation chunks independently of Ray task batches, retaining the existing eight-image default when omitted. The GPU-only detector specialization batches output geometry while retaining upstream inference, autocast, NMS, arithmetic, and detection order. An audited-provider compatibility guard retains the original CUDA forward method for unknown implementations.

Fix a common batch-writer checkpoint bug exposed by the full evaluation: Dataset construction resolved the embedding actor identity, but driver-owned streaming and worker-native writes still used the provisional backend. Deferred-identity sinks now use the exact resolved Dataset node, so index metadata and automatic queries share the ingestion checkpoint and immutable revision. Explicit sink identities and supplied backends retain their behavior.

Validation

  • Independent renderer-binary comparison against CPU PDFium159: 213,538/213,538 pages exactly match, zero tolerance, zero renderer errors or CPU raster calls. Renderer runtime binaries are unchanged in the current NRL experiments.
  • Fresh original-64 cross-GPU gate after the latest-main integration: 192 exact renders, concurrent streams, registered receive buffers, 43 GPU-only overflow cases, reuse checks, and drained ownership.
  • 436 targeted tests passed, 12 skipped after integrating main 67457ef7, including checkpoint/writer/executor, Parse parameters/multipass, and pipeline graph coverage. Eight new real-table regression cases fail on the frozen parent and pass with the writer fix.
  • Earlier geometry validation covers 316 CPU and 316 GPU cases, exact raw detections on all 64 reference pages at matching batches 8/16/32/64, and 83 focused geometry/dispatch/provider tests. These are correctness/component checks, not full-pipeline speed claims.
  • Strict MkDocs, focused Black/Flake8, whitespace, and privacy checks passed. Two complete corrected-checkpoint runs pass page/transport/index/source audits and all 1,347 queries, with zero unmapped hits, zero page-RGB readback, zero CPU raster calls, and released ownership.

The complete-run code tree is b153d43d; the current head also includes the subsequent upstream Parse multi-pass integration. That integration retains single-pass defaults and remains outside CUDA-RDT support. The successful GPU runtime uses Ray 3.0.0.dev0 commit 935cc32dcf187e0dbb2603040f4c0a69db469601, NIXL 1.5.2, Torch 2.13.0+cu130, and eight B200 GPUs without MPS. The declared Ray minimum alone does not establish support for every experimental GPU API.

Current full DC10K results

Every CUDA case processes 10,000 PDFs / 213,538 pages, builds the native index, and evaluates all 1,347 queries. Timing includes the entire ingestion CLI, model initialization, indexing, and shutdown. Retrieval QPS follows the saved protocol: one all-query call after a separately reported warmup.

Metric Historical default CPU renderer Corrected CUDA case CUDA with lazy Ray worker startup
Ingestion PPS 385.9195 340.0601 361.2921
Complete ingestion CLI seconds 553.3226 627.9420 591.0398
Retrieval QPS 5.5287 5.1106 5.1324
nDCG@10 0.63006314 0.62811148 0.62863720
Recall@10 0.76169265 0.76317743 0.76391982
Whole-CLI time-weighted GPU mean — 55.56% 70.67%

Both current CUDA runs use the default resolved Nemotron 3.5 NVFP4 checkpoint and the same immutable revision for ingestion and retrieval, verified in index metadata and actual engine logs. Quality remains close to the historical reference; query-bootstrap score intervals span negative and positive differences and do not establish equivalence.

These are shared-host observations, not isolated renderer speed comparisons. Process telemetry confirms competing GPU work on every device; whole-device NVML utilization includes that activity. Host pressure, cache conditions, and initialization latency also vary. The historical CPU run uses older source/model routing and different instrumentation. It has not been rerun, so neither current CUDA case establishes a win over a matched latest-main CPU control.

The CUDA configuration uses render batches/streams of 16, Page Elements task/model batches of 32, eight Page Elements / sixteen OCR / eight embedding actors, 64 GiB source/owner limits, and 256 MiB receive pools. Both current cases use normal-priority Ray workers. The second additionally disables first-driver/eager idle-worker prestart; it is an experiment configuration, not a new NRL default. Ordinary 1 Hz NVML device/process samples retain timestamps and gaps, with passive host counters; no Nsight, py-spy, GPM, or artificial GPU load is used in these timings.

Earlier-source historical CUDA observations reached 410.4169 PPS, but used older checkpoint routing and do not establish current-source performance. The faster-ingestion and >90% full-CLI utilization goals remain unmet for the corrected pipeline. Keep this PR draft while performance isolation and further optimization continue.

Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
…luation

Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
@jperez999 jperez999 changed the title Add experimental batched CUDA PDF renderer backend Add experimental CUDA PDF rendering with GPU-resident Ray transport Nov 20, 2026
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>
…-latest-main

Signed-off-by: Julio Perez <37191411+jperez999@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant