feat: Add json+cuda_ipc array encoding for GPU-direct tensor transfer#588
Draft
dionhaefner wants to merge 1 commit into
Draft
feat: Add json+cuda_ipc array encoding for GPU-direct tensor transfer#588dionhaefner wants to merge 1 commit into
json+cuda_ipc array encoding for GPU-direct tensor transfer#588dionhaefner wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #588 +/- ##
==========================================
- Coverage 77.08% 75.48% -1.61%
==========================================
Files 32 32
Lines 4487 4606 +119
Branches 738 760 +22
==========================================
+ Hits 3459 3477 +18
- Misses 725 822 +97
- Partials 303 307 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Benchmark ResultsBenchmarks use a no-op Tesseract to measure pure framework overhead. 🚀 0 faster, ✅ No significant performance changes detected. Full results
|
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.
Summary
cuda_ipcarray encoding that passes CUDA IPC memory handles instead of serialized tensor bytes__cuda_array_interface__(PyTorch, CuPy, JAX, Numba)ctypescalls tolibcudartdirectly — no PyTorch or CuPy dependency in the encode pathcupy.ndarray); consumers convert viatorch.as_tensor()or DLPack as neededjson+cuda_ipcautomatically get--ipc=hostWhat problem does this solve?
Tesseract's data path is CPU-bound. Array encoding serializes via JSON/base64/binref, and copies to CPU at every boundary. For tight composition loops (optimization, MCMC), the GPU→CPU→serialize→network→CPU→GPU round-trip dominates wall time.
With
cuda_ipc, tensors stay on the GPU, while the CPU only handles metadata (like shape and dtype) – this is essentiallybinreffor GPU memory.Usage
Requirements
libcudart.so) on both producer and consumerpip install cupy-cuda12x)--ipc=hostfor cross-container IPC (handled automatically byengine.py)