Repository navigation
fix: GPU tensor allocation fall back to host memory - #457
Merged
Merged
Conversation
|
7 of 11 tasks
whoisj
approved these changes
Oct 7, 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.
What does the PR do?
Fixes silent output corruption when a Python model returns a GPU tensor and Triton's CUDA memory pool is exhausted. In that case the response allocator falls back to the pinned host pool and hands the backend a
CPU_PINNEDbuffer; the Python backend only handledMEMORY_CPUon that path, so the tensor never reached the Triton-provided buffer and the response went out with whatever the recycled pinned block last held (zeros or another request's data), with no error. Pairs with the QA-side change inserver#8992.Root cause
PbMemory::CopyBufferhas noGPU -> CPU_PINNEDcase and fell through tocudaMemcpyHostToDevice. On older CUDA this produced thefailed to copy data: invalid argumentreported in server#7148; on CUDA 13 the copy silently succeeds into the shared-memory intermediate.PbMemory::Createleft the parent-side data pointer null for aCPU_PINNEDintermediate.python_be.cc(ResponseSendTBDandProcessRequests) matched neither the CPU nor the GPU branch forCPU_PINNED, so the staged tensor was never copied into the Triton buffer. This is the live cause on current stacks.--pinned-memory-pool-byte-size=0masked the bug because the fallback then lands on plainMEMORY_CPU, which was handled.Fix
CPU_PINNEDas host memory when choosing thecudaMemcpyKindinPbMemory::CopyBuffer(src/pb_memory.cc).PbMemory::Create(src/pb_memory.cc).CPU_PINNEDintermediates back to the Triton buffer in both copy-back loops (src/python_be.cc).No behaviour change on the GPU or plain-CPU paths.
Checklist
<commit_type>: <Title>Commit Type:
Related PRs:
Where should the reviewer start?
Test plan:
Caveats:
Background
Related Issues: