-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[MIGraphX EP] Proof of concept: Implement OrtExternalResourceImporter for D3D12-HIP interop #27001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… for D3D12-HIP interop Add experimental implementation of OrtExternalResourceImporter interface for MIGraphX EP to enable zero-copy import of D3D12 shared resources on Windows via HIP Runtime APIs. This proof of concept demonstrates: **Memory Import** - Import D3D12 committed resources (ORT_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE) - Import D3D12 heaps (ORT_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP) - Map imported resources using hipExternalMemoryGetMappedBuffer - Create ORT tensors backed by imported device memory for zero-copy access **Synchronization** - Import D3D12 timeline fences as HIP external semaphores - Implement wait/signal operations on HIP streams - Enable GPU-GPU synchronization between D3D12 and HIP workloads **Infrastructure** - MigraphxExternalMemoryHandle: Wraps hipExternalMemory_t with mapped pointers - MigraphxExternalSemaphoreHandle: Wraps hipExternalSemaphore_t for D3D12 fences - MigraphxSyncStreamImpl: Wraps hipStream_t for OrtSyncStream interface - Factory integration via CreateExternalResourceImporterForDeviceImpl **Key Files** - onnxruntime/core/providers/migraphx/migraphx_external_resource_importer.h - onnxruntime/core/providers/migraphx/migraphx_external_resource_importer.cc - onnxruntime/core/providers/migraphx/migraphx_provider_factory.cc (updated) This enables scenarios like DirectML → MIGraphX model chaining without CPU round-trips, improving performance for hybrid GPU workloads. Windows-only implementation (guarded by #ifdef _WIN32).
| @@ -0,0 +1,551 @@ | |||
| // Copyright (c) Microsoft Corporation. All rights reserved. | |||
Check warning
Code scanning / lintrunner
CLANGFORMAT/format Warning
Run lintrunner -a to apply this patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can commit the suggested changes from lintrunner.
| impl.device_id_, OrtMemTypeDefault, | ||
| &memory_info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| impl.device_id_, OrtMemTypeDefault, | |
| &memory_info); | |
| impl.device_id_, OrtMemTypeDefault, | |
| &memory_info); |
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add experimental implementation of OrtExternalResourceImporter interface for MIGraphX EP to enable zero-copy import of D3D12 shared resources on Windows via HIP Runtime APIs.
This proof of concept demonstrates:
Memory Import
Synchronization
Infrastructure
Key Files
This enables scenarios like DirectML → MIGraphX model chaining without CPU round-trips, improving performance for hybrid GPU workloads.