Fail given WDDM Driver and Fd Handle in WSL

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
This commit is contained in:
Spruit, Neil R
2022-01-31 20:24:18 +00:00
committed by Compute-Runtime-Automation
parent bea54b9fb8
commit 593756bee0
4 changed files with 56 additions and 6 deletions

View File

@@ -25,11 +25,18 @@ bool ContextImp::isShareableMemory(const void *exportDesc, bool exportableMemory
void *ContextImp::getMemHandlePtr(ze_device_handle_t hDevice, uint64_t handle, ze_ipc_memory_flags_t flags) {
L0::Device *device = L0::Device::fromHandle(hDevice);
auto neoDevice = device->getNEODevice();
NEO::DriverModelType driverType = NEO::DriverModelType::UNKNOWN;
if (neoDevice->getRootDeviceEnvironment().osInterface) {
driverType = neoDevice->getRootDeviceEnvironment().osInterface->getDriverModel()->getDriverModelType();
}
bool isNTHandle = this->getDriverHandle()->getMemoryManager()->isNTHandle(NEO::toOsHandle(reinterpret_cast<void *>(handle)), device->getNEODevice()->getRootDeviceIndex());
if (isNTHandle) {
return this->driverHandle->importNTHandle(hDevice, reinterpret_cast<void *>(handle));
} else {
} else if (driverType == NEO::DriverModelType::DRM) {
return this->driverHandle->importFdHandle(hDevice, flags, handle, nullptr);
} else {
return nullptr;
}
}