From a5765a9d8cd812ba84161bc764bc347e3f814a5d Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 8 May 2023 08:59:02 +0000 Subject: [PATCH] fix: correct matrix multiply capability on xe lpg Related-To: NEO-7786 Signed-off-by: Kamil Kopryk --- .../mtl/test_cl_device_caps_mtl.cpp | 2 +- .../compiler_product_helper_mtl.inl | 10 ++++ .../mtl/gfx_core_helper_tests_mtl.cpp | 49 ------------------- .../mtl/product_helper_tests_mtl.cpp | 42 ++++++++++++++++ 4 files changed, 53 insertions(+), 50 deletions(-) diff --git a/opencl/test/unit_test/xe_hpg_core/mtl/test_cl_device_caps_mtl.cpp b/opencl/test/unit_test/xe_hpg_core/mtl/test_cl_device_caps_mtl.cpp index d11dfc4ccd..87a6b7cf8c 100644 --- a/opencl/test/unit_test/xe_hpg_core/mtl/test_cl_device_caps_mtl.cpp +++ b/opencl/test/unit_test/xe_hpg_core/mtl/test_cl_device_caps_mtl.cpp @@ -20,7 +20,7 @@ using MtlDeviceCapsTest = ::testing::Test; MTLTEST_F(MtlDeviceCapsTest, whenCheckingExtensionThenCorrectExtensionsAreReported) { VariableBackup backupHwInfo(defaultHwInfo.get()); - unsigned int gmdReleases[] = {70, 71, 72, 73}; + unsigned int gmdReleases[] = {70, 71}; defaultHwInfo->ipVersion.architecture = 12; for (auto gmdRelease : gmdReleases) { diff --git a/shared/source/xe_hpg_core/definitions/compiler_product_helper_mtl.inl b/shared/source/xe_hpg_core/definitions/compiler_product_helper_mtl.inl index 2ce064d3e4..29f141a20e 100644 --- a/shared/source/xe_hpg_core/definitions/compiler_product_helper_mtl.inl +++ b/shared/source/xe_hpg_core/definitions/compiler_product_helper_mtl.inl @@ -10,4 +10,14 @@ template <> uint64_t CompilerProductHelperHw::getHwInfoConfig(const HardwareInfo &hwInfo) const { return 0x0; } + +template <> +bool CompilerProductHelperHw::isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const { + if (releaseHelper) { + return releaseHelper->isMatrixMultiplyAccumulateSupported(); + } + + return false; +} + } // namespace NEO diff --git a/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp index c8ed4a50cc..227c7c0e35 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/gfx_core_helper_tests_mtl.cpp @@ -24,42 +24,6 @@ using namespace NEO; using GfxCoreHelperTestMtl = GfxCoreHelperTest; -MTLTEST_F(GfxCoreHelperTestMtl, givenVariousMtlReleasesWhenGetExtensionsIsCalledThenMatrixMultiplyAccumulateExtensionsAreCorrectlyReported) { - MockExecutionEnvironment mockExecutionEnvironment{}; - auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0]; - auto &compilerProductHelper = rootDeviceEnvironment.getHelper(); - auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); - unsigned int gmdReleases[] = {70, 71, 72, 73}; - hwInfo.ipVersion.architecture = 12; - - for (auto gmdRelease : gmdReleases) { - hwInfo.ipVersion.release = gmdRelease; - - 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(releaseHelper)); - EXPECT_EQ(!MTL::isLpg(hwInfo), compilerProductHelper.isSplitMatrixMultiplyAccumulateSupported(hwInfo)); - } -} - -using ProductHelperTestMtl = Test; - -MTLTEST_F(ProductHelperTestMtl, givenPatIndexAndAllocationTypeWhenCallOverridePatIndexThenForTimestampPacketTagBufferReturnTwo) { - auto &helper = getHelper(); - uint64_t expectedPatIndexWhenTimestampPacketTagBuffer = 2u; - uint64_t patIndex = 1u; - auto allocationType = NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER; - EXPECT_EQ(expectedPatIndexWhenTimestampPacketTagBuffer, helper.overridePatIndex(allocationType, patIndex)); - allocationType = NEO::AllocationType::BUFFER; - patIndex = 3u; - EXPECT_EQ(patIndex, helper.overridePatIndex(allocationType, patIndex)); -} - MTLTEST_F(GfxCoreHelperTestMtl, givenAllocationThenCheckResourceCompatibilityReturnsTrue) { auto &gfxCoreHelper = getHelper(); auto allocation = std::make_unique(0, AllocationType::BUFFER, nullptr, 0u, 0, MemoryPool::MemoryNull, 3u, 0llu); @@ -115,19 +79,6 @@ MTLTEST_F(GfxCoreHelperTestMtl, givenRevisionEnumAndPlatformFamilyTypeThenProper } } -MTLTEST_F(ProductHelperTestMtl, givenMultitileConfigWhenConfiguringHwInfoThenEnableBlitter) { - auto &productHelper = getHelper(); - - HardwareInfo hwInfo = *defaultHwInfo; - - for (uint32_t tileCount = 0; tileCount <= 4; tileCount++) { - hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = tileCount; - productHelper.configureHardwareCustom(&hwInfo, nullptr); - - EXPECT_TRUE(hwInfo.capabilityTable.blitterOperationsSupported); - } -} - MTLTEST_F(GfxCoreHelperTestMtl, givenMtlWhenSetForceNonCoherentThenNothingChanged) { using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT; diff --git a/shared/test/unit_test/xe_hpg_core/mtl/product_helper_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/product_helper_tests_mtl.cpp index 7cb08e0a51..e23c776b24 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/product_helper_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/product_helper_tests_mtl.cpp @@ -9,6 +9,7 @@ #include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/compiler_product_helper.h" +#include "shared/source/memory_manager/allocation_type.h" #include "shared/source/os_interface/product_helper.h" #include "shared/source/xe_hpg_core/hw_cmds_mtl.h" #include "shared/test/common/fixtures/device_fixture.h" @@ -265,3 +266,44 @@ MTLTEST_F(MtlProductHelper, givenMtlWhenCallIsAdjustWalkOrderAvailableThenReturn EXPECT_EQ(!MTL::isLpg(*defaultHwInfo), productHelper->isAdjustWalkOrderAvailable(releaseHelper)); } } + +MTLTEST_F(MtlProductHelper, givenMtlAndReleaseHelperNullptrWhengetIsMatrixMultiplyAccumulateSupportedThenReturnsFalse) { + auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + ReleaseHelper *releaseHelper = nullptr; + EXPECT_FALSE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper)); +} + +MTLTEST_F(MtlProductHelper, givenVariousMtlReleasesWhenGetExtensionsIsCalledThenMatrixMultiplyAccumulateExtensionsAreCorrectlyReported) { + + auto &rootDeviceEnvironment = *this->executionEnvironment->rootDeviceEnvironments[0].get(); + auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo(); + unsigned int gmdReleases[] = {70, 71}; + hwInfo.ipVersion.architecture = 12; + + for (auto gmdRelease : gmdReleases) { + hwInfo.ipVersion.release = gmdRelease; + + refreshReleaseHelper(&hwInfo); + 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(releaseHelper)); + EXPECT_EQ(!MTL::isLpg(hwInfo), compilerProductHelper.isSplitMatrixMultiplyAccumulateSupported(hwInfo)); + } +} + +using ProductHelperTestMtl = Test; + +MTLTEST_F(ProductHelperTestMtl, givenPatIndexAndAllocationTypeWhenCallOverridePatIndexThenForTimestampPacketTagBufferReturnTwo) { + auto &helper = getHelper(); + uint64_t expectedPatIndexWhenTimestampPacketTagBuffer = 2u; + uint64_t patIndex = 1u; + auto allocationType = NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER; + EXPECT_EQ(expectedPatIndexWhenTimestampPacketTagBuffer, helper.overridePatIndex(allocationType, patIndex)); + allocationType = NEO::AllocationType::BUFFER; + patIndex = 3u; + EXPECT_EQ(patIndex, helper.overridePatIndex(allocationType, patIndex)); +}