[Interactive Drive] Add Vulkan Support - #449
Conversation
Greptile SummaryThe PR adds an optional Vulkan renderer and integrates it into Interactive Drive, including CUDA/Vulkan external-memory synchronization and reusable output and staging pools. The prior per-slot dimension and output-consumer synchronization issues are addressed, but staging retrieval failures can still exhaust the staging pool.
Confidence Score: 4/5The PR is not yet safe to merge because exceptions during staging retrieval or JPEG encoding can permanently exhaust the staging pool and stop staged rendering. Staging slots are marked occupied before rendering, but both consumer paths release them only after potentially throwing operations; two caught failures leave no slot available for subsequent frames. Files Needing Attention: integrations/omnidreams/ludus-renderer/ludus_renderer/_cpp/bindings/torch_rasterize_vk.cpp Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
R[render_to_staging] --> A[Acquire one of two staging slots]
A --> V[Mark stagingValid]
V --> C[Render and copy frame]
C --> G[get_staging_data or JPEG encode]
G -->|success| F[Release staging slot]
G -->|exception| L[Slot remains valid]
L --> E[Two failures exhaust pool]
E --> N[Later render_to_staging returns false]
Reviews (8): Last reviewed commit: "more robustness" | Re-trigger Greptile |
|
Note it looks like there is a race-condition in the code (rotating buffers without checking 'frame-inflight'), this needs to be solved before code is RFR |
|
/ok to test ce5b00a |
|
/ok to test 6602176 |
|
/ok to test 7a72bf0 |
10cddc7 to
713f5ac
Compare
|
/ok to test 713f5ac |
| ludusCopyStagingToOutputVk( | ||
| NVDR_CTX_PARAMS, s, stagingIdx, out.data_ptr<uint8_t>()); | ||
| stateWrapper.releaseStagingSlot(stagingIdx); |
There was a problem hiding this comment.
When staging retrieval or JPEG encoding throws during synchronization, copying, allocation, or encoding, releaseStagingSlot is skipped and the slot remains occupied. After two such failures, subsequent staged renders return (-1, false) because both slots remain unavailable.
The new Vulkan backend (via very non-rigorous testing) is significantly faster than CUDA (hits lows of 2ms, highs of ~10ms; CUDA has lows of around 10ms)
The design was rushed on my end, so I do not have a proper PR description to provide accompanying the code added.
At a high-level the goal was: minimize syncs (versus last-time); minimize use external memory for a 'zero copy' abstraction over CUDA; do not recreate buffers every time we enter vk-ludus. It seems these design changes had massive perf-benefits when put together.