diff --git a/opencl/source/cl_device/CMakeLists.txt b/opencl/source/cl_device/CMakeLists.txt index 069a911f03..0e9430b98e 100644 --- a/opencl/source/cl_device/CMakeLists.txt +++ b/opencl/source/cl_device/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2020-2021 Intel Corporation +# Copyright (C) 2020-2024 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -14,6 +14,7 @@ set(RUNTIME_SRCS_CL_DEVICE ${CMAKE_CURRENT_SOURCE_DIR}/cl_device_info.h ${CMAKE_CURRENT_SOURCE_DIR}/cl_device_info_map.h ${CMAKE_CURRENT_SOURCE_DIR}/cl_device_vector.h + ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}cl_device_info_extra.cpp ) target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_CL_DEVICE}) set_property(GLOBAL PROPERTY RUNTIME_SRCS_CL_DEVICE ${RUNTIME_SRCS_CL_DEVICE}) diff --git a/opencl/source/cl_device/cl_device.h b/opencl/source/cl_device/cl_device.h index 5c6b26f012..70ce9e5397 100644 --- a/opencl/source/cl_device/cl_device.h +++ b/opencl/source/cl_device/cl_device.h @@ -101,6 +101,11 @@ class ClDevice : public BaseObject<_cl_device_id> { const void *&src, size_t &srcSize, size_t &retSize); + bool getDeviceInfoExtra(cl_device_info paramName, + ClDeviceInfoParam ¶m, + const void *&src, + size_t &srcSize, + size_t &retSize); // This helper template is meant to simplify getDeviceInfo template diff --git a/opencl/source/cl_device/cl_device_info.cpp b/opencl/source/cl_device/cl_device_info.cpp index afff4db07c..7b11cd4d89 100644 --- a/opencl/source/cl_device/cl_device_info.cpp +++ b/opencl/source/cl_device/cl_device_info.cpp @@ -357,10 +357,14 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName, retSize = srcSize = (getSharedDeviceInfo().threadsPerEUConfigs.size() * sizeof(uint32_t)); break; default: - if (getDeviceInfoForImage(paramName, src, srcSize, retSize) && !getSharedDeviceInfo().imageSupport) { - src = &value; + if (getDeviceInfoForImage(paramName, src, srcSize, retSize)) { + if (false == getSharedDeviceInfo().imageSupport) { + src = &value; + } + } else if (getDeviceInfoExtra(paramName, param, src, srcSize, retSize)) { break; } + break; } auto getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, src, srcSize); diff --git a/opencl/source/cl_device/cl_device_info_extra.cpp b/opencl/source/cl_device/cl_device_info_extra.cpp new file mode 100644 index 0000000000..70e7d214c0 --- /dev/null +++ b/opencl/source/cl_device/cl_device_info_extra.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2024 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "opencl/source/cl_device/cl_device.h" +#include "opencl/source/cl_device/cl_device_info.h" + +namespace NEO { +bool ClDevice::getDeviceInfoExtra(cl_device_info paramName, + ClDeviceInfoParam ¶m, + const void *&src, + size_t &srcSize, + size_t &retSize) { + return false; +} +}; // namespace NEO \ No newline at end of file diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index fe88be637e..b6687e18ee 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -83,6 +83,7 @@ class ProductHelper { virtual void getKernelFp16AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp16) const = 0; virtual void getKernelFp32AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp32) const = 0; virtual void getKernelFp64AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp64) const = 0; + virtual void getKernelCapabilitiesExtra(uint32_t &extraCaps) const = 0; virtual void getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const = 0; virtual std::vector getKernelSupportedThreadArbitrationPolicies() const = 0; virtual uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index e1465cd17a..d1b1b26105 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -52,6 +52,10 @@ void ProductHelperHw::getKernelFp64AtomicCapabilities(const Hardware fp64 = (0u | FpAtomicExtFlags::minMaxAtomicCaps | FpAtomicExtFlags::loadStoreAtomicCaps | FpAtomicExtFlags::addAtomicCaps); } +template +void ProductHelperHw::getKernelCapabilitiesExtra(uint32_t &extraCaps) const { +} + template void ProductHelperHw::getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const { getKernelFp16AtomicCapabilities(hwInfo, fp16); diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index fb162f7b61..5244a1acdb 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -30,6 +30,7 @@ class ProductHelperHw : public ProductHelper { void getKernelFp16AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp16) const override; void getKernelFp32AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp32) const override; void getKernelFp64AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp64) const override; + void getKernelCapabilitiesExtra(uint32_t &extraCaps) const override; void getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const override; std::vector getKernelSupportedThreadArbitrationPolicies() const override; uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const override; diff --git a/shared/test/common/helpers/mock_product_helper_hw.h b/shared/test/common/helpers/mock_product_helper_hw.h index 21ec0ba067..24a4b7bc92 100644 --- a/shared/test/common/helpers/mock_product_helper_hw.h +++ b/shared/test/common/helpers/mock_product_helper_hw.h @@ -26,6 +26,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw { bool isUnlockingLockedPtrNecessary(const HardwareInfo &hwInfo) const override; std::vector getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const override; aub_stream::EngineType getDefaultCopyEngine() const override; + void getKernelCapabilitiesExtra(uint32_t &extraCaps) const override; bool use128MbEdram = false; bool enableMidThreadPreemption = false; @@ -37,6 +38,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw { uint32_t returnedStepping = 0; uint32_t returnedL1CachePolicy = 0; uint32_t returnedL1CachePolicyIfDebugger = 0; + uint32_t returnedExtraKernelCapabilities = 0; std::vector threadArbPolicies = {}; aub_stream::EngineType mockDefaultCopyEngine = aub_stream::EngineType::ENGINE_BCS; }; diff --git a/shared/test/common/helpers/mock_product_helper_hw.inl b/shared/test/common/helpers/mock_product_helper_hw.inl index 6e31b480ee..b175233014 100644 --- a/shared/test/common/helpers/mock_product_helper_hw.inl +++ b/shared/test/common/helpers/mock_product_helper_hw.inl @@ -88,4 +88,9 @@ aub_stream::EngineType MockProductHelperHw::getDefaultCopyEngine() c return this->mockDefaultCopyEngine; } +template <> +void MockProductHelperHw::getKernelCapabilitiesExtra(uint32_t &extraCaps) const { + extraCaps = this->returnedExtraKernelCapabilities; +} + } // namespace NEO diff --git a/shared/test/unit_test/os_interface/product_helper_tests.cpp b/shared/test/unit_test/os_interface/product_helper_tests.cpp index c0bd8c83ed..79548ba13f 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -879,4 +879,10 @@ HWTEST_F(ProductHelperTest, whenGettingPreferredAllocationMethodThenNoPreference HWTEST_F(ProductHelperTest, whenAskingForLocalDispatchSizeThenReturnEmpty) { EXPECT_EQ(0u, productHelper->getSupportedLocalDispatchSizes().size()); +} + +HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingForExtraKerneCapabilitiesThenReturnNone) { + uint32_t extraKernelCapabilities = 0u; + productHelper->getKernelCapabilitiesExtra(extraKernelCapabilities); + EXPECT_EQ(0u, extraKernelCapabilities); } \ No newline at end of file