Reduce compute io overhead - #107
Draft
TedThemistokleous wants to merge 32 commits into
Draft
Conversation
…pile_at_load flag
With the regular hipMemCpy we're just syninc to the host slowing things down.
Removes item from hot path that causes overhead of a bunch of CPU bound work stalling before we can send anything to the GPU for compute
…rhead for large input models Effects batch < concurrency runs.
Removes the lookup overhead and movs most thing sto a unordeed_map lookup instead of Map. Clean up existing logic for cached values based on hash
Correctnes guard for compute threads
… lookups We're doing 3-4 lookups of O(n) for inputs, now things are reduced to one O(n) lookup now in compute. Done via caching staging inputs and outputs.
Saves constant O(n) lookups each inference run. Instead we reuse teh result until otherwise reset
… launches and output scatters in the hot compute path
Checks to heavy handed and not needed since inputs should be GPU resident at the point this is checked
…put/get_shaoe/length() lookup Cleans up items we don't need to keep checking per inference and just rely on a single compare + lookup. Reduces overhead per inference useful for smaller models in the steady state path
Make this more maintainble for each mode of direct, staging and eager. Cleanup some of the copy/zeroing logic as well for hipgraph runs to reuse shared code
…unction and seperate paths We have direct bind, stagged and eager mode now in the compute path
Reuse buffers, and drop extra lookup calls to getShape() by looking for initial dimension when we're in dynamic batching mode
Only do memset on startup so we're not constantly blockign CPU hot path so we aren't wasting cycles memsetting regions we just end up slicing out. This matters for first run/capture since we want a known state but that can be handled on initial allocation/startup prior to the hot compute() path
remove hip enqueue on hot path via hipMemsetAsyc for scratch Eliminate hash pass on every batch size change remove 1 alloc + free call for GatherInputshapesandBatch
Remove 1 heap alloc for extra outputs Remove 1 call per input for tensor data precompute bound_output_bytes and use that instead of calling shape::bytes
Remove PadInputTensor and associated signature in header simplify no_padding flag creation Mirror CopyStagingOutputstoOrt to use hipMemCpyAsync instead of hipmemCpyWithstream
leverage indexing so we don't have to do a bunch of map lookups
…ry for H2D DMA Ensure we're leveraging pinned memory from io_bound inputs so the DMA from H2D avoids a memcpy reducing overall latency The added reductions here reduce pointer checks as well as the shape scans to reduce overhead if we know IO is pinned and we're in a steady state. This avoids O(N) calls and just performs a lookup
…ned memory Make the logic to coalesce trigger based on host/device memory and not whether the inputs are paged or pinned. This allows us to always collapse the N dim input copies to one larger H2D copy
…during concurrent runs
TedThemistokleous
requested review from
apwojcik,
tperry-amd and
urpetkov-amd
September 2, 2026 19:37
urpetkov-amd
approved these changes
Sep 3, 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.
Update MIGraphX EP to further refine hip graph, direct bind modes and other items to reduce overall latency
Was running into cases where we ran into lots of allocs and other items regarding the hot compute path.
Doing things to ensure we're preserving zero-copy for outputs, direct binding to allow hip graph to just run replay and performing prewarming for the hip graph combined with caching for IO, captures and state.
Simplified the compute to a direct bind - > staging -> eager path similar to the built in EP to further reduce overall latency.