feature: introduce release helper

Related-To: NEO-7786
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-04-13 14:16:49 +00:00
committed by Compute-Runtime-Automation
parent 80f1e0e413
commit 171e97e71a
38 changed files with 342 additions and 52 deletions

View File

@@ -795,6 +795,7 @@ else()
endif()
include_directories(${NEO_SHARED_DIRECTORY}/helpers/definitions${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/memory_properties${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/release_helper/definitions${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/sku_info/definitions${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/xe_hpc_core${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/xe_hpg_core${BRANCH_DIR_SUFFIX})

View File

@@ -85,9 +85,10 @@ void ClDevice::initializeCaps() {
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
auto *releaseHelper = rootDeviceEnvironment.getReleaseHelper();
auto &sharedDeviceInfo = getSharedDeviceInfo();
deviceExtensions.clear();
deviceExtensions.append(compilerProductHelper.getDeviceExtensions(hwInfo));
deviceExtensions.append(compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper));
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);

View File

@@ -25,9 +25,10 @@ cl_ulong ClGfxCoreHelperHw<GfxFamily>::getKernelPrivateMemSize(const KernelInfo
template <typename GfxFamily>
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<GfxFamily>::getSupportedDeviceFeatureCapabilities(const RootDeviceEnvironment &rootDeviceEnvironment) const {
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
auto releaseHelper = rootDeviceEnvironment.getReleaseHelper();
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
if (compilerProductHelper.isMatrixMultiplyAccumulateSupported(hwInfo)) {
if (compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper)) {
return CL_DEVICE_FEATURE_FLAG_DPAS_INTEL | CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
}
return CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;

View File

@@ -50,6 +50,10 @@ const RootDeviceEnvironment &ClDeviceFixture::getRootDeviceEnvironment() const {
return pClDevice->getRootDeviceEnvironment();
}
RootDeviceEnvironment &ClDeviceFixture::getMutableRootDeviceEnvironment() {
return pClDevice->getDevice().getRootDeviceEnvironmentRef();
}
template <typename HelperType>
HelperType &ClDeviceFixture::getHelper() const {
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<HelperType>();

View File

@@ -36,6 +36,7 @@ struct ClDeviceFixture {
MockClExecutionEnvironment *pClExecutionEnvironment = nullptr;
const RootDeviceEnvironment &getRootDeviceEnvironment() const;
RootDeviceEnvironment &getMutableRootDeviceEnvironment();
};
} // namespace NEO

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/string.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/fixtures/mock_aub_center_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/gtest_helpers.h"
@@ -41,6 +42,7 @@ struct PlatformTest : public ::testing::Test {
pPlatform.reset(new MockPlatform());
compilerProductHelper = CompilerProductHelper::create(defaultHwInfo->platform.eProductFamily);
releaseHelper = ReleaseHelper::create(defaultHwInfo->ipVersion);
}
void TearDown() override {
MockSipData::clearUseFlags();
@@ -48,6 +50,7 @@ struct PlatformTest : public ::testing::Test {
std::unique_ptr<MockPlatform> pPlatform;
std::unique_ptr<VariableBackup<bool>> backupSipInitType;
std::unique_ptr<CompilerProductHelper> compilerProductHelper;
std::unique_ptr<ReleaseHelper> releaseHelper;
cl_int retVal = CL_SUCCESS;
};
@@ -262,7 +265,7 @@ class PlatformFailingTest : public PlatformTest {
VariableBackup<UltHwConfig> backup{&ultHwConfig};
CommandStreamReceiverCreateFunc commandStreamReceiverCreateFunc;
const HardwareInfo *hwInfo;
const HardwareInfo *hwInfo{};
};
TEST_F(PlatformFailingTest, givenPlatformInitializationWhenIncorrectHwInfoThenInitializationFails) {
@@ -276,7 +279,7 @@ TEST_F(PlatformFailingTest, givenPlatformInitializationWhenIncorrectHwInfoThenIn
TEST_F(PlatformTest, givenSupportingCl21WhenPlatformSupportsFp64ThenFillMatchingSubstringsAndMandatoryTrailingSpace) {
const HardwareInfo *hwInfo;
hwInfo = defaultHwInfo.get();
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*hwInfo, features, *compilerProductHelper.get());
@@ -315,7 +318,7 @@ TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFill
testHwInfo.capabilityTable.clVersionSupport = 10;
testHwInfo.capabilityTable.supportsOcl21Features = false;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(testHwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(testHwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
if (testHwInfo.capabilityTable.supportsImages) {
@@ -333,7 +336,7 @@ TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFill
TEST_F(PlatformTest, givenFtrSupportAtomicsWhenCreateExtentionsListThenGetMatchingSubstrings) {
const HardwareInfo *hwInfo;
hwInfo = defaultHwInfo.get();
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*hwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -352,7 +355,7 @@ TEST_F(PlatformTest, givenSupportedMediaBlockAndClVersion21WhenCreateExtentionsL
hwInfo.capabilityTable.supportsMediaBlock = true;
hwInfo.capabilityTable.clVersionSupport = 21;
hwInfo.capabilityTable.supportsOcl21Features = true;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -364,7 +367,7 @@ TEST_F(PlatformTest, givenNotSupportedMediaBlockAndClVersion21WhenCreateExtentio
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsMediaBlock = false;
hwInfo.capabilityTable.clVersionSupport = 21;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -375,7 +378,7 @@ TEST_F(PlatformTest, givenNotSupportedMediaBlockAndClVersion21WhenCreateExtentio
TEST_F(PlatformTest, givenSupportedImagesWhenCreateExtentionsListThenDeviceNotReportsKhr3DImageWritesExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = true;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -386,7 +389,7 @@ TEST_F(PlatformTest, givenSupportedImagesWhenCreateExtentionsListThenDeviceNotRe
TEST_F(PlatformTest, givenNotSupportedImagesWhenCreateExtentionsListThenDeviceNotReportsKhr3DImageWritesExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = false;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/variable_backup.h"
@@ -22,7 +23,7 @@ using ClGfxCoreHelperTestsMtl = Test<ClDeviceFixture>;
MTLTEST_F(ClGfxCoreHelperTestsMtl, givenVariousMtlReleasesWhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
auto &hwInfo = *getRootDeviceEnvironment().getMutableHardwareInfo();
unsigned int releases[] = {70, 71, 72, 73};
unsigned int releases[] = {70, 71};
hwInfo.ipVersion.architecture = 12;
cl_device_feature_capabilities_intel expectedCapabilitiesIfNotLpg = CL_DEVICE_FEATURE_FLAG_DPAS_INTEL | CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
@@ -31,12 +32,7 @@ MTLTEST_F(ClGfxCoreHelperTestsMtl, givenVariousMtlReleasesWhenGettingSupportedDe
for (auto release : releases) {
hwInfo.ipVersion.release = release;
getMutableRootDeviceEnvironment().releaseHelper = ReleaseHelper::create(hwInfo.ipVersion);
EXPECT_EQ(MTL::isLpg(hwInfo) ? expectedgCapabilitiesIfLpg : expectedCapabilitiesIfNotLpg, clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(getRootDeviceEnvironment()));
}
hwInfo.ipVersion.architecture = 13;
for (auto gmdRelease : releases) {
hwInfo.ipVersion.release = gmdRelease;
EXPECT_EQ(expectedCapabilitiesIfNotLpg, clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(getRootDeviceEnvironment()));
}
}

View File

@@ -28,12 +28,13 @@ XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, givenXeHpgCoreWhenCheckExtensionsThenDe
XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, giveDeviceExtensionsWhenDeviceCapsInitializedThenAddProperExtensions) {
const auto &compilerProductHelper = getHelper<CompilerProductHelper>();
const auto &caps = pClDevice->getDeviceInfo();
auto releaseHelper = pClDevice->getDevice().getReleaseHelper();
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_create_buffer_with_properties")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_dot_accumulate")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_local_block_io")));
bool expectMatrixMultiplyAccumulateExtensions = compilerProductHelper.isMatrixMultiplyAccumulateSupported(pClDevice->getHardwareInfo());
bool expectMatrixMultiplyAccumulateExtensions = compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper);
EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate")));
EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate")));

View File

@@ -61,6 +61,14 @@ set(CLOC_LIB_SRCS_LIB
${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.h
${NEO_SHARED_DIRECTORY}/helpers${BRANCH_DIR_SUFFIX}product_config_helper_extra.cpp
${NEO_SHARED_DIRECTORY}/os_interface/os_library.h
${NEO_SHARED_DIRECTORY}/release_helper/release_helper.h
${NEO_SHARED_DIRECTORY}/release_helper/release_helper.cpp
${NEO_SHARED_DIRECTORY}/release_helper/release_helper_base.inl
${NEO_SHARED_DIRECTORY}/release_helper/release_helper_1270.cpp
${NEO_SHARED_DIRECTORY}/release_helper/release_helper_1271.cpp
${NEO_SHARED_DIRECTORY}/release_helper${BRANCH_DIR_SUFFIX}enable_release_helper_xe.cpp
${NEO_SHARED_DIRECTORY}/release_helper/release_helper_common_xe_lpg.inl
${NEO_SHARED_DIRECTORY}/release_helper/definitions${BRANCH_DIR_SUFFIX}release_definitions.h
${NEO_SHARED_DIRECTORY}/sku_info/definitions${BRANCH_DIR_SUFFIX}sku_info.cpp
${NEO_SHARED_DIRECTORY}/utilities/directory.h
${NEO_SHARED_DIRECTORY}/utilities/io_functions.cpp

View File

@@ -142,6 +142,7 @@ append_sources_from_properties(CORE_SOURCES
NEO_CORE_UTILITIES
NEO_DEVICE_BINARY_FORMAT
NEO_UNIFIED_MEMORY
NEO_CORE_RELEASE_HELPER
)
if(WIN32)

View File

@@ -857,6 +857,10 @@ const CompilerProductHelper &Device::getCompilerProductHelper() const {
return getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
}
const ReleaseHelper *Device::getReleaseHelper() const {
return getRootDeviceEnvironment().getReleaseHelper();
}
void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
UNRECOVERABLE_IF(rtDispatchGlobalsInfos.size() < maxBvhLevels + 1);
UNRECOVERABLE_IF(rtDispatchGlobalsInfos[maxBvhLevels] != nullptr);

View File

@@ -35,6 +35,7 @@ struct PhysicalDevicePciBusInfo;
class GfxCoreHelper;
class ProductHelper;
class CompilerProductHelper;
class ReleaseHelper;
struct SelectorCopyEngine : NonCopyableOrMovableClass {
std::atomic<bool> isMainUsed = false;
@@ -160,6 +161,8 @@ class Device : public ReferenceTrackedObject<Device> {
const GfxCoreHelper &getGfxCoreHelper() const;
const ProductHelper &getProductHelper() const;
const CompilerProductHelper &getCompilerProductHelper() const;
const ReleaseHelper *getReleaseHelper() const;
uint32_t getNumberOfRegularContextsPerEngine() const { return numberOfRegularContextsPerEngine; }
bool isMultiRegularContextSelectionAllowed(aub_stream::EngineType engineType, EngineUsage engineUsage) const;

View File

@@ -33,6 +33,7 @@
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/os_time.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/utilities/software_tags_manager.h"
namespace NEO {
@@ -159,6 +160,7 @@ void RootDeviceEnvironment::initHelpers() {
initGfxCoreHelper();
initApiGfxCoreHelper();
initCompilerProductHelper();
initReleaseHelper();
}
void RootDeviceEnvironment::initGfxCoreHelper() {
@@ -178,6 +180,16 @@ void RootDeviceEnvironment::initCompilerProductHelper() {
}
}
void RootDeviceEnvironment::initReleaseHelper() {
if (releaseHelper == nullptr) {
releaseHelper = ReleaseHelper::create(this->getHardwareInfo()->ipVersion);
}
}
ReleaseHelper *RootDeviceEnvironment::getReleaseHelper() const {
return releaseHelper.get();
}
BuiltIns *RootDeviceEnvironment::getBuiltIns() {
if (this->builtins.get() == nullptr) {
std::lock_guard<std::mutex> autolock(this->mtx);

View File

@@ -38,6 +38,7 @@ class GfxCoreHelper;
class ApiGfxCoreHelper;
class CompilerProductHelper;
class GraphicsAllocation;
class ReleaseHelper;
struct AllocationProperties;
struct HardwareInfo;
@@ -81,6 +82,8 @@ struct RootDeviceEnvironment {
void initGfxCoreHelper();
void initApiGfxCoreHelper();
void initCompilerProductHelper();
void initReleaseHelper();
ReleaseHelper *getReleaseHelper() const;
template <typename HelperType>
HelperType &getHelper() const;
const ProductHelper &getProductHelper() const;
@@ -102,6 +105,8 @@ struct RootDeviceEnvironment {
std::unique_ptr<GfxCoreHelper> gfxCoreHelper;
std::unique_ptr<ProductHelper> productHelper;
std::unique_ptr<CompilerProductHelper> compilerProductHelper;
std::unique_ptr<ReleaseHelper> releaseHelper;
std::unique_ptr<AssertHandler> assertHandler;
ExecutionEnvironment &executionEnvironment;

View File

@@ -11,6 +11,7 @@
#include "shared/source/compiler_interface/oclc_extensions.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/release_helper/release_helper.h"
#include <cstdint>
#include <sstream>
@@ -39,7 +40,8 @@ bool requiresAdditionalExtensions(const std::string &compileOptions) {
}
void appendExtensionsToInternalOptions(const HardwareInfo &hwInfo, const std::string &options, std::string &internalOptions) {
auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
auto releaseHelper = ReleaseHelper::create(hwInfo.ipVersion);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
if (requiresAdditionalExtensions(options)) {
extensionsList += "cl_khr_3d_image_writes ";

View File

@@ -18,6 +18,7 @@ namespace NEO {
class CompilerProductHelper;
struct HardwareInfo;
class ReleaseHelper;
using CompilerProductHelperCreateFunctionType = std::unique_ptr<CompilerProductHelper> (*)();
extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT];
@@ -36,7 +37,7 @@ class CompilerProductHelper {
virtual bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isForceEmuInt32DivRemSPRequired() const = 0;
virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0;
virtual bool isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const = 0;
virtual bool isSplitMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isSubgroupLocalBlockIoSupported() const = 0;
@@ -51,7 +52,7 @@ class CompilerProductHelper {
virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0;
virtual uint64_t getHwInfoConfig(const HardwareInfo &hwInfo) const = 0;
virtual uint32_t getNumThreadsPerEu() const = 0;
virtual std::string getDeviceExtensions(const HardwareInfo &hwInfo) const = 0;
virtual std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const = 0;
virtual ~CompilerProductHelper() = default;
@@ -70,7 +71,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const override;
bool isForceEmuInt32DivRemSPRequired() const override;
bool isStatelessToStatefulBufferOffsetSupported() const override;
bool isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const override;
bool isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const override;
bool isSplitMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const override;
bool isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const override;
bool isSubgroupLocalBlockIoSupported() const override;
@@ -85,7 +86,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
const char *getCachingPolicyOptions(bool isDebuggerActive) const override;
uint64_t getHwInfoConfig(const HardwareInfo &hwInfo) const override;
uint32_t getNumThreadsPerEu() const override;
std::string getDeviceExtensions(const HardwareInfo &hwInfo) const override;
std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const override;
~CompilerProductHelperHw() override = default;

View File

@@ -34,7 +34,7 @@ bool CompilerProductHelperHw<gfxProduct>::failBuildProgramWithStatefulAccessPref
}
template <PRODUCT_FAMILY gfxProduct>
std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const HardwareInfo &hwInfo) const {
std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const {
std::string extensions = "cl_khr_byte_addressable_store "
"cl_khr_device_uuid "
"cl_khr_fp16 "
@@ -165,7 +165,7 @@ std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const Hardw
extensions += "cl_intel_subgroup_local_block_io ";
}
if (isMatrixMultiplyAccumulateSupported(hwInfo)) {
if (isMatrixMultiplyAccumulateSupported(releaseHelper)) {
extensions += "cl_intel_subgroup_matrix_multiply_accumulate ";
}

View File

@@ -14,7 +14,7 @@ uint32_t CompilerProductHelperHw<gfxProduct>::getNumThreadsPerEu() const {
}
template <PRODUCT_FAMILY gfxProduct>
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const {
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const {
return false;
}

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/release_helper/release_helper.h"
namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
@@ -14,7 +15,11 @@ uint32_t CompilerProductHelperHw<gfxProduct>::getNumThreadsPerEu() const {
}
template <PRODUCT_FAMILY gfxProduct>
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const {
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const {
if (releaseHelper) {
return releaseHelper->isMatrixMultiplyAccumulateSupported();
}
return true;
}

View File

@@ -1,15 +1,15 @@
#
# Copyright (C) 2019-2021 Intel Corporation
# Copyright (C) 2019-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(${NEO_TARGET_PROCESSOR} STREQUAL "x86_64")
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_avx2.cpp
set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_avx2.cpp
)
set_property(GLOBAL PROPERTY NEO_CORE_HELPERS ${NEO_CORE_HELPERS})
set_property(GLOBAL APPEND PROPERTY NEO_CORE_HELPERS ${NEO_CORE_HELPERS})
endif()

View File

@@ -108,6 +108,7 @@ bool Wddm::init() {
productHelper.adjustPlatformForProductFamily(hardwareInfo);
rootDeviceEnvironment.initApiGfxCoreHelper();
rootDeviceEnvironment.initGfxCoreHelper();
rootDeviceEnvironment.initReleaseHelper();
if (productHelper.configureHwInfoWddm(hardwareInfo, hardwareInfo, rootDeviceEnvironment)) {
return false;

View File

@@ -0,0 +1,27 @@
#
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(NEO_CORE_RELEASE_HELPER
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/release_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/release_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_base.inl
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}release_definitions.h
${CMAKE_CURRENT_SOURCE_DIR}/release_helper.cpp
)
if(SUPPORT_XE_HPG_CORE)
list(APPEND NEO_CORE_RELEASE_HELPER
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_common_xe_lpg.inl
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_1270.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_1271.cpp
)
set_property(GLOBAL APPEND PROPERTY NEO_CORE_SRCS_LINK ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}enable_release_helper_xe.cpp)
endif()
set_property(GLOBAL APPEND PROPERTY NEO_CORE_RELEASE_HELPER ${NEO_CORE_RELEASE_HELPER})
add_subdirectories()

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
namespace NEO {
enum class ReleaseType {
release1270 = 0,
release1271 = 1,
};
} // namespace NEO

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/release_helper/release_helper.h"
#include "release_definitions.h"
namespace NEO {
inline constexpr uint32_t maxReleaseXe = 75;
inline createReleaseHelperFunctionType releaseHelperFactoryXe[maxReleaseXe]{};
EnableReleaseHelperArchitecture<12> enableReleaseHelperArchitecture12{releaseHelperFactoryXe};
EnableReleaseHelper<ReleaseType::release1270> enablerReleaseHelper1270{releaseHelperFactoryXe[70]};
EnableReleaseHelper<ReleaseType::release1271> enablerReleaseHelper1271{releaseHelperFactoryXe[71]};
} // namespace NEO

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/release_helper/release_helper.h"
namespace NEO {
std::unique_ptr<ReleaseHelper> ReleaseHelper::create(HardwareIpVersion hardwareIpVersion) {
auto architecture = hardwareIpVersion.architecture;
auto release = hardwareIpVersion.release;
if (releaseHelperFactory[architecture] == nullptr || releaseHelperFactory[architecture][release] == nullptr) {
return {nullptr};
}
auto createFunction = releaseHelperFactory[architecture][release];
return createFunction(hardwareIpVersion);
}
} // namespace NEO

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/hw_ip_version.h"
#include <memory>
namespace NEO {
class ReleaseHelper;
enum class ReleaseType;
inline constexpr uint32_t maxArchitecture = 64;
using createReleaseHelperFunctionType = std::unique_ptr<ReleaseHelper> (*)(HardwareIpVersion hardwareIpVersion);
inline createReleaseHelperFunctionType *releaseHelperFactory[maxArchitecture]{};
class ReleaseHelper {
public:
static std::unique_ptr<ReleaseHelper> create(HardwareIpVersion hardwareIpVersion);
virtual bool isMatrixMultiplyAccumulateSupported() const = 0;
virtual ~ReleaseHelper() = default;
protected:
ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {}
HardwareIpVersion hardwareIpVersion{};
};
template <ReleaseType releaseType>
class ReleaseHelperHw : public ReleaseHelper {
public:
static std::unique_ptr<ReleaseHelper> create(HardwareIpVersion hardwareIpVersion) {
return std::unique_ptr<ReleaseHelper>(new ReleaseHelperHw<releaseType>{hardwareIpVersion});
}
bool isMatrixMultiplyAccumulateSupported() const override;
private:
ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {}
};
template <uint32_t architecture>
struct EnableReleaseHelperArchitecture {
EnableReleaseHelperArchitecture(createReleaseHelperFunctionType *releaseTable) {
releaseHelperFactory[architecture] = releaseTable;
}
};
template <ReleaseType releaseType>
struct EnableReleaseHelper {
EnableReleaseHelper(createReleaseHelperFunctionType &releaseTableEntry) {
using ReleaseHelperType = ReleaseHelperHw<releaseType>;
releaseTableEntry = ReleaseHelperType::create;
}
};
} // namespace NEO

View File

@@ -0,0 +1,18 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/release_helper/release_helper_base.inl"
#include "release_definitions.h"
namespace NEO {
constexpr auto release = ReleaseType::release1270;
} // namespace NEO
#include "shared/source/release_helper/release_helper_common_xe_lpg.inl"
template class NEO::ReleaseHelperHw<NEO::release>;

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/release_helper/release_helper_base.inl"
#include "release_definitions.h"
namespace NEO {
constexpr auto release = ReleaseType::release1271;
} // namespace NEO
#include "shared/source/release_helper/release_helper_common_xe_lpg.inl"
template class NEO::ReleaseHelperHw<NEO::release>;

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/release_helper/release_helper.h"
namespace NEO {
template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isMatrixMultiplyAccumulateSupported() const {
return true;
}
} // namespace NEO

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/release_helper/release_helper.h"
namespace NEO {
template <>
bool ReleaseHelperHw<release>::isMatrixMultiplyAccumulateSupported() const {
return false;
}
} // namespace NEO

View File

@@ -21,11 +21,6 @@ constexpr auto gfxProduct = IGFX_METEORLAKE;
namespace NEO {
template <>
bool CompilerProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const {
return (MTL::isLpg(hwInfo) == false);
}
template <>
bool CompilerProductHelperHw<gfxProduct>::isSplitMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const {
return (MTL::isLpg(hwInfo) == false);

View File

@@ -46,6 +46,11 @@ HelperType &DeviceFixture::getHelper() const {
return helper;
}
const ReleaseHelper *DeviceFixture::getReleaseHelper() {
const auto *releaseHelper = this->pDevice->getRootDeviceEnvironment().getReleaseHelper();
return releaseHelper;
}
template ProductHelper &DeviceFixture::getHelper<ProductHelper>() const;
template GfxCoreHelper &DeviceFixture::getHelper<GfxCoreHelper>() const;
template CompilerProductHelper &DeviceFixture::getHelper<CompilerProductHelper>() const;

View File

@@ -12,6 +12,7 @@
namespace NEO {
class MockDevice;
class ReleaseHelper;
struct DeviceFixture {
void setUp();
@@ -28,6 +29,8 @@ struct DeviceFixture {
template <typename HelperType>
HelperType &getHelper() const;
const ReleaseHelper *getReleaseHelper();
};
} // namespace NEO

View File

@@ -149,6 +149,12 @@ if(TESTS_PVC_AND_LATER)
)
endif()
if(TESTS_XE_HPG_CORE)
list(APPEND neo_libult_common_SRCS_LIB_ULT
${NEO_SHARED_DIRECTORY}/release_helper${BRANCH_DIR_SUFFIX}enable_release_helper_xe.cpp
)
endif()
set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT ${neo_libult_common_SRCS_LIB_ULT})
set_property(GLOBAL PROPERTY neo_libult_common_SRCS_ENABLE_TESTED_HW ${neo_libult_common_SRCS_ENABLE_TESTED_HW})

View File

@@ -62,5 +62,6 @@ GEN8TEST_F(MemorySynchronizatiopCommandsTestsGen8, WhenProgrammingCacheFlushThen
using CompilerProductHelperTestGen8 = Test<DeviceFixture>;
GEN8TEST_F(CompilerProductHelperTestGen8, givenHwInfosWhenIsMatrixMultiplyAccumulateSupportedThenReturnFalse) {
auto &compilerProductHelper = getHelper<CompilerProductHelper>();
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(*defaultHwInfo));
auto releaseHelper = this->pDevice->getReleaseHelper();
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper));
}

View File

@@ -119,8 +119,9 @@ HWTEST2_F(CompilerProductHelperFixture, GivenXeHpAndLaterThenBFloat16ConversionI
HWTEST2_F(CompilerProductHelperFixture, GivenXeHpAndLaterThenMatrixMultiplyAccumulateIsSupported, IsAtLeastXeHpCore) {
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
auto releaseHelper = pDevice->getReleaseHelper();
EXPECT_TRUE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(pDevice->getHardwareInfo()));
EXPECT_TRUE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper));
}
HWTEST2_F(CompilerProductHelperFixture, GivenXeFamilyThenSplitMatrixMultiplyAccumulateIsSupported, IsWithinXeGfxFamily) {
@@ -143,8 +144,8 @@ HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpThenBFloat16ConversionIsNotS
HWTEST2_F(CompilerProductHelperFixture, GivenPreXeHpThenMatrixMultiplyAccumulateIsNotSupported, IsAtMostGen12lp) {
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(pDevice->getHardwareInfo()));
auto releaseHelper = pDevice->getReleaseHelper();
EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper));
}
HWTEST2_F(CompilerProductHelperFixture, givenAotConfigWhenSetHwInfoRevisionIdThenCorrectValueIsSet, IsAtMostDg2) {
@@ -205,34 +206,36 @@ HWTEST2_F(CompilerProductHelperFixture, givenCachePolicyWithoutCorrespondingBuil
TEST_F(CompilerProductHelperFixture, givenHwInfoWithIndependentForwardProgressThenReportsClKhrSubgroupExtension) {
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
auto *releaseHelper = getReleaseHelper();
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsIndependentForwardProgress = true;
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_TRUE(hasSubstr(extensions, std::string("cl_khr_subgroups")));
hwInfo.capabilityTable.supportsIndependentForwardProgress = false;
extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_FALSE(hasSubstr(extensions, std::string("cl_khr_subgroups")));
}
TEST_F(CompilerProductHelperFixture, givenHwInfoWithCLVersionAtLeast20ThenReportsClExtFloatAtomicsExtension) {
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
auto *releaseHelper = getReleaseHelper();
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.clVersionSupport = 20;
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_TRUE(hasSubstr(extensions, std::string("cl_ext_float_atomics")));
hwInfo.capabilityTable.clVersionSupport = 21;
extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_TRUE(hasSubstr(extensions, std::string("cl_ext_float_atomics")));
hwInfo.capabilityTable.clVersionSupport = 30;
extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_TRUE(hasSubstr(extensions, std::string("cl_ext_float_atomics")));
hwInfo.capabilityTable.clVersionSupport = 12;
extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_FALSE(hasSubstr(extensions, std::string("cl_ext_float_atomics")));
}

View File

@@ -29,7 +29,8 @@ DG2TEST_F(GfxCoreHelperTestDg2, whenGetExtensionsIsCalledThenMatrixMultiplyAccum
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
auto *releaseHelper = rootDeviceEnvironment.getReleaseHelper();
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_TRUE(hasSubstr(extensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate")));
EXPECT_TRUE(hasSubstr(extensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate")));

View File

@@ -9,6 +9,7 @@
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gfx_core_helper_tests.h"
@@ -33,11 +34,15 @@ MTLTEST_F(GfxCoreHelperTestMtl, givenVariousMtlReleasesWhenGetExtensionsIsCalled
for (auto gmdRelease : gmdReleases) {
hwInfo.ipVersion.release = gmdRelease;
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo);
rootDeviceEnvironment.releaseHelper = ReleaseHelper::create(hwInfo.ipVersion);
auto releaseHelper = rootDeviceEnvironment.getReleaseHelper();
auto extensions = compilerProductHelper.getDeviceExtensions(hwInfo, releaseHelper);
EXPECT_EQ(!MTL::isLpg(hwInfo), hasSubstr(extensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate")));
EXPECT_EQ(!MTL::isLpg(hwInfo), hasSubstr(extensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate")));
EXPECT_EQ(!MTL::isLpg(hwInfo), compilerProductHelper.isMatrixMultiplyAccumulateSupported(hwInfo));
EXPECT_EQ(!MTL::isLpg(hwInfo), compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper));
EXPECT_EQ(!MTL::isLpg(hwInfo), compilerProductHelper.isSplitMatrixMultiplyAccumulateSupported(hwInfo));
}
}