Export CUDA Array Interface v3 (with stream) from TensorGPU - #6496
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
|
DALI already consumes CAI v3 (stream field) when wrapping external memory; now TensorGPU.__cuda_array_interface__ also reports version 3 and a stream entry derived from the tensor's AccessOrder (1/2 for the default streams, None for host-synchronous data), waiting on the ready event when present. Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
devin/1790004929-cai-v3-export
branch
from
September 21, 2026 16:01
3d097d9 to
089e66e
Compare
Contributor
|
!build |
Collaborator
|
CI MESSAGE: [69073475]: BUILD STARTED |
Collaborator
|
CI MESSAGE: [69073475]: BUILD PASSED |
mdabek-nvidia
approved these changes
Sep 22, 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.
Category:
New feature (non-breaking change which adds functionality)
Description:
DALI already consumes CUDA Array Interface v3 objects (it honors the
streamentry when wrapping external memory inTensorGPU/TensorListGPU), but on the producer sideTensorGPU.__cuda_array_interface__still advertised version 2 with no stream information, so consumers (CuPy, Numba, PyTorch, ...) had no way to synchronize with DALI's stream other than a full device sync.This PR upgrades the exported interface to version 3 and populates the
streamentry from the tensor'sAccessOrder:0is never exported, as required by the spec;1/2are the v3 aliases for the legacy / per-thread default streams (mirroring the mapping already used on the consumer side inFillTensorFromCudaArray).Additional information:
Affected modules and functionalities:
dali/python/backend_impl.cc:ArrayInterfaceRepr<GPUBackend>now reportsversion = 3and astreamentry;TensorGPUdocstrings updated.dali/test/python/test_backend_impl_gpu.py: new tests for the exported v3 interface.Key points relevant for the review:
ready_eventhandling: when the tensor carries a ready event, the exported stream is made to wait on it so that a consumer synchronizing only withstream(as CAI v3 mandates) observes complete data.stream=None, meaning no synchronization is needed on the consumer's side.__array_interface__is unchanged.Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-2853