fix: Add missing fp64 extensions in caps initialization
In a scenario where fp64 emulation is both supported and enabled, we want to include 2 additional extensions: - cl_khr_fp64 to deviceExtensions - __opencl_c_fp64 to openclCFeatures (OpenCL ver. 3.0) Related-To: NEO-7611 Signed-off-by: Oskar Hubert Weber <oskar.hubert.weber@intel.com>
This commit is contained in:
parent
75cb7f85d2
commit
9a486dd5a1
|
@ -65,6 +65,7 @@ void ClDevice::setupFp64Flags() {
|
||||||
deviceInfo.doubleFpConfig = defaultFpFlags | CL_FP_SOFT_FLOAT;
|
deviceInfo.doubleFpConfig = defaultFpFlags | CL_FP_SOFT_FLOAT;
|
||||||
deviceInfo.nativeVectorWidthDouble = 1;
|
deviceInfo.nativeVectorWidthDouble = 1;
|
||||||
deviceInfo.preferredVectorWidthDouble = 1;
|
deviceInfo.preferredVectorWidthDouble = 1;
|
||||||
|
deviceExtensions += "cl_khr_fp64 ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
deviceInfo.doubleFpConfig = 0;
|
deviceInfo.doubleFpConfig = 0;
|
||||||
|
@ -430,6 +431,13 @@ void ClDevice::initializeCaps() {
|
||||||
|
|
||||||
initializeOsSpecificCaps();
|
initializeOsSpecificCaps();
|
||||||
getOpenclCFeaturesList(hwInfo, deviceInfo.openclCFeatures, getDevice().getCompilerProductHelper(), releaseHelper);
|
getOpenclCFeaturesList(hwInfo, deviceInfo.openclCFeatures, getDevice().getCompilerProductHelper(), releaseHelper);
|
||||||
|
if (hwInfo.capabilityTable.ftrSupportsFP64Emulation &&
|
||||||
|
getDevice().getExecutionEnvironment()->isFP64EmulationEnabled()) {
|
||||||
|
cl_name_version openClCFeature;
|
||||||
|
openClCFeature.version = CL_MAKE_VERSION(3, 0, 0);
|
||||||
|
strcpy_s(openClCFeature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "__opencl_c_fp64");
|
||||||
|
deviceInfo.openclCFeatures.push_back(openClCFeature);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClDevice::initializeExtensionsWithVersion() {
|
void ClDevice::initializeExtensionsWithVersion() {
|
||||||
|
|
|
@ -126,6 +126,11 @@ struct DeviceGetCapsTest : public ::testing::Test {
|
||||||
EXPECT_STREQ("__opencl_c_integer_dot_product_input_4x8bit_packed", (++openclCFeatureIterator)->name);
|
EXPECT_STREQ("__opencl_c_integer_dot_product_input_4x8bit_packed", (++openclCFeatureIterator)->name);
|
||||||
}
|
}
|
||||||
verifyAnyRemainingOpenclCFeatures(releaseHelper, openclCFeatureIterator);
|
verifyAnyRemainingOpenclCFeatures(releaseHelper, openclCFeatureIterator);
|
||||||
|
if (hwInfo.capabilityTable.ftrSupportsFP64Emulation &&
|
||||||
|
clDevice.getDevice().getExecutionEnvironment()->isFP64EmulationEnabled()) {
|
||||||
|
EXPECT_STREQ("__opencl_c_fp64", (++openclCFeatureIterator)->name);
|
||||||
|
}
|
||||||
|
|
||||||
EXPECT_EQ(clDevice.getDeviceInfo().openclCFeatures.end(), ++openclCFeatureIterator);
|
EXPECT_EQ(clDevice.getDeviceInfo().openclCFeatures.end(), ++openclCFeatureIterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,6 +350,38 @@ TEST_F(DeviceGetCapsTest, givenForceOclVersion12WhenCapsAreCreatedThenDeviceRepo
|
||||||
verifyOpenclCFeatures(*device);
|
verifyOpenclCFeatures(*device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DeviceGetCapsTest, givenForceOclVersion30AndFp64EmulationSupportedAndEnabledWhenCapsAreCreatedThenClKhrFp64AndOpenClCFp64ExtensionsAreReported) {
|
||||||
|
DebugManagerStateRestore dbgRestorer;
|
||||||
|
debugManager.flags.ForceOCLVersion.set(30);
|
||||||
|
|
||||||
|
HardwareInfo hwInfo = *defaultHwInfo;
|
||||||
|
hwInfo.capabilityTable.ftrSupportsFP64 = false;
|
||||||
|
hwInfo.capabilityTable.ftrSupportsFP64Emulation = true;
|
||||||
|
|
||||||
|
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
|
||||||
|
executionEnvironment->setFP64EmulationEnabled();
|
||||||
|
|
||||||
|
auto device = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0u));
|
||||||
|
const auto &caps = device->getDeviceInfo();
|
||||||
|
|
||||||
|
EXPECT_STREQ("OpenCL 3.0 NEO ", caps.clVersion);
|
||||||
|
EXPECT_STREQ("OpenCL C 1.2 ", caps.clCVersion);
|
||||||
|
EXPECT_EQ(CL_MAKE_VERSION(3u, 0u, 0u), caps.numericClVersion);
|
||||||
|
EXPECT_FALSE(device->ocl21FeaturesEnabled);
|
||||||
|
verifyOpenclCFeatures(*device);
|
||||||
|
|
||||||
|
bool openclCFp64Found = false;
|
||||||
|
for (auto &openclCFeature : device->getDeviceInfo().openclCFeatures) {
|
||||||
|
if (0 == strcmp("__opencl_c_fp64", openclCFeature.name)) {
|
||||||
|
openclCFp64Found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_TRUE(openclCFp64Found);
|
||||||
|
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_khr_fp64")));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DeviceGetCapsTest, givenForceOCL21FeaturesSupportEnabledWhenCapsAreCreatedThenDeviceReportsSupportOfOcl21Features) {
|
TEST_F(DeviceGetCapsTest, givenForceOCL21FeaturesSupportEnabledWhenCapsAreCreatedThenDeviceReportsSupportOfOcl21Features) {
|
||||||
DebugManagerStateRestore dbgRestorer;
|
DebugManagerStateRestore dbgRestorer;
|
||||||
debugManager.flags.ForceOCLVersion.set(12);
|
debugManager.flags.ForceOCLVersion.set(12);
|
||||||
|
@ -1167,7 +1204,7 @@ TEST_F(DeviceGetCapsTest, givenFp64EmulationSupportWithFp64EmulationEnvVarSetWhe
|
||||||
auto &caps = pClDevice->getDeviceInfo();
|
auto &caps = pClDevice->getDeviceInfo();
|
||||||
std::string extensionString = pClDevice->getDeviceInfo().deviceExtensions;
|
std::string extensionString = pClDevice->getDeviceInfo().deviceExtensions;
|
||||||
|
|
||||||
EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
||||||
EXPECT_TRUE(isValueSet(caps.doubleFpConfig, CL_FP_SOFT_FLOAT));
|
EXPECT_TRUE(isValueSet(caps.doubleFpConfig, CL_FP_SOFT_FLOAT));
|
||||||
|
|
||||||
cl_device_fp_config defaultFpFlags = static_cast<cl_device_fp_config>(CL_FP_ROUND_TO_NEAREST |
|
cl_device_fp_config defaultFpFlags = static_cast<cl_device_fp_config>(CL_FP_ROUND_TO_NEAREST |
|
||||||
|
|
Loading…
Reference in New Issue