Fixed Global Driver to be void * with library unload driver cleanup

- Changed Global Driver to be a void * to avoid auto add of Global
Driver Destructor to run before destruction of other L0 data structures
that might be enqueued to destory in static object destructors.
- Added register of library unload driverdestructor to cleanup
driver/device as the last destructor run.

Change-Id: I8ba6c5c27424b942a86a2613edd52fc682ab1c64
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
This commit is contained in:
Spruit, Neil R
2020-04-11 09:52:49 +00:00
committed by sys_ocldev
parent a9c2840770
commit e1d9f92b94
14 changed files with 63 additions and 7 deletions

View File

@@ -169,7 +169,7 @@ void MetricContext::enableMetricApi(ze_result_t &result) {
return;
}
DriverHandle *driverHandle = L0::DriverHandle::fromHandle(GlobalDriver.get());
DriverHandle *driverHandle = L0::DriverHandle::fromHandle(GlobalDriverHandle);
uint32_t count = 0;
result = driverHandle->getDevice(&count, nullptr);

View File

@@ -24,7 +24,7 @@ void SysmanHandleContext::init(ze_init_flag_t flag) {
}
SysmanHandleContext::SysmanHandleContext() {
DriverHandle *dH = L0::DriverHandle::fromHandle(GlobalDriver.get());
DriverHandle *dH = L0::DriverHandle::fromHandle(GlobalDriverHandle);
uint32_t count = 0;
dH->getDevice(&count, nullptr);
std::vector<ze_device_handle_t> devices(count);