From 438611be093c4ffe32a73d49957fbe0e6f78bb87 Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Fri, 18 Jun 2021 15:23:10 +0000 Subject: [PATCH] Disable FusedEus when debugger is used Related-To: NEO-5961 Signed-off-by: Mateusz Hoppe --- opencl/source/gen11/hw_info_ehl.inl | 3 +- opencl/source/gen11/hw_info_icllp.inl | 3 +- opencl/source/gen11/hw_info_lkf.inl | 3 +- opencl/source/gen12lp/hw_info_adls.inl | 3 +- opencl/source/gen12lp/hw_info_dg1.inl | 3 +- opencl/source/gen12lp/hw_info_rkl.inl | 3 +- opencl/source/gen12lp/hw_info_tgllp.inl | 3 +- opencl/source/gen8/hw_info_bdw.inl | 3 +- opencl/source/gen9/hw_info_bxt.inl | 3 +- opencl/source/gen9/hw_info_cfl.inl | 3 +- opencl/source/gen9/hw_info_glk.inl | 3 +- opencl/source/gen9/hw_info_kbl.inl | 3 +- opencl/source/gen9/hw_info_skl.inl | 3 +- .../source_level_debugger_tests.cpp | 36 +++++++++++++++++++ shared/source/debugger/debugger.cpp | 4 +++ .../source/helpers/hw_helper_tgllp_plus.inl | 4 ++- shared/source/helpers/hw_info.h | 1 + 17 files changed, 70 insertions(+), 14 deletions(-) diff --git a/opencl/source/gen11/hw_info_ehl.inl b/opencl/source/gen11/hw_info_ehl.inl index 95fa8c44e4..74bc40d7a5 100644 --- a/opencl/source/gen11/hw_info_ehl.inl +++ b/opencl/source/gen11/hw_info_ehl.inl @@ -79,7 +79,8 @@ const RuntimeCapabilityTable EHL::capabilityTable{ true, // hostPtrTrackingEnabled false, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable EHL::workaroundTable = {}; diff --git a/opencl/source/gen11/hw_info_icllp.inl b/opencl/source/gen11/hw_info_icllp.inl index 58c4d959b7..452b124bcd 100644 --- a/opencl/source/gen11/hw_info_icllp.inl +++ b/opencl/source/gen11/hw_info_icllp.inl @@ -80,7 +80,8 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{ true, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable ICLLP::workaroundTable = {}; diff --git a/opencl/source/gen11/hw_info_lkf.inl b/opencl/source/gen11/hw_info_lkf.inl index 3addbd4dfc..25532899ea 100644 --- a/opencl/source/gen11/hw_info_lkf.inl +++ b/opencl/source/gen11/hw_info_lkf.inl @@ -79,7 +79,8 @@ const RuntimeCapabilityTable LKF::capabilityTable{ true, // hostPtrTrackingEnabled false, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable LKF::workaroundTable = {}; diff --git a/opencl/source/gen12lp/hw_info_adls.inl b/opencl/source/gen12lp/hw_info_adls.inl index 5d012c43e9..fec9d72367 100644 --- a/opencl/source/gen12lp/hw_info_adls.inl +++ b/opencl/source/gen12lp/hw_info_adls.inl @@ -81,7 +81,8 @@ const RuntimeCapabilityTable ADLS::capabilityTable{ false, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + true // fusedEuEnabled }; WorkaroundTable ADLS::workaroundTable = {}; diff --git a/opencl/source/gen12lp/hw_info_dg1.inl b/opencl/source/gen12lp/hw_info_dg1.inl index 44c1a6f647..4c8e3e9a92 100644 --- a/opencl/source/gen12lp/hw_info_dg1.inl +++ b/opencl/source/gen12lp/hw_info_dg1.inl @@ -85,7 +85,8 @@ const RuntimeCapabilityTable DG1::capabilityTable{ false, // hostPtrTrackingEnabled true, // levelZeroSupported false, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + true // fusedEuEnabled }; WorkaroundTable DG1::workaroundTable = {}; diff --git a/opencl/source/gen12lp/hw_info_rkl.inl b/opencl/source/gen12lp/hw_info_rkl.inl index d3500e2e9d..abe7ac6b5c 100644 --- a/opencl/source/gen12lp/hw_info_rkl.inl +++ b/opencl/source/gen12lp/hw_info_rkl.inl @@ -77,7 +77,8 @@ const RuntimeCapabilityTable RKL::capabilityTable{ false, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + true // fusedEuEnabled }; WorkaroundTable RKL::workaroundTable = {}; diff --git a/opencl/source/gen12lp/hw_info_tgllp.inl b/opencl/source/gen12lp/hw_info_tgllp.inl index 814088c35d..a718c73893 100644 --- a/opencl/source/gen12lp/hw_info_tgllp.inl +++ b/opencl/source/gen12lp/hw_info_tgllp.inl @@ -81,7 +81,8 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{ false, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + true // fusedEuEnabled }; WorkaroundTable TGLLP::workaroundTable = {}; diff --git a/opencl/source/gen8/hw_info_bdw.inl b/opencl/source/gen8/hw_info_bdw.inl index 5cf88a3718..08b9c2b3b2 100644 --- a/opencl/source/gen8/hw_info_bdw.inl +++ b/opencl/source/gen8/hw_info_bdw.inl @@ -84,7 +84,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{ true, // hostPtrTrackingEnabled false, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable BDW::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_bxt.inl b/opencl/source/gen9/hw_info_bxt.inl index d0381162b2..6ebfe98297 100644 --- a/opencl/source/gen9/hw_info_bxt.inl +++ b/opencl/source/gen9/hw_info_bxt.inl @@ -81,7 +81,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{ true, // hostPtrTrackingEnabled false, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable BXT::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_cfl.inl b/opencl/source/gen9/hw_info_cfl.inl index fd594b0f38..3ad47ebc49 100644 --- a/opencl/source/gen9/hw_info_cfl.inl +++ b/opencl/source/gen9/hw_info_cfl.inl @@ -76,7 +76,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{ true, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable CFL::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_glk.inl b/opencl/source/gen9/hw_info_glk.inl index 646ba3689c..8d0e3cc4cd 100644 --- a/opencl/source/gen9/hw_info_glk.inl +++ b/opencl/source/gen9/hw_info_glk.inl @@ -76,7 +76,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{ true, // hostPtrTrackingEnabled false, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable GLK::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_kbl.inl b/opencl/source/gen9/hw_info_kbl.inl index 0d1510abaf..d27c31cdec 100644 --- a/opencl/source/gen9/hw_info_kbl.inl +++ b/opencl/source/gen9/hw_info_kbl.inl @@ -76,7 +76,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{ true, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable KBL::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_skl.inl b/opencl/source/gen9/hw_info_skl.inl index 78dcc8d9ef..6f65675ea5 100644 --- a/opencl/source/gen9/hw_info_skl.inl +++ b/opencl/source/gen9/hw_info_skl.inl @@ -84,7 +84,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{ true, // hostPtrTrackingEnabled true, // levelZeroSupported true, // isIntegratedDevice - true // supportsMediaBlock + true, // supportsMediaBlock + false // fusedEuEnabled }; WorkaroundTable SKL::workaroundTable = {}; diff --git a/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp b/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp index 34789b6a47..4016dcf0b7 100644 --- a/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp +++ b/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp @@ -68,6 +68,42 @@ TEST(SourceLevelDebugger, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsC } } +TEST(SourceLevelDebugger, givenPlatformWhenSourceLevelDebuggerIsCreatedThenRuntimeCapabilityHasFusedEusDisabled) { + DebuggerLibraryRestorer restorer; + + if (defaultHwInfo->capabilityTable.debuggerSupported) { + DebuggerLibrary::setLibraryAvailable(true); + DebuggerLibrary::setDebuggerActive(true); + auto executionEnvironment = new ExecutionEnvironment(); + MockPlatform platform(*executionEnvironment); + platform.initializeWithNewDevices(); + + ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger); + + EXPECT_FALSE(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.fusedEuEnabled); + } +} + +TEST(SourceLevelDebugger, givenPlatformWhenInitializingSourceLevelDebuggerFailsThenRuntimeCapabilityFusedEusAreNotModified) { + DebuggerLibraryRestorer restorer; + + if (defaultHwInfo->capabilityTable.debuggerSupported) { + DebuggerLibraryInterceptor interceptor; + DebuggerLibrary::setLibraryAvailable(true); + DebuggerLibrary::setDebuggerActive(true); + interceptor.initRetVal = -1; + DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor); + auto executionEnvironment = new ExecutionEnvironment(); + MockPlatform platform(*executionEnvironment); + platform.initializeWithNewDevices(); + + bool defaultValue = defaultHwInfo->capabilityTable.fusedEuEnabled; + + ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger); + EXPECT_EQ(defaultValue, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.fusedEuEnabled); + } +} + TEST(SourceLevelDebugger, givenNoKernelDebuggerLibraryWhenSourceLevelDebuggerIsCreatedThenLibraryIsNotLoaded) { DebuggerLibraryRestorer restorer; DebuggerLibrary::setLibraryAvailable(false); diff --git a/shared/source/debugger/debugger.cpp b/shared/source/debugger/debugger.cpp index 14821d9abc..dee6ebb542 100644 --- a/shared/source/debugger/debugger.cpp +++ b/shared/source/debugger/debugger.cpp @@ -23,6 +23,10 @@ std::unique_ptr Debugger::create(HardwareInfo *hwInfo) { auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily); bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == hwHelper.getSipKernelType(true)); sourceLevelDebugger->initialize(localMemorySipAvailable); + + if (sourceLevelDebugger->isDebuggerActive()) { + hwInfo->capabilityTable.fusedEuEnabled = false; + } } return sourceLevelDebugger; } diff --git a/shared/source/helpers/hw_helper_tgllp_plus.inl b/shared/source/helpers/hw_helper_tgllp_plus.inl index baeef9ef34..8ebd375e92 100644 --- a/shared/source/helpers/hw_helper_tgllp_plus.inl +++ b/shared/source/helpers/hw_helper_tgllp_plus.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -13,6 +13,8 @@ namespace NEO { template inline bool HwHelperHw::isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const { auto fusedEuDispatchEnabled = !hwInfo.workaroundTable.waDisableFusedThreadScheduling; + fusedEuDispatchEnabled &= hwInfo.capabilityTable.fusedEuEnabled; + if (DebugManager.flags.CFEFusedEUDispatch.get() != -1) { fusedEuDispatchEnabled = (DebugManager.flags.CFEFusedEUDispatch.get() == 0); } diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index 9981f5ed3a..07616a2ac7 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -65,6 +65,7 @@ struct RuntimeCapabilityTable { bool levelZeroSupported; bool isIntegratedDevice; bool supportsMediaBlock; + bool fusedEuEnabled; }; struct HardwareCapabilities {