Fix DLPack: use frame.to_dlpack() for decord→CuPy zero-copy
Some checks are pending
GPU Worker CI/CD / test (push) Waiting to run
GPU Worker CI/CD / deploy (push) Blocked by required conditions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-04 02:10:18 +00:00
parent 1cb9c3ac8a
commit 9bdad268a5

View File

@@ -332,10 +332,11 @@ class GPUVideoSource:
# Convert to CuPy via DLPack (zero-copy GPU transfer)
if GPU_AVAILABLE:
# decord tensors support DLPack for zero-copy conversion
# This keeps the frame on GPU without any CPU transfer
# decord tensors have .to_dlpack() which returns a PyCapsule
# that CuPy can consume for zero-copy GPU transfer
try:
gpu_frame = cp.from_dlpack(frame_tensor)
dlpack_capsule = frame_tensor.to_dlpack()
gpu_frame = cp.from_dlpack(dlpack_capsule)
# Log success once per source
if not getattr(self, '_dlpack_logged', False):
print(f"[GPUVideoSource] DLPack zero-copy SUCCESS - frames stay on GPU", file=sys.stderr)