Skip to content

Add AMDGPU execution provider (port of #2165 to rel-0.15.1) - #1

Merged
Zhaeong merged 11 commits into
AMD-GPU:rel-0.15.1from
aditya-dl:amd/dev/adilohia/amdgpu-ep-0.15.1
Aug 4, 2026
Merged

Add AMDGPU execution provider (port of #2165 to rel-0.15.1)#1
Zhaeong merged 11 commits into
AMD-GPU:rel-0.15.1from
aditya-dl:amd/dev/adilohia/amdgpu-ep-0.15.1

Conversation

@aditya-dl

Copy link
Copy Markdown

Ports the AMDGPU execution provider work from PR microsoft#2165 onto rel-0.15.1.

Adds the AMDGPU umbrella EP with a GPU-resident KV cache and host-accessible decode inputs. Same 11 commits as microsoft#2165, adapted to the 0.15.1 DeviceInterface::GetMemoryInfo() refactor.

  • AMDGPU EP with GPU-resident KV cache
  • Host-accessible (pinned) decode inputs, with logits routed off that allocator
  • Compute + host-accessible allocators bound to the selected device
  • model_arch forwarded to the umbrella EP for backend routing
  • DirectML backend host-accessible decode inputs
  • Review fixes from Add AMDGPU execution provider microsoft/onnxruntime-genai#2165

Add the AMDGPU execution provider to ONNX Runtime GenAI. The AMDGPU EP
resolves a profile to a concrete backend (MIGraphX or DML) at runtime;
OGA drives it as a single DeviceType::AMDGPU.

Provider naming: exposed as "amdgpu"; OGA also accepts
"AMDGPUExecutionProvider" (the catalog form used by the AMD-shipped
Windows ML EP MSIX) so test harnesses that match config strings against
WinML-discovered names work without bypass hacks. Both normalize to
"AMDGPU".

GPU-resident KV cache: a GPU-resident DeviceInterface keeps the KV cache
on the device (no per-token CPU-to-GPU roundtrip), with backend-agnostic
opaque DeviceBuffer copies that dispatch to the active backend.

Static-shape prefill: emit ep.migraphx.static_pad_* and hip_graph_enable
session-config entries so the EP pads the prefill token axis and reuses a
captured graph. DML ignores the migraphx-namespaced keys.

Known limitations:
- Beam search not supported (needs past_present_share_buffer=true, which
  requires num_beams=1)
Route the small decode inputs (input_ids/position_ids/attention_mask) through a host-accessible (CPU-writable, GPU-readable) allocator so the CPU updates them in place with no per-step copy. Resolved via GetSharedAllocator; KV cache and scoring stay on the default device interface, and the path falls back to default inputs if no host-accessible allocator is available. Single-GPU only for now (device_id 0).
Logits is GPU-written and CPU-read (the sampler), the opposite of the pinned decode inputs. On AMDGPU the inputs use a host-accessible allocator whose heap is not CPU-read-coherent, so reading logits from it returns stale data. Route logits to the CPU interface instead via a new p_logits_ member; only the decode inputs stay on the host-accessible allocator.
…ice (review microsoft#2165)

Resolve the AMDGPU device id from the filtered EP device instead of hardcoding 0. The EP keys its allocator on this id, so a hardcoded 0 pinned compute to device 0 regardless of the selected device. Correlate the host-accessible pool to the same id so pinned decode inputs live on the device that runs the model. Single-GPU resolves to id 0, unchanged.
The umbrella EP routes backends by model architecture but OGA never sent it, so every model routed as non-LLM. Emit config.model.type as the ep.amdgpuexecutionprovider.model_arch provider option alongside the existing static-padding hints.
Trailing-comment spacing and argument-continuation alignment flagged by the lint-cpp CI check (clang-format 20.1.0). Formatting only, no behavior change.
Emit the ep.directml.enable_host_accessible provider option so the DirectML backend uses host-accessible decode inputs. Sits alongside the existing static-padding and model_arch config entries.
@Zhaeong
Zhaeong merged commit af27a00 into AMD-GPU:rel-0.15.1 Aug 4, 2026
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