Skip to content

[AIMIGRAPHX-1156] - Coalesce io debug#247

Merged
TedThemistokleous merged 3 commits into
rocm7.14_internal_testingfrom
coalesce_io_debug
Jul 13, 2026
Merged

[AIMIGRAPHX-1156] - Coalesce io debug#247
TedThemistokleous merged 3 commits into
rocm7.14_internal_testingfrom
coalesce_io_debug

Conversation

@TedThemistokleous

@TedThemistokleous TedThemistokleous commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

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

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
TedThemistokleous merged commit 4cbc9b5 into rocm7.14_internal_testing Jul 13, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant