Fix casts between Device, DeviceImp and device handle

Change-Id: Ib267239cd041aa812e7d4d7e5cda6daf5b4b6d2c
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-06-15 13:46:14 +02:00
committed by sys_ocldev
parent 0443b97927
commit 0d7d2c0be0
2 changed files with 3 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ void DeviceImp::setDriverHandle(DriverHandle *driverHandle) {
ze_result_t DeviceImp::canAccessPeer(ze_device_handle_t hPeerDevice, ze_bool_t *value) {
*value = false;
DeviceImp *pPeerDevice = reinterpret_cast<DeviceImp *>(Device::fromHandle(hPeerDevice));
DeviceImp *pPeerDevice = static_cast<DeviceImp *>(Device::fromHandle(hPeerDevice));
if (this->getNEODevice()->getRootDeviceIndex() == pPeerDevice->getNEODevice()->getRootDeviceIndex()) {
*value = true;
}
@@ -597,7 +597,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3
if (subDevice == nullptr) {
return nullptr;
}
reinterpret_cast<DeviceImp *>(subDevice)->isSubdevice = true;
static_cast<DeviceImp *>(subDevice)->isSubdevice = true;
device->subDevices.push_back(static_cast<Device *>(subDevice));
}
device->numSubDevices = static_cast<uint32_t>(device->subDevices.size());

View File

@@ -253,6 +253,7 @@ TEST_F(MultipleDevicesTest, whenRetrievingNumberOfSubdevicesThenCorrectNumberIsR
EXPECT_EQ(numSubDevices, count);
for (auto subDevice : subDevices) {
EXPECT_NE(nullptr, subDevice);
EXPECT_TRUE(static_cast<DeviceImp *>(subDevice)->isSubdevice);
}
}