mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Respect EnableMultiRootDeviceContexts when creating context from type
Related-To: NEO-3691 Change-Id: Ib61ddfe1e5df5ed7611ed785fadd305a49ef204a Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
2eea76e086
commit
3bcc073b26
@ -100,4 +100,51 @@ TEST_F(clCreateContextFromTypeTests, GivenNonDefaultPlatformWithInvalidIcdDispat
|
||||
EXPECT_EQ(nullptr, clContext);
|
||||
}
|
||||
|
||||
TEST(clCreateContextFromTypeTest, GivenPlatformWithMultipleDevicesAndMultiRootDeviceContextsAreEnabledWhenCreatingContextFromTypeThenContextContainsAllDevices) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(2);
|
||||
DebugManager.flags.EnableMultiRootDeviceContexts.set(true);
|
||||
|
||||
initPlatform();
|
||||
|
||||
cl_int retVal = CL_INVALID_CONTEXT;
|
||||
|
||||
auto context =
|
||||
clCreateContextFromType(nullptr, CL_DEVICE_TYPE_GPU, nullptr, nullptr, &retVal);
|
||||
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, context);
|
||||
|
||||
auto pContext = castToObject<Context>(context);
|
||||
EXPECT_EQ(2u, pContext->getNumDevices());
|
||||
EXPECT_EQ(platform()->getClDevice(0), pContext->getDevice(0));
|
||||
EXPECT_EQ(platform()->getClDevice(1), pContext->getDevice(1));
|
||||
|
||||
retVal = clReleaseContext(context);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST(clCreateContextFromTypeTest, GivenPlatformWithMultipleDevicesAndMultiRootDeviceContextsAreDisabledWhenCreatingContextFromTypeThenContextContainsOnlyOneDevice) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(2);
|
||||
DebugManager.flags.EnableMultiRootDeviceContexts.set(false);
|
||||
|
||||
initPlatform();
|
||||
|
||||
cl_int retVal = CL_INVALID_CONTEXT;
|
||||
|
||||
auto context =
|
||||
clCreateContextFromType(nullptr, CL_DEVICE_TYPE_GPU, nullptr, nullptr, &retVal);
|
||||
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, context);
|
||||
|
||||
auto pContext = castToObject<Context>(context);
|
||||
EXPECT_EQ(1u, pContext->getNumDevices());
|
||||
EXPECT_EQ(platform()->getClDevice(0), pContext->getDevice(0));
|
||||
|
||||
retVal = clReleaseContext(context);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
} // namespace ULT
|
||||
|
Reference in New Issue
Block a user