Repository navigation
Conversation
larissakl
requested review from
SimBe195 and
curufinwe
and removed request for
curufinwe
November 2, 2026 12:49
This branch has not been deployed
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.
This PR prepares the ONNX module for a transformer state manager that keeps its KV cache states on the GPU. As long as all inputs and outputs are in host memory,
Session::runuses the previous code path, so existing setups are not effected.Onnx::Valuecan now hold tensors in CUDA device memory. New helpers check where a tensor is, copy it to the host or wrap existing device memory. Host accessors abort with a clear message when called on a device tensor.Session::rungets an overload with a memory location per output. If any input or output is on the device, the run uses anOrt::IoBinding. By default, a state output stays on the device if its state input came from the device and everything else goes to the host. This way label scorers and LMs need no changes once a state manager provides device inputs.All CUDA sessions of a process now share one CUDA stream, so other code can write device inputs on the same stream without extra synchronization. Note that each run synchronizes this stream, so sessions used from several threads wait for each other's GPU work. The new parameter
cuda-use-tf32allows disabling TF32. Requires onnxruntime >= 1.16.Depends on #279.