From 9bdad268a5bcbfbdc90f47ec7dda43eaf24b7731 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 4 Feb 2026 02:10:18 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20DLPack:=20use=20frame.to=5Fdlpack()=20for?= =?UTF-8?q?=20decord=E2=86=92CuPy=20zero-copy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.5 --- sexp_effects/primitive_libs/streaming_gpu.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sexp_effects/primitive_libs/streaming_gpu.py b/sexp_effects/primitive_libs/streaming_gpu.py index 8760a6d..45f5fde 100644 --- a/sexp_effects/primitive_libs/streaming_gpu.py +++ b/sexp_effects/primitive_libs/streaming_gpu.py @@ -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)