Add method to get device bitfield from context

Related-To: NEO-4484
Change-Id: I5079c5bff48b552ed5326b2252bcd9401ea66c7d
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-04-28 11:33:39 +02:00
parent 08af6cad48
commit 159c804312
15 changed files with 52 additions and 23 deletions

View File

@@ -419,4 +419,23 @@ TEST(Context, givenContextWhenIsDeviceAssociatedIsCalledWithNotAssociatedDeviceT
MockContext context1;
EXPECT_FALSE(context0.isDeviceAssociated(*context1.getDevice(0)));
EXPECT_FALSE(context1.isDeviceAssociated(*context0.getDevice(0)));
}
TEST(Context, givenContextWithSingleDevicesWhenGettingDeviceBitfieldForAllocationThenDeviceBitfieldForDeviceIsReturned) {
UltClDeviceFactory deviceFactory{1, 3};
auto device = deviceFactory.subDevices[1];
auto expectedDeviceBitfield = device->getDeviceBitfield();
MockContext context(device);
EXPECT_EQ(expectedDeviceBitfield.to_ulong(), context.getDeviceBitfieldForAllocation().to_ulong());
}
TEST(Context, givenContextWithMultipleSubDevicesWhenGettingDeviceBitfieldForAllocationThenMergedDeviceBitfieldIsReturned) {
UltClDeviceFactory deviceFactory{1, 3};
cl_int retVal;
cl_device_id devices[]{deviceFactory.subDevices[0], deviceFactory.subDevices[2]};
ClDeviceVector deviceVector(devices, 2);
auto expectedDeviceBitfield = deviceFactory.subDevices[0]->getDeviceBitfield() | deviceFactory.subDevices[2]->getDeviceBitfield();
auto context = Context::create<Context>(0, deviceVector, nullptr, nullptr, retVal);
EXPECT_NE(nullptr, context);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(expectedDeviceBitfield.to_ulong(), context->getDeviceBitfieldForAllocation().to_ulong());
context->release();
}