Skip to content

fix(rtx): support CUDA-backed texture arrays and preserve mapping pointer - #395

Merged
jeffamstutz merged 4 commits into
NVIDIA:next_releasefrom
tarcila:cuda-texture-array-interop
Nov 17, 2026
Merged

jeffamstutz merged 4 commits into
NVIDIA:next_releasefrom
tarcila:cuda-texture-array-interop

Conversation

@tarcila

@tarcila tarcila commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix CUDA-backed array mapping and texture uploads, and expand RGB data directly into CUDA texture arrays without a host round trip.

  • Return the supplied CUDA pointer when mapping shared or captured CUDA-backed arrays, instead of current null. Host-backed arrays continue to map their host allocation, even when an internal GPU copy exists.
  • Upload CUDA-backed texture data with device-to-device copies, rejecting foreign-device pointers before copying or launching kernels.
  • Expand CUDA RGB inputs directly into RGBA texture arrays using surface writes, preserving component bits and padding alpha to opaque.
  • Remove unused MDL vector-input resolvers (compilation warning) and document CUDA-backed mapping behavior.

Testing

Passed the existing build-mdl test binaries on one GPU:

  • TestArrayMapping
  • rtx_test_RGBExpansion
  • TestTextureDataUpdate

Coverage includes mapping ownership and pointer identity, repeated texture updates, RGB expansion across component types and dimensions, windowed arrays, and upload-failure recovery.

The foreign-device rejection test was skipped because only one GPU was allocated. No clean rebuild or full test-suite run was performed during review.

Remove private helpers with no callers to avoid MDL C225 warnings during
device initialization. Preserve exported input types and constructors.
CUDA-backed shared and captured arrays have no host allocation, so the
host-only mapping lookup returned null. Return the supplied CUDA pointer
without uploading or exposing an internal device copy of host storage.

Exercise repeated mapping and captured-memory lifetime; reject mapping
state warnings without coupling the test to unrelated device warnings.
Host-only source lookup prevented CUDA-backed arrays from reaching image
samplers. Select the copy direction from the source allocation and prefer
host storage when an internal device copy may be stale. Reject foreign-GPU
pointers before copying or launching work on the current device.

Cover rendered updates through unmap and safe foreign-pointer rejection.
Avoid downloading RGB input or allocating an intermediate RGBA buffer.
Thrust surface writes populate the final texture array while preserving
component bits and opaque alpha. Only device RGB needs surface support.

Translate Thrust failures to CUDA status without attributing earlier
thread-local errors to the expansion. Share the compiled production kernel
with a focused unit test covering native formats, offsets, repeated writes,
and unrelated CUDA errors.
@tarcila
tarcila force-pushed the cuda-texture-array-interop branch from c0a1618 to 23add40 Compare November 17, 2026 22:24
@tarcila
tarcila requested a review from jeffamstutz November 17, 2026 22:33
@jeffamstutz
jeffamstutz merged commit aba2b82 into NVIDIA:next_release Nov 17, 2026
8 checks passed
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.

2 participants