1
1
# The DPC++ Runtime Plugin Interface.
2
2
3
-
4
3
## Overview
5
4
The DPC++ Runtime Plugin Interface (PI) is the interface layer between
6
5
device-agnostic part of the DPC++ runtime and the device-specific runtime layers
@@ -41,12 +40,57 @@ once before any actual offload is attempted.
41
40
42
41
### Plugin discovery
43
42
44
- Plugins are physically dynamic libraries stored somewhere in the system where
45
- the DPC++ runtime runs. TBD - design and describe the process in details.
43
+ Plugins are physically dynamic libraries or shared objects.
44
+ The process to discover plugins will follow the following guidelines.
45
+
46
+ The SYCL Runtime will read the names of the plugins from a configuration file
47
+ at a predetermined location (TBD - Add this location). These plugins are
48
+ searched at locations in env LD_LIBRARY_PATH on Linux and env PATH on Windows.
49
+ (TBD - Extend to search the plugins at a path relative to the SYCL Runtime
50
+ installation directory by using DT_RPATH on Linux. Similar functionality can be
51
+ achieved on Windows using SetDllDirectory. This will help avoiding extra setting
52
+ of LD_LIBRARY_PATH.)
53
+ To avoid any issues with read-only access, an environment variable SYCL_PI_CONFIG
54
+ can be set to point to the configuration file which lists the Plugin names. The
55
+ enviroment variable if set overrides the predetermined location's config file.
56
+ These Plugins will then be searched in LD_LIBRARY_PATH locations.
57
+ It is the developer's responsibility to include the plugin names from the
58
+ predetermined location's config file to enable discovery of all plugins.
59
+ (TBD - Extend to support search in DT_RPATH as above.)
60
+ A trace mechanism is provided to log the discovery/ binding/ device
61
+ enumeration process. Eg: Display all the plugins being discovered, their
62
+ information and supported PI version. List attached devices and their properties.
63
+
64
+ TBD - design and describe the process in detail.
46
65
47
66
#### Plugin binary interface
48
- TBD - list and describe all the symbols plugin must export in order to be picked
49
- up by the DPC++ runtime for offload.
67
+ Plugins should implement all the Interface APIs required for the PI Version
68
+ it supports. It will export a function that will return the function pointer
69
+ table that contains the list of implemented Interface Function pointers in a
70
+ predetermined order defined in pi.h.
71
+ In the future, this document will list the minimum set of Interface APIs
72
+ to be supported by Plugins. This will also require adding functionality to SYCL
73
+ Runtime to work with such limited functionality plugins.
74
+
75
+ TBD - list and describe the symbols that a plugin must implement in order to
76
+ be picked up by the SYCL runtime for offload.
77
+
78
+ #### Binding a Plugin
79
+ Plugins expose the information of supported PI API version.
80
+ The Plugin Interface queries the plugins on the supported PI version and checks
81
+ for compatibility.(TBD - Extend to support version compatibility checks without
82
+ loading the library. Eg: Changing the plugin name to reflect the supported
83
+ Plugin Interface version.)
84
+ The Plugin Loader then queries each plugin for the Function Pointer Table
85
+ and populates a list of the PI API Function Pointers for each plugin.
86
+ The user can select/disable a specific plugin with an environment variable,
87
+ SYCL_PI_USE. (TBD - Describe the semantics in a separate section for EV and
88
+ trace.)
89
+ The information of compatible plugins (with the Function Pointer Table) is
90
+ stored in the associated platforms during platform object construction.
91
+ The PI API calls are forwarded using this information.
92
+ There is pi.def/pi.h file that lists all PI API names that can be called by the
93
+ Plugin Interface.
50
94
51
95
#### OpenCL plugin
52
96
@@ -56,12 +100,20 @@ OpenCL implementations. They can be installed either in the standard Khronos
56
100
ICD-compatible way (e.g. listed in files under /etc/OpenCL/vendors on
57
101
Linux) or not, and the OpenCL plugin can hook up with both.
58
102
59
- TBD describe the nested OpenCL implementation discovery process performed by
103
+ TBD - describe the nested OpenCL implementation discovery process performed by
60
104
the OpenCL plugin
61
105
62
106
### Device enumeration by plugins
107
+ After the compatible plugins are loaded, the trace will show all available
108
+ devices from each plugin. Similarly, the trace can be extended to show the
109
+ underlying API calls that each PI plugin call is being directed to.
110
+
111
+ TBD - Describe the exact API calls to enable device enumeration feature.
112
+
113
+ ### Plugin Unloading
114
+ The plugins not chosen to be connected to will be unloaded.
63
115
64
- TBD
116
+ TBD - Unloading a bound plugin.
65
117
66
118
## PI API Specification
67
119
0 commit comments