mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
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:
@@ -218,7 +218,6 @@ TEST(clSvmAllocTest, givenSubDeviceWhenCreatingSvmAllocThenProperDeviceBitfieldI
|
||||
REQUIRE_SVM_OR_SKIP(defaultHwInfo.get());
|
||||
UltClDeviceFactory deviceFactory{1, 2};
|
||||
auto device = deviceFactory.subDevices[1];
|
||||
auto expectedDeviceBitfield = device->getDeviceBitfield();
|
||||
|
||||
auto executionEnvironment = device->getExecutionEnvironment();
|
||||
auto memoryManager = new MockMemoryManager(*executionEnvironment);
|
||||
@@ -227,6 +226,7 @@ TEST(clSvmAllocTest, givenSubDeviceWhenCreatingSvmAllocThenProperDeviceBitfieldI
|
||||
std::swap(memoryManagerBackup, executionEnvironment->memoryManager);
|
||||
|
||||
MockContext context(device);
|
||||
auto expectedDeviceBitfield = context.getDeviceBitfieldForAllocation();
|
||||
EXPECT_NE(expectedDeviceBitfield, memoryManager->recentlyPassedDeviceBitfield);
|
||||
auto svmPtr = clSVMAlloc(&context, CL_MEM_READ_WRITE, MemoryConstants::pageSize, MemoryConstants::cacheLineSize);
|
||||
EXPECT_NE(nullptr, svmPtr);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user