Commit 10afbef
[VitisAI] Add External EP Loader (#26627)
## [VitisAI] Add External EP Loader
### Description
This PR introduces a dynamic external execution provider loading
mechanism for the VitisAI execution provider, enabling runtime loading
of alternative execution providers through a plugin-style architecture.
### Key Changes
#### 1. **New External EP Library Infrastructure** (`global_api.cc`)
- Added `ExternalEpLibaray` class to dynamically load external execution
provider libraries at runtime
- Implemented complete library lifecycle management (loading, unloading,
symbol resolution)
- Added global registry (`g_external_ep_libaries`) with caching to avoid
redundant library loading
- Created `CreateExecutionProviderFromAnotherEp()` function to
instantiate execution providers from external libraries
**Implementation Details:**
- **Simplified symbol resolution**: Only resolves the essential
`GetProvider` symbol (required)
- **Removed optional symbols**: No longer attempts to resolve
`CreateEpFactories` or `RyzenAI_SetSessionOptions`
- Lazy initialization pattern with `Ensure()` method
- Safe cleanup with `Clear()` method and proper error handling
- Platform-agnostic library loading using `LIBRARY_PREFIX` and
`LIBRARY_EXTENSION` macros
#### 2. **API Extension** (`global_api.h`)
- Declared new public function: `CreateExecutionProviderFromAnotherEp()`
- Added required includes:
- `core/framework/execution_provider.h` for `IExecutionProvider`
interface
- `<memory>` for smart pointer support
#### 3. **Factory Integration** (`vitisai_provider_factory.cc`)
- Integrated external EP loading into the VitisAI provider factory
workflow
- Added provider option check for `external_ep_libray` key
- **Logic Flow**:
1. Check if `external_ep_libray` option is specified
2. If yes, load and return the external execution provider
3. If no, create and return standard VitisAI execution provider
Co-authored-by: Yueqing Zhang <[email protected]>1 parent 66c9f1c commit 10afbef
File tree
3 files changed
+59
-1
lines changed- onnxruntime/core/providers/vitisai
- imp
- include/vaip
3 files changed
+59
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
0 commit comments