Add debug flag to override fp64 capabilities

Change-Id: I5078aaaeeb58b4821e7c9ae4b01e0a8261a5c8da
This commit is contained in:
Zdanowicz, Zbigniew
2018-06-05 15:39:17 +02:00
committed by sys_ocldev
parent a9566e0c05
commit e6a9d30951
5 changed files with 71 additions and 29 deletions

View File

@@ -583,6 +583,40 @@ TEST(Device_GetCaps, givenDeviceThatDoesntHaveFp64ThenExtensionIsNotReported) {
EXPECT_EQ(0u, caps.doubleFpConfig);
}
TEST(DeviceGetCaps, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnablesFp64ThenReportFp64Flags) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.OverrideDefaultFP64Settings.set(1);
HardwareInfo nonFp64Device = *platformDevices[0];
nonFp64Device.capabilityTable.ftrSupportsFP64 = false;
nonFp64Device.capabilityTable.ftrSupports64BitMath = false;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&nonFp64Device));
const auto &caps = device->getDeviceInfo();
std::string extensionString = caps.deviceExtensions;
EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
EXPECT_NE(0u, caps.doubleFpConfig);
cl_device_fp_config actualSingleFp = caps.singleFpConfig & static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
cl_device_fp_config expectedSingleFp = static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
EXPECT_EQ(expectedSingleFp, actualSingleFp);
}
TEST(DeviceGetCaps, givenDeviceThatDoesHaveFp64WhenDbgFlagDisablesFp64ThenDontReportFp64Flags) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.OverrideDefaultFP64Settings.set(0);
HardwareInfo fp64Device = *platformDevices[0];
fp64Device.capabilityTable.ftrSupportsFP64 = true;
fp64Device.capabilityTable.ftrSupports64BitMath = true;
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&fp64Device));
const auto &caps = device->getDeviceInfo();
std::string extensionString = caps.deviceExtensions;
EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
EXPECT_EQ(0u, caps.doubleFpConfig);
cl_device_fp_config actualSingleFp = caps.singleFpConfig & static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
cl_device_fp_config notExpectedSingleFp = static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
EXPECT_NE(notExpectedSingleFp, actualSingleFp);
}
TEST(Device_GetCaps, givenOclVersionLessThan21WhenCapsAreCreatedThenDeviceReportsNoSupportedIlVersions) {
DebugManagerStateRestore dbgRestorer;
{