Return 0 when Program Scope Global Variables are not supported

clGetDeviceInfo and clGetProgramBuildInfo may return 0 when Program
Scope Global Variables are not supported

Related-To: NEO-4368

Change-Id: I2c319c53ffa2e02eeb370775023f5d73219cb39e
Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:
Andrzej Swierczynski
2020-04-10 14:45:04 +02:00
committed by sys_ocldev
parent 853d870d1c
commit 42810f4690
5 changed files with 51 additions and 7 deletions

View File

@@ -478,6 +478,38 @@ TEST(GetDeviceInfo, GivenSimultaneousInteropsWhenGettingDeviceInfoThenCorrectVal
EXPECT_TRUE(memcmp(value, &device->simultaneousInterops[0], 4u * sizeof(cl_uint)) == 0);
}
TEST(GetDeviceInfo, GivenMaxGlobalVariableSizeWhenGettingDeviceInfoThenCorrectValueIsReturned) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
size_t value = 0;
size_t size = 0;
auto retVal = device->getDeviceInfo(CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE, sizeof(size_t), &value, &size);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(size_t), size);
if (device->getEnabledClVersion() >= 20) {
EXPECT_EQ(value, 65536u);
} else {
EXPECT_EQ(value, 0u);
}
}
TEST(GetDeviceInfo, GivenGlobalVariablePreferredTotalSizeWhenGettingDeviceInfoThenCorrectValueIsReturned) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
size_t value = 0;
size_t size = 0;
auto retVal = device->getDeviceInfo(CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE, sizeof(size_t), &value, &size);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(sizeof(size_t), size);
if (device->getEnabledClVersion() >= 20) {
EXPECT_EQ(value, static_cast<size_t>(device->getSharedDeviceInfo().maxMemAllocSize));
} else {
EXPECT_EQ(value, 0u);
}
}
TEST(GetDeviceInfo, GivenPreferredInteropsWhenGettingDeviceInfoThenCorrectValueIsReturned) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));