diff --git a/opencl/source/cl_device/cl_device.cpp b/opencl/source/cl_device/cl_device.cpp index ae4205a271..d06ad7d24d 100644 --- a/opencl/source/cl_device/cl_device.cpp +++ b/opencl/source/cl_device/cl_device.cpp @@ -287,5 +287,11 @@ const ProductHelper &ClDevice::getProductHelper() const { const GTPinGfxCoreHelper &ClDevice::getGTPinGfxCoreHelper() const { return *gtpinGfxCoreHelper; } +cl_version ClDevice::getExtensionVersion(std::string name) { + if (name.compare("cl_khr_integer_dot_product") == 0) + return CL_MAKE_VERSION(2u, 0, 0); + else + return CL_MAKE_VERSION(1u, 0, 0); +} } // namespace NEO diff --git a/opencl/source/cl_device/cl_device.h b/opencl/source/cl_device/cl_device.h index 4f60ca6334..24252a78f4 100644 --- a/opencl/source/cl_device/cl_device.h +++ b/opencl/source/cl_device/cl_device.h @@ -136,6 +136,7 @@ class ClDevice : public BaseObject<_cl_device_id> { const GTPinGfxCoreHelper &getGTPinGfxCoreHelper() const; std::unique_ptr gtpinGfxCoreHelper; + cl_version getExtensionVersion(std::string name); protected: void initializeCaps(); diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index c7c5f2a6d6..bcf739b516 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -405,6 +405,22 @@ void ClDevice::initializeCaps() { deviceInfo.crossDeviceSharedMemCapabilities = productHelper.getCrossDeviceSharedMemCapabilities(); deviceInfo.sharedSystemMemCapabilities = productHelper.getSharedSystemMemCapabilities(&hwInfo); + deviceInfo.integerDotCapabilities = CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR | CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR; + deviceInfo.integerDotAccelerationProperties8Bit = { + CL_TRUE, // signed_accelerated; + CL_TRUE, // unsigned_accelerated; + CL_TRUE, // mixed_signedness_accelerated; + CL_TRUE, // accumulating_saturating_signed_accelerated; + CL_TRUE, // accumulating_saturating_unsigned_accelerated; + CL_TRUE}; // accumulating_saturating_mixed_signedness_accelerated; + deviceInfo.integerDotAccelerationProperties4x8BitPacked = { + CL_TRUE, // signed_accelerated; + CL_TRUE, // unsigned_accelerated; + CL_TRUE, // mixed_signedness_accelerated; + CL_TRUE, // accumulating_saturating_signed_accelerated; + CL_TRUE, // accumulating_saturating_unsigned_accelerated; + CL_TRUE}; // accumulating_saturating_mixed_signedness_accelerated; + initializeOsSpecificCaps(); getOpenclCFeaturesList(hwInfo, deviceInfo.openclCFeatures); } @@ -416,7 +432,7 @@ void ClDevice::initializeExtensionsWithVersion() { deviceInfo.extensionsWithVersion.reserve(deviceExtensionsVector.size()); for (auto deviceExtension : deviceExtensionsVector) { cl_name_version deviceExtensionWithVersion; - deviceExtensionWithVersion.version = CL_MAKE_VERSION(1, 0, 0); + deviceExtensionWithVersion.version = getExtensionVersion(deviceExtension); strcpy_s(deviceExtensionWithVersion.name, CL_NAME_VERSION_MAX_NAME_SIZE, deviceExtension.c_str()); deviceInfo.extensionsWithVersion.push_back(deviceExtensionWithVersion); } diff --git a/opencl/source/cl_device/cl_device_info.cpp b/opencl/source/cl_device/cl_device_info.cpp index 1f8e3fa94b..3e53326489 100644 --- a/opencl/source/cl_device/cl_device_info.cpp +++ b/opencl/source/cl_device/cl_device_info.cpp @@ -180,6 +180,9 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName, case CL_DEVICE_VENDOR_ID: getCap(src, srcSize, retSize); break; case CL_DEVICE_VERSION: getStr(src, srcSize, retSize); break; case CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT: getCap(src, srcSize, retSize); break; + case CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR: getCap(src, srcSize, retSize); break; + case CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR: getCap(src, srcSize, retSize); break; + case CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR: getCap(src, srcSize, retSize); break; case CL_DRIVER_VERSION: getStr(src, srcSize, retSize); break; // clang-format on case CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES: if (paramValueSize == sizeof(cl_bool)) { diff --git a/opencl/source/cl_device/cl_device_info.h b/opencl/source/cl_device/cl_device_info.h index 0ada443123..124a6f1fc2 100644 --- a/opencl/source/cl_device/cl_device_info.h +++ b/opencl/source/cl_device/cl_device_info.h @@ -142,6 +142,9 @@ struct ClDeviceInfo { cl_unified_shared_memory_capabilities_intel crossDeviceSharedMemCapabilities; cl_unified_shared_memory_capabilities_intel sharedSystemMemCapabilities; StackVec supportedThreadArbitrationPolicies; + cl_device_integer_dot_product_capabilities_khr integerDotCapabilities; + cl_device_integer_dot_product_acceleration_properties_khr integerDotAccelerationProperties8Bit; + cl_device_integer_dot_product_acceleration_properties_khr integerDotAccelerationProperties4x8BitPacked; }; // clang-format on diff --git a/opencl/source/cl_device/cl_device_info_map.h b/opencl/source/cl_device/cl_device_info_map.h index 36c6b3301f..c36624da06 100644 --- a/opencl/source/cl_device/cl_device_info_map.h +++ b/opencl/source/cl_device/cl_device_info_map.h @@ -77,7 +77,6 @@ template<> struct Map : public MapBa template<> struct Map : public MapBase {}; template<> struct Map : public MapBase {}; template<> struct Map : public MapBase {}; - template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; @@ -175,6 +174,10 @@ template<> struct Map : template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; template<> struct Map : public ClMapBase {}; +template<> struct Map : public ClMapBase {}; +template<> struct Map : public ClMapBase {}; +template<> struct Map : public ClMapBase {}; + // clang-format on } // namespace ClDeviceInfoTable diff --git a/opencl/test/unit_test/api/cl_get_device_info_tests.inl b/opencl/test/unit_test/api/cl_get_device_info_tests.inl index 0fb6038c73..0739899189 100644 --- a/opencl/test/unit_test/api/cl_get_device_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_device_info_tests.inl @@ -283,7 +283,8 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh "cl_khr_subgroup_clustered_reduce ", "cl_intel_device_attribute_query ", "cl_khr_suggested_local_work_size ", - "cl_intel_split_work_group_barrier "}; + "cl_intel_split_work_group_barrier ", + "cl_khr_integer_dot_product "}; for (auto extension : supportedExtensions) { auto foundOffset = extensionString.find(extension); @@ -454,4 +455,52 @@ INSTANTIATE_TEST_CASE_P( GetDeviceInfoVectorWidth, testing::ValuesIn(devicePreferredVector)); +TEST_F(clGetDeviceInfoTests, givenClDeviceWhenGetInfoForIntegerDotCapsThenCorrectValuesAreSet) { + size_t paramRetSize = 0; + cl_device_integer_dot_product_capabilities_khr integerDotCapabilities{}; + + clGetDeviceInfo( + testedClDevice, + CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR, + sizeof(integerDotCapabilities), + &integerDotCapabilities, + ¶mRetSize); + EXPECT_TRUE((integerDotCapabilities & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR) && (integerDotCapabilities & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR)); +} + +TEST_F(clGetDeviceInfoTests, givenClDeviceWhenGetInfoForIntegerDot8BitPropertiesThenCorrectValuesAreSet) { + size_t paramRetSize = 0; + cl_device_integer_dot_product_acceleration_properties_khr integerDotAccelerationProperties8Bit{}; + + clGetDeviceInfo( + testedClDevice, + CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR, + sizeof(integerDotAccelerationProperties8Bit), + &integerDotAccelerationProperties8Bit, + ¶mRetSize); + EXPECT_TRUE(integerDotAccelerationProperties8Bit.accumulating_saturating_mixed_signedness_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8Bit.accumulating_saturating_signed_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8Bit.accumulating_saturating_unsigned_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8Bit.mixed_signedness_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8Bit.signed_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8Bit.unsigned_accelerated); +} + +TEST_F(clGetDeviceInfoTests, givenClDeviceWhenGetInfoForIntegerDot8BitPackedPropertiesThenCorrectValuesAreSet) { + size_t paramRetSize = 0; + cl_device_integer_dot_product_acceleration_properties_khr integerDotAccelerationProperties8BitPacked{}; + + clGetDeviceInfo( + testedClDevice, + CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR, + sizeof(integerDotAccelerationProperties8BitPacked), + &integerDotAccelerationProperties8BitPacked, + ¶mRetSize); + EXPECT_TRUE(integerDotAccelerationProperties8BitPacked.accumulating_saturating_mixed_signedness_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8BitPacked.accumulating_saturating_signed_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8BitPacked.accumulating_saturating_unsigned_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8BitPacked.mixed_signedness_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8BitPacked.signed_accelerated); + EXPECT_TRUE(integerDotAccelerationProperties8BitPacked.unsigned_accelerated); +} } // namespace ULT diff --git a/opencl/test/unit_test/api/cl_get_platform_info_tests.inl b/opencl/test/unit_test/api/cl_get_platform_info_tests.inl index 9c26cdb56c..741ceb2b07 100644 --- a/opencl/test/unit_test/api/cl_get_platform_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_platform_info_tests.inl @@ -204,7 +204,11 @@ TEST_F(clGetPlatformInfoTests, WhenCheckingPlatformExtensionsWithVersionThenThey std::string allExtensions; for (size_t i = 0; i < extensionsCount; i++) { - EXPECT_EQ(CL_MAKE_VERSION(1u, 0u, 0u), platformExtensionsWithVersion[i].version); + if (strcmp(platformExtensionsWithVersion[i].name, "cl_khr_integer_dot_product") == 0) { + EXPECT_EQ(CL_MAKE_VERSION(2u, 0, 0), platformExtensionsWithVersion[i].version); + } else { + EXPECT_EQ(CL_MAKE_VERSION(1u, 0, 0), platformExtensionsWithVersion[i].version); + } allExtensions += platformExtensionsWithVersion[i].name; allExtensions += " "; } diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 9bcea11109..fa88441e72 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -965,7 +965,11 @@ TEST_F(DeviceGetCapsTest, givenDefaultDeviceWhenQueriedForExtensionsWithVersionT EXPECT_FALSE(pClDevice->getDeviceInfo().extensionsWithVersion.empty()); for (auto extensionWithVersion : pClDevice->getDeviceInfo().extensionsWithVersion) { - EXPECT_EQ(CL_MAKE_VERSION(1u, 0u, 0u), extensionWithVersion.version); + if (strcmp(extensionWithVersion.name, "cl_khr_integer_dot_product") == 0) { + EXPECT_EQ(CL_MAKE_VERSION(2u, 0, 0), extensionWithVersion.version); + } else { + EXPECT_EQ(CL_MAKE_VERSION(1u, 0, 0), extensionWithVersion.version); + } allExtensions += extensionWithVersion.name; allExtensions += " "; } @@ -973,6 +977,69 @@ TEST_F(DeviceGetCapsTest, givenDefaultDeviceWhenQueriedForExtensionsWithVersionT EXPECT_STREQ(pClDevice->deviceExtensions.c_str(), allExtensions.c_str()); } +TEST_F(DeviceGetCapsTest, givenClDeviceWhenGetExtensionsVersionCalledThenCorrectVersionIsSet) { + UltClDeviceFactory deviceFactory{1, 0}; + auto pClDevice = deviceFactory.rootDevices[0]; + pClDevice->getDeviceInfo(CL_DEVICE_EXTENSIONS_WITH_VERSION, 0, nullptr, nullptr); + for (auto extensionWithVersion : pClDevice->getDeviceInfo().extensionsWithVersion) { + if (strcmp(extensionWithVersion.name, "cl_khr_integer_dot_product") == 0) { + EXPECT_EQ(CL_MAKE_VERSION(2u, 0, 0), pClDevice->getExtensionVersion(std::string(extensionWithVersion.name))); + } else { + EXPECT_EQ(CL_MAKE_VERSION(1u, 0, 0), pClDevice->getExtensionVersion(std::string(extensionWithVersion.name))); + } + } +} + +TEST_F(DeviceGetCapsTest, givenClDeviceWhenCapsInitializedThenIntegerDotInput4xBitCapIsSet) { + UltClDeviceFactory deviceFactory{1, 0}; + auto pClDevice = deviceFactory.rootDevices[0]; + pClDevice->initializeCaps(); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotCapabilities & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR); +} + +TEST_F(DeviceGetCapsTest, givenClDeviceWhenCapsInitializedThenIntegerDotInput4xBitPackedCapIsSet) { + UltClDeviceFactory deviceFactory{1, 0}; + auto pClDevice = deviceFactory.rootDevices[0]; + pClDevice->initializeCaps(); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotCapabilities & CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR); +} + +TEST_F(DeviceGetCapsTest, givenClDeviceWhenCapsInitializedThenAllFieldsInIntegerDotAccPropertiesAreTrue) { + UltClDeviceFactory deviceFactory{1, 0}; + auto pClDevice = deviceFactory.rootDevices[0]; + pClDevice->initializeCaps(); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties8Bit.accumulating_saturating_mixed_signedness_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties8Bit.accumulating_saturating_signed_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties8Bit.accumulating_saturating_unsigned_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties8Bit.mixed_signedness_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties8Bit.signed_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties8Bit.unsigned_accelerated); +} + +TEST_F(DeviceGetCapsTest, givenClDeviceWhenCapsInitializedThenAllFieldsInIntegerDotAccPackedPropertiesAreTrue) { + UltClDeviceFactory deviceFactory{1, 0}; + auto pClDevice = deviceFactory.rootDevices[0]; + pClDevice->initializeCaps(); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties4x8BitPacked.accumulating_saturating_mixed_signedness_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties4x8BitPacked.accumulating_saturating_signed_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties4x8BitPacked.accumulating_saturating_unsigned_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties4x8BitPacked.mixed_signedness_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties4x8BitPacked.signed_accelerated); + EXPECT_TRUE(pClDevice->deviceInfo.integerDotAccelerationProperties4x8BitPacked.unsigned_accelerated); +} + +TEST_F(DeviceGetCapsTest, givenClDeviceWhenEnableIntegerDotExtensionEnalbedThenDotIntegerExtensionIsInExtensionString) { + UltClDeviceFactory deviceFactory{1, 0}; + auto pClDevice = deviceFactory.rootDevices[0]; + pClDevice->initializeCaps(); + static const char *const supportedExtensions[] = { + "cl_khr_integer_dot_product "}; + for (auto extension : supportedExtensions) { + auto foundOffset = pClDevice->deviceExtensions.find(extension); + EXPECT_TRUE(foundOffset != std::string::npos); + } +} + TEST_F(DeviceGetCapsTest, givenFp64SupportForcedWhenCheckingFp64SupportThenFp64IsCorrectlyReported) { DebugManagerStateRestore dbgRestorer; int32_t overrideDefaultFP64SettingsValues[] = {-1, 0, 1}; diff --git a/shared/source/helpers/compiler_product_helper_base.inl b/shared/source/helpers/compiler_product_helper_base.inl index c63039c363..cadbb2dfbc 100644 --- a/shared/source/helpers/compiler_product_helper_base.inl +++ b/shared/source/helpers/compiler_product_helper_base.inl @@ -66,7 +66,8 @@ std::string CompilerProductHelperHw::getDeviceExtensions(const Hardw "cl_khr_subgroup_clustered_reduce " "cl_intel_device_attribute_query " "cl_khr_suggested_local_work_size " - "cl_intel_split_work_group_barrier "; + "cl_intel_split_work_group_barrier " + "cl_khr_integer_dot_product "; auto supportsFp64 = hwInfo.capabilityTable.ftrSupportsFP64; if (DebugManager.flags.OverrideDefaultFP64Settings.get() != -1) {