AMDGPU EP: register umbrella plugin EP and forward profile options - #2
Open
zz002 wants to merge 1 commit into
Open
Conversation
zz002
force-pushed
the
oga-amdgpu-hip-ep-registration
branch
2 times, most recently
from
July 27, 2026 02:00
24ad31f to
de1f8c9
Compare
The AMDGPU umbrella is a plugin EP, so its OrtEpDevice is only visible after RegisterExecutionProviderLibrary. The C model_benchmark has no --ep_library flag, so self-register amdgpu-ep.dll on the OrtEnv the way the RyzenAI interface does, resolving the DLL next to the genai/ort module or the executable. The umbrella reads its provider options (e.g. profile) from session config entries prefixed "ep.amdgpuexecutionprovider.", not the AppendExecutionProvider_V2 ep_options channel, so bridge the genai_config provider options into that prefixed form. This is what makes profile=hip actually reach the umbrella and select the hipgpu backend. Override ShapeInitSessionProviderOptions so the trivial device-init session that EnsureDeviceOrtInit builds also carries the profile; otherwise the umbrella has no backend to create for that init session and device/allocator setup fails. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Makes the AMDGPU umbrella EP work end-to-end through OGA's own
model_benchmarkwithprofile=hip. Three OGA-side fixes insrc/amdgpu; no umbrella EP change required.Why
Testing with OGA's bundled C
model_benchmark(which has no--ep_library/-p/--profileflag; profile is passed viagenai_config.jsonprovider options) surfaced three gaps:OrtEpDeviceis only discoverable afterRegisterExecutionProviderLibrary. Legacy in-proc EPs skip this, but the umbrella does not, soAppendExecutionProvider_V2finds no device and allocation fails ("no requested allocator available"). The RyzenAI interface already self-registers its DLL; the AMDGPU path did not.profile) from session-config entries prefixedep.amdgpuexecutionprovider., not theAppendExecutionProvider_V2ep_optionschannel, soprofile=hipnever selected the hipgpu backend.EnsureDeviceOrtInitbuilds a trivial device-init session to set up the device allocator. After the Route init-session provider-option shaping through DeviceInterface microsoft/onnxruntime-genai#2232 refactor, its provider options come solely from the per-EPShapeInitSessionProviderOptionshook (default no-op), so the umbrella had no backend to create for that session.What
EnsureUmbrellaEpRegistered()insrc/amdgpu/session_options.cpp— self-registersamdgpu-ep.dllon theOrtEnv, mirroring the RyzenAI pattern (resolve the DLL next to the genai/ort module or the executable; re-registration is benign).ForwardUmbrellaProviderOptions()insrc/amdgpu/session_options.cpp— bridges the genai_config provider options intoep.amdgpuexecutionprovider.*config entries so the umbrella selects the requested backend.ShapeInitSessionProviderOptions()override insrc/amdgpu/interface.cpp— forwards the user's provider options to the trivial init session so it carries the profile too.Test plan
model_benchmark.exe+onnxruntime-genai.dlllocally with the umbrellaamdgpu-ep.dll+hip-backend.dll.profile=hipruns end-to-end on Llama-3.1-8B (int4-awq) viamodel_benchmark.exeon gfx1151 (StxHalo); prefill + decode complete, output correct.Notes for reviewers