Skip to content

Test-only (do not merge): build the umbrella EP with hip as its only backend - #77

Draft
zz002 wants to merge 2 commits into
onnxruntime:mainfrom
zz002:build/amdgpu-backend-subset
Draft

Test-only (do not merge): build the umbrella EP with hip as its only backend#77
zz002 wants to merge 2 commits into
onnxruntime:mainfrom
zz002:build/amdgpu-backend-subset

Conversation

@zz002

@zz002 zz002 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Test-only draft, not intended to be merged: it exists so that ROCm/hip-ep CI can validate the hip flow end to end.

It builds the umbrella EP with hip as its only backend (no DirectML, no MIGraphX SDK on the runners), and keeps the registration-time data transfer usable, which OGA needs when it zeroes its KV cache outside a session.

@CLAassistant

CLAassistant commented Aug 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@zz002
zz002 force-pushed the build/amdgpu-backend-subset branch 2 times, most recently from e5d7474 to d55945c Compare August 7, 2026 07:47
@zz002 zz002 changed the title amdgpu: build with a backend subset; fix the registration-time data transfer Test-only (do not merge): build the umbrella EP with hip as its only backend Aug 7, 2026
zz002 and others added 2 commits August 7, 2026 02:49
This branch validates the hip backend on machines that have no MIGraphX SDK, so
force USE_MIGRAPHX off under USE_AMDGPU and compile out everything that needs the
MIGraphX backend: its DLL load and unload, CreateMIGraphXBackend, mgx_options.h and
the body of create_migraphx_backend. Profiles that used to fall back to MIGraphX run
hip instead, which is what the device-init session OGA creates with empty provider
options needs, since that one arrives as Profile::Auto.

amdgpu-ep links hip-shared unconditionally for the ASIC query behind its Auto
routing, so hip-shared now also builds for USE_HIP and not only for the other
HIP-based backends.

Co-authored-by: Cursor <cursoragent@cursor.com>
ORT creates one DataTransfer when the EP library is registered, before any session
has selected a backend, and that instance is what backs OrtApi::CopyTensors outside
a session. Snapshotting the backend in the constructor left it permanently inert, so
those copies had no data transfer at all: OGA zeroes its KV cache that way and failed
with "Could not allocate the key-value cache buffer" on every model.

Resolve that one instance lazily against the currently selected backend, the way the
Allocator wrapper already does, and keep the per-session snapshot for the transfers
ORT creates from CreateEp. Following the selection also keeps it correct when the
device-init session and the main session pick different backends.

Co-authored-by: Cursor <cursoragent@cursor.com>
zz002 added a commit to ROCm/hip-ep that referenced this pull request Aug 7, 2026
…ntime-ep-amdgpu#77

The AMD GPU umbrella EP was built from a personal fork pinned at a bare commit,
with the fork carrying local changes that upstream never saw. Build it from
upstream onnxruntime/onnxruntime-ep-amdgpu at AMDGPU_EP_COMMIT plus the PRs in
AMDGPU_EP_PR_PATCHES instead -- the same pin-plus-patches shape the ORT and OGA
steps already use, so the local delta is a reviewable upstream PR and dropping it
later means deleting a PR number.

DirectML defaults on for Windows builds of the umbrella, so it is turned off
explicitly. MIGraphX comes off through the patch, which forces it off under
USE_AMDGPU: the runner has no MIGraphX SDK, and the HIP shim (hipgpu.dll, the
morphizen EP renamed via cmake/deps.cmake) is the only backend this package
ships. That is why the pin cannot be upstream alone yet.

Upstream also links hip-shared unconditionally for the ASIC query behind Auto
routing, so amdgpu-ep now needs find_package(hip) to resolve -- and it configures
before the project build that used to auto-download TheRock into its own build
tree. Download the SDK once in a dedicated step and hand it to both consumers
(CMAKE_PREFIX_PATH for amdgpu-ep, --therock_dist for the project build) so the
job does not pull two 2.2 GB copies. The URL and ROCm version are read from
cmake/deps.txt, so the step cannot pin an SDK a local build would not resolve.
The SDK is deliberately not cached: the extracted tree would crowd the far more
expensive llvm-install/ort-install out of the repo's 10 GB cache budget.

Verified locally on gfx1151: pull/77.patch applies on the pinned commit with git
am and reproduces the PR head tree exactly, and the resulting tree configures and
builds amdgpu-ep.dll + hip-backend.dll with the flag set this workflow now passes
(USE_AMDGPU=ON, USE_DML=OFF, TheRock on CMAKE_PREFIX_PATH).
zz002 added a commit to ROCm/hip-ep that referenced this pull request Aug 11, 2026
…ntime-ep-amdgpu#77

The AMD GPU umbrella EP was built from a personal fork pinned at a bare commit,
with the fork carrying local changes that upstream never saw. Build it from
upstream onnxruntime/onnxruntime-ep-amdgpu at AMDGPU_EP_COMMIT plus the PRs in
AMDGPU_EP_PR_PATCHES instead -- the same pin-plus-patches shape the ORT and OGA
steps already use, so the local delta is a reviewable upstream PR and dropping it
later means deleting a PR number.

DirectML defaults on for Windows builds of the umbrella, so it is turned off
explicitly. MIGraphX comes off through the patch, which forces it off under
USE_AMDGPU: the runner has no MIGraphX SDK, and the HIP shim (hipgpu.dll, the
morphizen EP renamed via cmake/deps.cmake) is the only backend this package
ships. That is why the pin cannot be upstream alone yet.

Upstream also links hip-shared unconditionally for the ASIC query behind Auto
routing, so amdgpu-ep now needs find_package(hip) to resolve -- and it configures
before the project build that used to auto-download TheRock into its own build
tree. Download the SDK once in a dedicated step and hand it to both consumers
(CMAKE_PREFIX_PATH for amdgpu-ep, --therock_dist for the project build) so the
job does not pull two 2.2 GB copies. The URL and ROCm version are read from
cmake/deps.txt, so the step cannot pin an SDK a local build would not resolve.
The SDK is deliberately not cached: the extracted tree would crowd the far more
expensive llvm-install/ort-install out of the repo's 10 GB cache budget.

Verified locally on gfx1151: pull/77.patch applies on the pinned commit with git
am and reproduces the PR head tree exactly, and the resulting tree configures and
builds amdgpu-ep.dll + hip-backend.dll with the flag set this workflow now passes
(USE_AMDGPU=ON, USE_DML=OFF, TheRock on CMAKE_PREFIX_PATH).
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.

2 participants