[AIMIGRAPHX-1156] - Coalesce io debug#247
Merged
Merged
Conversation
warmup_and_capture_hip_graph zeroed the pinned input buffers right after copy_inputs_to_pinned had populated them with the request's real data. In coalesced mode those buffers are sub-views of the input arena, so the zeroing wiped the real inputs and the capture (and the value copied back as the first request's output) computed f(0). Every later request replayed with real inputs and was correct, which is exactly the observed first-request-per-instance error. Only outputs and scratch need a deterministic zero baseline (captured kernels may read-modify-write them); the inputs are fully written every request and the arena's aligned gaps are already zeroed at allocation. Stop zeroing inputs at capture.
pad_input_tensor hardcoded hipMemcpyDeviceToDevice for the initial copy and replicated the pad tail from src_data. When a padded input is host-resident (an ORT CPU tensor) that read the host pointer as device memory. Use hipMemcpyDefault for the initial copy (HIP infers the direction) and replicate the pad tail from the already-copied device destination so it stays DeviceToDevice.
After a hipGraph is captured, optionally run one eager pass and one replay on the same real inputs and compare the pre-allocated pinned outputs. On mismatch, tear down the graph, disable hipGraph for the node, and serve eagerly, turning any future capture-baseline regression into a safe fallback instead of silent numerical drift. Gated behind ORT_MIGRAPHX_VERIFY_HIP_GRAPH and off by default, so production pays no host-copy cost. float outputs are compared with an absolute tolerance; other dtypes are compared bit-exact.
TedThemistokleous
merged commit Jul 13, 2026
4cbc9b5
into
rocm7.14_internal_testing
2 of 4 checks passed
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.
Description
Fixes issue regarding memory coalescing showing error on first inference
Added additional redundancy items to ensure validity of graph capture vs eager mode. added flag to toggle via self check in cases where accuracy drops.
Motivation and Context