-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add a new single API for Level Zero Init and Driver Retrieval #298
Labels
Comments
nrspruit
added a commit
to nrspruit/level-zero-spec
that referenced
this issue
Apr 2, 2024
Closes oneapi-src#298 Signed-off-by: Neil R. Spruit <[email protected]>
nrspruit
added a commit
to nrspruit/level-zero-spec
that referenced
this issue
May 6, 2024
Closes oneapi-src#298 Signed-off-by: Neil R. Spruit <[email protected]>
nrspruit
added a commit
to nrspruit/level-zero-spec
that referenced
this issue
May 6, 2024
Closes oneapi-src#298 Signed-off-by: Neil R. Spruit <[email protected]>
nrspruit
added a commit
to nrspruit/level-zero-spec
that referenced
this issue
May 6, 2024
Closes oneapi-src#298 Signed-off-by: Neil R. Spruit <[email protected]>
What is the current status for this case? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add a new single API for Level Zero Init and Driver Retrieval
Metadata
Component
Core
Classification
API
Authors
Neil R. Spruit <[email protected]>
Summary
When multiple libraries exist in an application which are initializing L0, the types of drivers reported may not be consistent. We need to have a single API to both initialize level zero and filter the reported drivers.
Motivation
In a single application, one library may request GPUs and another may request VPUs. This creates a problem where calling the initialization and driver retrieval APIs in sequence may result in the wrong set of drivers being filtered for the specific library.
To fix this issue, a single API is proposed for use by all libraries such that Level Zero initialization and driver retrieval is done in a single API call.
Description
Add a new API
zeInitDrivers
with a new initialization flag type to allow for both the initialization of Level Zero drivers and the retrieval of Level Zero driver handles in a single call.This enables users to initialize and retrieve the Level Zero drivers based on the driver types requested with no dependencies or interference from other calls to Level Zero initialization.
Dependencies
Details
Any library needing to use NPUs and GPUs or only NPUs would be moved to use this new API
zeInitDrivers
to perform the Level Zero initialization and the driver retrieval. This makes it possible to retrieve the specified set of drivers based on the initialzation flags such that:Multiple Call Safety
Similar to the usage of
zeInit
, multiple calls tozeInitDrivers
with the same flags must return the same driver handles in the same order.Each call to
zeInitDrivers
will initialize the driver types associated with the initialization type flags, i.e.:zeInitDrivers
withZE_INIT_DRIVER_TYPE_FLAG_GPU
will initialize and retrieve GPU Drivers.zeInitDrivers
withZE_INIT_DRIVER_TYPE_FLAG_NPU
will initialize and retrieve NPU Drivers.Subsequent calls to
zeInitDrivers
with different sets of initialization type flags will return different sets of drivers.Once a given driver has been initialized by the loader, it will not be re-initialized by the loader in subsequent calls. The initialization type will then indicate whether that driver handle needs to be returned to the user. This ensures that the driver is not forced to re-initialize after each call to
zeInitDrivers
and it is able to maintain the global singleton object that is the driver and device handles for a Level Zero driver.zeInit Deprecation Plan
To maintain backwards compatibility and avoid regressions,
zeInit
must continue to be supported in v1.x however only with support for initializing with the first "init" flags passed in the program and limited to supporting GPU initialization.This means, to support different sets of library initializations with different sets of drivers, the new
zeInitDrivers
will be evangelized as the replacement for those wanting to use both GPU and NPU or want to ensure that NPUs are available to the application.The
zeInit
API will be marked deprecated as part of this proposal and removed in the next major version release of the Level Zero spec.Application Usage of zeInitDrivers
Applications which are built linking the ze_loader will either need to have a build time check for the symbol
zeInitDrivers
or continue to usezeInit
. This can be done by adding a compile time symbol check in the code to verify the symbol is defined in the headers. For runtime, this would limit this version of these libraries to require this new version of the Level Zero loader with this symbol defined.Applications that want a dynamic method for discovering this new API via
dlopen
/LoadLibrary
will be able to check for the symbol's existence during runtime.New Entry Points
zeInitDrivers
New Enums
ze_init_driver_type_flags_t
ze_structure_type_t
New Structures
ze_init_driver_type_desc_t
stype
andpNext
).Example Usage
The text was updated successfully, but these errors were encountered: