Repository navigation
rtx: move geometry preprocessing to the GPU and reuse prepared data - #387
Merged
Merged
Conversation
Keep derived data device-resident and reject failed preparation before tracing. Preserve curve connectivity.
Use a nonblocking preparation stream with explicit producer dependencies. Replace device-wide BVH barriers with stream-local completion, and block publication after failed builds while allowing retry. Retain render-consumer retirement waits until storage generations can be tracked independently.
Batch declared host inputs before geometry finalization, preserving source lifetimes and marking uploads complete only after the batch succeeds. Remove default-stream dependencies from checked preprocessing kernels. Cover allocation, copy, completion and partial-batch failures plus retry and coalesced host-array updates.
Upload OptiX instances and finalized world tables on the preparation stream, and publish dirty registries as one checked batch before tracing. Keep stable registry snapshots across host-vector growth and preserve newer edits or failed batches for retry. Retain render-consumer ordering and legacy fences for producers not migrated yet.
Submit checked bounds and area readbacks into owned pinned storage, then collect and validate before BVH builds and geometry-light publication. Retain queued geometries and drain before storage reuse or retirement. Cover deferred lifetime, callback reentry, pinned allocation failure, batch completion errors, and pending shared-array retirement.
Lease result slots from device-local pinned pages instead of allocating one pinned buffer per geometry. Cache pages for reuse and retain page ownership independently of the pool until every lease is returned. Cover page-growth failures, retry, move/reset, concurrent slot use, asynchronous DMA, and pool-before-lease teardown.
Capture declared input arrays during commits and upload them together before geometry finalization. Deduplicate shared array versions and retain sources through checked completion. Retire obsolete snapshots before allocating multi-geometry cohorts; preserve single-geometry ordering and observer-only fallback. Cover batch failure, observer recovery, host retirement, and in-place timing.
Avoid pageable readback staging while retaining completion waits and failure drains. Reuse completed render retirement at input-batch and BVH dependency points; retain geometry-level dependency handling. Cover pinned allocation recovery and retirement certificate validity.
Report refused ANARI calls on a disabled device and route the gated entry points through a single gate, separate from initDevice(). - report refused API calls and gate the disabled device apart from initDevice() - reset the refusal-report guard on scope exit - pass the gated device entry points through one gate
…ernels Replace Geometry preparation flags with explicit state, let Preprocessing own its published results through one pinned results buffer, write bounds and area kernels per geometry type, and simplify allocation-cache and failure handling. - handle device allocation failure once, in DeviceBuffer - make RegisteredObject::upload() virtual - replace Geometry preparation flags with explicit state - let Preprocessing own its published results - collapse pinned readback machinery into one results buffer - collect input uploads with the shared PreparationQueue - write the bounds and area kernels per geometry type - fail preparation directly where the failure is already known - cover the general path's preparation-results reservation failure - correct the SmallGeometryJob comment - ask CUDA whether the render stream is idle - guard the allocation cache's cohort with nonstd::scope_exit - keep the allocation cache's blocks in one partitioned array - cover a failed observer-only geometry input upload - upload observer-only geometry inputs through the input batch - drop the unread Preprocessing::Status::Failed
Move the preparation stream, storage, queues, render-stream waits and failure API into a private GeometryPreparation, run the preparation lifecycle once in Geometry::finalize(), and report every reason not to upload (including World and Group build failures) by return value. - add GeometryPreparation to hold the preparation stream and storage - move the render-stream waits and upload-and-wait into GeometryPreparation - move the geometry preparation queues into GeometryPreparation - give Array::privatize() two waits on GeometryPreparation - put the preparation failure API on GeometryPreparation - make the geometry preparation protocol private - describe the geometry preparation lifecycle in GeometryPreparation.h - run the preparation lifecycle once, in Geometry::finalize() - report every reason not to upload through prepare()'s result - report rejected geometry input without the CUDA failure path - reserve the bounds buffer once in Preprocessing::bounds() - report World and Group build failures by return value - keep the Geometry Light area data in the Geometry base - narrow the Geometry preparation state to three values - separate the scene-update stream from GeometryPreparation - walk the Geometry preparation parameters in one place - share the Array upload selection and privatization failure
jeffamstutz
force-pushed
the
gpu-preprocessing
branch
from
November 25, 2026 15:35
2d71888 to
4773aff
Compare
Collaborator
|
Rebased this branch onto current
Each commit builds and passes the full RTX ctest suite (96/96). If you have local work on |
jeffamstutz
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VisRTX accepts host-backed and device-backed arrays. Host accessibility is not guaranteed: after required uploads and stream dependencies, the device is the common location where preprocessing can consume either source. Move geometry
preprocessing there without requiring device-backed inputs to return to the host.
Batch small preparation jobs, instance/registry uploads and readbacks; reuse retired input allocations and completed retirement waits. Retain input owners and drain outstanding work on preparation failures.
Evidence
Matched builds on an RTX 5880 Ada, upstream next_release
4ce0fee3→ candidate2d71888a.Before → after, milliseconds to completed bounds/BVH readiness. Host-backed,
emissive, 64 geometries × 32 primitives:
Non-emissive input replacement → readiness, host-backed, milliseconds
before → after. Small = 64 geometries × 32 primitives; large = one geometry ×
262,144 primitives:
These cases demonstrate benefits outside emissive area-CDF preparation, which was the primary driver for this PR (crashing with device-backed geometry). Large triangle replacement is near-neutral.
Trade-offs: medians for unchanged host-backed sphere, curve and quad frames can be up to 10% slower, worst case in the above tests. This is sub-milliseconds processing, mostly negligible, possibly increasing latency up to 65µs.