You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/execution-providers/plugin-ep-libraries/index.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,6 @@ nav_order: 17
6
6
---
7
7
8
8
# Plugin Execution Provider Libraries
9
-
10
9
An ONNX Runtime Execution Provider (EP) executes model operations on one or more hardware accelerators (e.g., GPU, NPU, etc.). ONNX Runtime provides a variety of built-in EPs, such as the default CPU EP. To enable further extensibility, ONNX Runtime supports user-defined plugin EP libraries that an application can register with ONNX Runtime for use in an ONNX Runtime inference session.
11
10
12
11
This section provides a reference for plugin EP libraries.
This page provides guidance for ONNX Runtime plugin EP implementers to consider with regards to packaging for a plugin EP.
14
13
15
14
## Contents
16
-
17
15
{: .no_toc }
18
16
19
17
* TOC placeholder
@@ -22,17 +20,14 @@ This page provides guidance for ONNX Runtime plugin EP implementers to consider
22
20
## General Guidance
23
21
24
22
### Usage
25
-
26
23
Note: Generally, when referring to the ORT API, we will refer to the C API functions. Equivalents should exist for other language bindings that support plugin EP usage.
27
24
28
25
#### Manual EP Library Registration
29
-
30
26
Users are expected to call [`OrtApi::RegisterExecutionProviderLibrary()`](https://onnxruntime.ai/docs/api/c/struct_ort_api.html#a7c8ea74a2ee54d03052f3d7cd1e1335d) to register the plugin EP library. Then, they may either choose to use the auto EP selection mechanism or manually call [`OrtApi::SessionOptionsAppendExecutionProvider_V2()`](https://onnxruntime.ai/docs/api/c/struct_ort_api.html#a285a5da8c9a63eff55dc48e4cf3b56f6) to explicitly use the plugin EP.
31
27
32
28
### Structure
33
29
34
30
#### Contents
35
-
36
31
A plugin EP package should contain the plugin EP shared library file and any other files that need to be distributed with it.
37
32
38
33
A plugin EP package should NOT contain the ORT shared library or other core ORT libraries (e.g., onnxruntime.dll or libonnxruntime.so). Users should obtain the ORT library separately, most likely via installing the separate ONNX Runtime package.
@@ -42,7 +37,6 @@ A plugin EP package should have no need to depend on the separate ONNX Runtime p
42
37
#### Additional Information to Provide
43
38
44
39
##### Library Path
45
-
46
40
There should be a way to get the package's plugin EP library path. The user will need the plugin EP library path to call `OrtApi::RegisterExecutionProviderLibrary()`.
47
41
48
42
For example, the package may provide a helper function that returns the path to the plugin EP library. The recommended name for this helper function is "get library path".
@@ -53,7 +47,6 @@ There should be a way to get the plugin EP name(s) provided by the package. The
53
47
For example, the plugin EP name(s) may be well-documented or made available with a helper function provided by the package. The recommended name for a helper function returning all EP names is "get EP names". Additionally, if there is only one EP name, a helper function returning the single value named "get EP name" may be provided for convenience.
54
48
55
49
#### Package Naming
56
-
57
50
The name of the package should indicate that the package contains a plugin EP and be distinguishable from other ORT packages.
58
51
59
52
For example, this may be done by using a special prefix or suffix.
@@ -63,23 +56,20 @@ For example, this may be done by using a special prefix or suffix.
63
56
### PyPI
64
57
65
58
#### Package Naming
66
-
67
59
The prefix "onnxruntime-ep" can be used to identify a plugin EP.
68
60
69
61
The suggested package naming convention is "onnxruntime-ep-\<EP identifier\>".
70
62
71
63
For example, "onnxruntime-ep-contoso-ai".
72
64
73
65
#### Helper Functions
74
-
75
66
The package should provide helper function `get_library_path()` to get the EP library path.
76
67
77
68
The package should provide helper function `get_ep_names()` to get the EP name(s).
78
69
79
70
The package may provide helper function `get_ep_name()` to get the single EP name if there is just one.
A plugin EP is responsible for ensuring that its implementation behaves correctly. This includes interacting with ONNX Runtime in the expected way as documented by the plugin EP API. It also includes the operator-level behavior as specified by the operator specification, e.g., from the ONNX standard.
14
13
15
14
## Contents
16
-
17
15
{: .no_toc }
18
16
19
17
* TOC placeholder
20
18
{:toc}
21
19
22
20
## EP unit testing
23
-
24
21
Plugin EP implementations are expected to have their own unit tests.
25
22
26
23
### Operator-level testing utility provided by ONNX Runtime
27
-
28
24
ONNX Runtime has existing unit tests that validate an EP's op implementation. These tests are located in the unit test program `onnxruntime_provider_test`. This program supports usage with a dynamically specified plugin EP.
29
25
30
26
In particular, unit tests utilizing the `onnxruntime::test::OpTester` or `onnxruntime::test::ModelTester` classes can also be run with a plugin EP.
31
27
32
28
Plugin EP implementers may use this test program to help test their plugin EP if desired. The rest of this section explains how to do this.
33
29
34
30
#### Building
35
-
36
31
Build the onnxruntime shared library and the `onnxruntime_provider_test` target from source.
37
32
```
38
33
cd <onnxruntime repo>
@@ -43,7 +38,6 @@ cd <onnxruntime repo>
43
38
The onnxruntime shared library and `onnxruntime_provider_test` will be available in the binary output directory.
44
39
45
40
#### Running
46
-
47
41
`onnxruntime_provider_test` supports the standard GoogleTest arguments. E.g., `--gtest_filter` can be used to run particular tests of interest.
48
42
49
43
Importantly, it supports configuration of a dynamically specified plugin EP through the environment variable `ORT_UNIT_TEST_MAIN_DYNAMIC_PLUGIN_EP_CONFIG_JSON`. The configuration value should be specified as a JSON string.
@@ -67,7 +61,6 @@ As an alternative to `selected_ep_name`, `selected_ep_device_indices` may be set
67
61
Optionally, `default_ep_options` may be set to specify EP-specific options as string key value pairs.
68
62
69
63
## EP integration testing and model testing
70
-
71
64
There are a number of APIs that a plugin EP will implement to interact with ONNX Runtime. Although conformance tests at the EP API level were considered, they were not deemed to be that useful yet. Currently, it is expected that the integration with ONNX Runtime can be meaningfully tested using high level tests that run an entire model.
72
65
73
66
Plugin EPs may vary significantly from one to another in terms of capability, whether it is optional feature support or operator support. Therefore, it is expected that plugin EPs will have a set of models that are most relevant to them and that these models can be used for testing.
0 commit comments