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 23ecf665cb..0ce35bd704 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 @@ -13,10 +13,10 @@ #include "shared/source/program/kernel_info.h" #include "shared/source/source_level_debugger/source_level_debugger.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" +#include "shared/test/common/helpers/debugger_library_restore.h" #include "shared/test/common/helpers/execution_environment_helper.h" #include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/helpers/variable_backup.h" -#include "shared/test/common/libult/source_level_debugger_library.h" #include "shared/test/common/mocks/mock_gmm_helper.h" #include "shared/test/common/mocks/mock_source_level_debugger.h" #include "shared/test/common/test_macros/hw_test.h" @@ -32,23 +32,8 @@ using namespace NEO; using std::string; using std::unique_ptr; -class DebuggerLibraryRestorer { - public: - DebuggerLibraryRestorer() { - restoreActiveState = DebuggerLibrary::getDebuggerActive(); - restoreAvailableState = DebuggerLibrary::getLibraryAvailable(); - } - ~DebuggerLibraryRestorer() { - DebuggerLibrary::clearDebuggerLibraryInterceptor(); - DebuggerLibrary::setDebuggerActive(restoreActiveState); - DebuggerLibrary::setLibraryAvailable(restoreAvailableState); - } - bool restoreActiveState = false; - bool restoreAvailableState = false; -}; - TEST(SourceLevelDebugger, whenSourceLevelDebuggerIsCreatedThenLegacyModeIsTrue) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(true); MockSourceLevelDebugger debugger; @@ -56,7 +41,7 @@ TEST(SourceLevelDebugger, whenSourceLevelDebuggerIsCreatedThenLegacyModeIsTrue) } TEST(SourceLevelDebugger, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsCreatedInExecutionEnvironment) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibrary::setLibraryAvailable(true); @@ -70,7 +55,7 @@ TEST(SourceLevelDebugger, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsC } TEST(SourceLevelDebugger, givenPlatformWhenSourceLevelDebuggerIsCreatedThenRuntimeCapabilityHasFusedEusDisabled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibrary::setLibraryAvailable(true); @@ -86,7 +71,7 @@ TEST(SourceLevelDebugger, givenPlatformWhenSourceLevelDebuggerIsCreatedThenRunti } TEST(SourceLevelDebugger, givenPlatformWhenInitializingSourceLevelDebuggerFailsThenRuntimeCapabilityFusedEusAreNotModified) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibraryInterceptor interceptor; @@ -106,7 +91,7 @@ TEST(SourceLevelDebugger, givenPlatformWhenInitializingSourceLevelDebuggerFailsT } TEST(SourceLevelDebugger, givenNoKernelDebuggerLibraryWhenSourceLevelDebuggerIsCreatedThenLibraryIsNotLoaded) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(false); MockSourceLevelDebugger debugger; @@ -114,7 +99,7 @@ TEST(SourceLevelDebugger, givenNoKernelDebuggerLibraryWhenSourceLevelDebuggerIsC } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryAvailableWhenSourceLevelDebuggerIsConstructedThenLibraryIsLoaded) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(true); MockSourceLevelDebugger debugger; @@ -122,7 +107,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryAvailableWhenSourceLevelDebu } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryAvailableWhenIsDebuggerActiveIsCalledThenFalseIsReturned) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(true); MockSourceLevelDebugger debugger; @@ -131,7 +116,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryAvailableWhenIsDebuggerActiv } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenIsDebuggerActiveIsCalledThenTrueIsReturned) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(true); DebuggerLibrary::setDebuggerActive(true); @@ -141,7 +126,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenIsDebuggerActiveIs } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotAvailableWhenIsDebuggerActiveIsCalledThenFalseIsReturned) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(false); MockSourceLevelDebugger debugger; @@ -150,7 +135,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotAvailableWhenIsDebuggerAc } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNotifySourceCodeIsCalledThenDebuggerLibraryFunctionIsCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -181,7 +166,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNotifySourceCodeIs } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenNotifySourceCodeIsCalledThenDebuggerLibraryFunctionIsNotCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -200,7 +185,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenNotifySourceCod } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNotifyNewDeviceIsCalledThenDebuggerLibraryFunctionIsCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -217,7 +202,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNotifyNewDeviceIsC } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenNotifyNewDeviceIsCalledThenDebuggerLibraryFunctionIsNotCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -233,7 +218,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenNotifyNewDevice } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenIsOptimizationDisabledIsCalledThenDebuggerLibraryFunctionIsCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -252,7 +237,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenIsOptimizationDisa } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenIsOptimizationDisabledIsCalledThenDebuggerLibraryFunctionIsNotCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -268,7 +253,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenIsOptimizationD } TEST(SourceLevelDebugger, givenActiveDebuggerWhenGetDebuggerOptionReturnsZeroThenIsOptimizationDisabledReturnsFalse) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -289,7 +274,7 @@ TEST(SourceLevelDebugger, givenActiveDebuggerWhenGetDebuggerOptionReturnsZeroThe } TEST(SourceLevelDebugger, givenActiveDebuggerAndOptDisabledWhenGetDebuggerOptionReturnsNonZeroAndOneInValueThenIsOptimizationDisabledReturnsTrue) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -310,7 +295,7 @@ TEST(SourceLevelDebugger, givenActiveDebuggerAndOptDisabledWhenGetDebuggerOption } TEST(SourceLevelDebugger, givenActiveDebuggerAndOptDisabledWhenGetDebuggerOptionReturnsNonZeroAndZeroInValueThenIsOptimizationDisabledReturnsFalse) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -331,7 +316,7 @@ TEST(SourceLevelDebugger, givenActiveDebuggerAndOptDisabledWhenGetDebuggerOption } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNotifyKernelDebugDataIsCalledThenDebuggerLibraryFunctionIsCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -374,7 +359,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNotifyKernelDebugD } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNullptrDebugDataIsPassedToNotifyThenDebuggerNotifiedWithNullPointersAndZeroSizes) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -410,7 +395,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenNullptrDebugDataIs } TEST(SourceLevelDebugger, givenNoVisaWhenNotifyKernelDebugDataIsCalledThenDebuggerLibraryFunctionIsCalledWithIsa) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -439,7 +424,7 @@ TEST(SourceLevelDebugger, givenNoVisaWhenNotifyKernelDebugDataIsCalledThenDebugg } TEST(SourceLevelDebugger, givenNoGenIsaWhenNotifyKernelDebugDataIsCalledThenDebuggerLibraryFunctionIsCalledWithIsa) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -468,7 +453,7 @@ TEST(SourceLevelDebugger, givenNoGenIsaWhenNotifyKernelDebugDataIsCalledThenDebu } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenNotifyKernelDebugDataIsCalledThenDebuggerLibraryFunctionIsNotCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -485,7 +470,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenNotifyKernelDeb } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenInitializeIsCalledWithLocalMemoryUsageFalseThenDebuggerFunctionIsCalledWithCorrectArg) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -501,7 +486,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenInitializeIsCalled } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenInitializeReturnsErrorThenIsActiveIsSetToFalse) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -518,7 +503,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenInitializeReturnsE } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenInitializeIsCalledWithLocalMemoryUsageTrueThenDebuggerFunctionIsCalledWithCorrectArg) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -534,7 +519,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenInitializeIsCalled } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenInitializeIsCalledThenDebuggerFunctionIsNotCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -549,7 +534,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenInitializeIsCal } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceIsConstructedThenDebuggerIsInitialized) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibraryInterceptor interceptor; @@ -563,7 +548,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceIsConstructe } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreatedThenDebuggerIsNotified) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibraryInterceptor interceptor; @@ -582,7 +567,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreatedWithOsCsrThenDebuggerIsNotifiedWithCorrectDeviceHandle) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibraryInterceptor interceptor; @@ -610,7 +595,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreatedThenDebuggerIsNotCreatedInitializedAndNotNotified) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -625,7 +610,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreated } TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenGettingSourceLevelDebuggerThenNullptrIsReturned) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -638,7 +623,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenGettingSourceLe } TEST(SourceLevelDebugger, givenDeviceWithDebuggerActiveSetWhenSourceLevelDebuggerIsNotCreatedThenNotificationsAreNotCalled) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(false); @@ -654,7 +639,7 @@ TEST(SourceLevelDebugger, givenDeviceWithDebuggerActiveSetWhenSourceLevelDebugge } TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewSourceLevelDebugger) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibraryInterceptor interceptor; @@ -680,7 +665,7 @@ TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewS } TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenCreatedThenUseDedicatedSourceLevelDebugger) { - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; if (defaultHwInfo->capabilityTable.debuggerSupported) { DebuggerLibrary::setLibraryAvailable(true); @@ -723,7 +708,7 @@ TEST(SourceLevelDebugger, givenEnableMockSourceLevelDebuggerWhenInitializingExec GTEST_SKIP_("Source Level Debugger not supported"); } DebugManagerStateRestore stateRestore; - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(false); DebugManager.flags.EnableMockSourceLevelDebugger.set(1); @@ -771,7 +756,7 @@ TEST(SourceLevelDebugger, givenMode1InEnableMockSourceLevelDebuggerWhenDebuggerC GTEST_SKIP_("Source Level Debugger not supported"); } DebugManagerStateRestore stateRestore; - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(false); DebugManager.flags.EnableMockSourceLevelDebugger.set(1); @@ -785,7 +770,7 @@ TEST(SourceLevelDebugger, givenMode2InEnableMockSourceLevelDebuggerWhenDebuggerC GTEST_SKIP_("Source Level Debugger not supported"); } DebugManagerStateRestore stateRestore; - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setLibraryAvailable(false); DebugManager.flags.EnableMockSourceLevelDebugger.set(2); @@ -798,7 +783,7 @@ TEST(SourceLevelDebugger, givenDebugVarDumpElfWhenNotifyKernelDebugDataIsCalledT DebugManagerStateRestore stateRestore; DebugManager.flags.DebuggerLogBitmask.set(NEO::DebugVariables::DEBUGGER_LOG_BITMASK::DUMP_ELF); - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -834,7 +819,7 @@ TEST(SourceLevelDebugger, givenDebugVarDumpElfWhenElfFileExistsWhileNotifyingDeb DebugManagerStateRestore stateRestore; DebugManager.flags.DebuggerLogBitmask.set(NEO::DebugVariables::DEBUGGER_LOG_BITMASK::DUMP_ELF); - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibraryInterceptor interceptor; DebuggerLibrary::setLibraryAvailable(true); @@ -874,7 +859,7 @@ TEST(SourceLevelDebugger, givenDebugVarDumpElfWhenElfFileExistsWhileNotifyingDeb TEST(SourceLevelDebugger, givenDebuggerLibraryAvailableAndExperimentalEnableSourceLevelDebuggerThenDebuggerIsCreated) { DebugManagerStateRestore stateRestore; - DebuggerLibraryRestorer restorer; + DebuggerLibraryRestore restore; DebuggerLibrary::setDebuggerActive(true); DebuggerLibrary::setLibraryAvailable(true); diff --git a/shared/source/command_stream/stream_properties.cpp b/shared/source/command_stream/stream_properties.cpp index f25946ce21..fc86514d03 100644 --- a/shared/source/command_stream/stream_properties.cpp +++ b/shared/source/command_stream/stream_properties.cpp @@ -125,6 +125,7 @@ void StateComputeModeProperties::setThreadArbitrationProperty(int32_t threadArbi void StateComputeModeProperties::initSupport(const RootDeviceEnvironment &rootDeviceEnvironment) { auto &productHelper = rootDeviceEnvironment.getHelper(); productHelper.fillScmPropertiesSupportStructure(this->scmPropertiesSupport); + productHelper.fillScmPropertiesSupportStructureExtra(this->scmPropertiesSupport, rootDeviceEnvironment); auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); this->defaultThreadArbitrationPolicy = gfxCoreHelper.getDefaultThreadArbitrationPolicy(); diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 0ab56c13aa..4be17fd4aa 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -169,6 +169,7 @@ class ProductHelper { virtual bool isDummyBlitWaRequired() const = 0; virtual bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor) const = 0; virtual bool isLinearStoragePreferred(bool isSharedContext, bool isImage1d, bool forceLinearStorage) const = 0; + virtual bool isTranslationExceptionSupported() const = 0; virtual bool getFrontEndPropertyScratchSizeSupport() const = 0; virtual bool getFrontEndPropertyPrivateScratchSizeSupport() const = 0; @@ -195,6 +196,7 @@ class ProductHelper { virtual bool getPipelineSelectPropertySystolicModeSupport() const = 0; virtual void fillScmPropertiesSupportStructure(StateComputeModePropertiesSupport &propertiesSupport) const = 0; + virtual void fillScmPropertiesSupportStructureExtra(StateComputeModePropertiesSupport &propertiesSupport, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0; virtual void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const = 0; virtual void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index fb8729883f..7e813e36aa 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -604,6 +604,9 @@ void ProductHelperHw::fillScmPropertiesSupportStructure(StateCompute fillScmPropertiesSupportStructureBase(propertiesSupport); } +template +void ProductHelperHw::fillScmPropertiesSupportStructureExtra(StateComputeModePropertiesSupport &propertiesSupport, const RootDeviceEnvironment &rootDeviceEnvironment) const {} + template bool ProductHelperHw::getScmPropertyThreadArbitrationPolicySupport() const { using GfxProduct = typename HwMapper::GfxProduct; @@ -775,4 +778,10 @@ bool ProductHelperHw::isLinearStoragePreferred(bool isSharedContext, } return false; } + +template +bool ProductHelperHw::isTranslationExceptionSupported() const { + return false; +} + } // namespace NEO diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 3c123d18f9..ee8290c53f 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -123,6 +123,7 @@ class ProductHelperHw : public ProductHelper { bool isDummyBlitWaRequired() const override; bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor) const override; bool isLinearStoragePreferred(bool isSharedContext, bool isImage1d, bool forceLinearStorage) const override; + bool isTranslationExceptionSupported() const override; bool getFrontEndPropertyScratchSizeSupport() const override; bool getFrontEndPropertyPrivateScratchSizeSupport() const override; @@ -149,6 +150,7 @@ class ProductHelperHw : public ProductHelper { bool getPipelineSelectPropertySystolicModeSupport() const override; void fillScmPropertiesSupportStructure(StateComputeModePropertiesSupport &propertiesSupport) const override; + void fillScmPropertiesSupportStructureExtra(StateComputeModePropertiesSupport &propertiesSupport, const RootDeviceEnvironment &rootDeviceEnvironment) const override; void fillFrontEndPropertiesSupportStructure(FrontEndPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override; void fillPipelineSelectPropertiesSupportStructure(PipelineSelectPropertiesSupport &propertiesSupport, const HardwareInfo &hwInfo) const override; void fillStateBaseAddressPropertiesSupportStructure(StateBaseAddressPropertiesSupport &propertiesSupport) const override; diff --git a/shared/test/common/helpers/debugger_library_restore.h b/shared/test/common/helpers/debugger_library_restore.h new file mode 100644 index 0000000000..904fb52dd0 --- /dev/null +++ b/shared/test/common/helpers/debugger_library_restore.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include "shared/test/common/libult/source_level_debugger_library.h" + +namespace NEO { + +class DebuggerLibraryRestore { + public: + DebuggerLibraryRestore() { + restoreActiveState = DebuggerLibrary::getDebuggerActive(); + restoreAvailableState = DebuggerLibrary::getLibraryAvailable(); + } + ~DebuggerLibraryRestore() { + DebuggerLibrary::clearDebuggerLibraryInterceptor(); + DebuggerLibrary::setDebuggerActive(restoreActiveState); + DebuggerLibrary::setLibraryAvailable(restoreAvailableState); + } + + bool restoreActiveState = false; + bool restoreAvailableState = false; +}; + +} // namespace NEO diff --git a/shared/test/common/helpers/unit_test_helper.h b/shared/test/common/helpers/unit_test_helper.h index aa1acc6bbd..0d078779c6 100644 --- a/shared/test/common/helpers/unit_test_helper.h +++ b/shared/test/common/helpers/unit_test_helper.h @@ -62,6 +62,8 @@ struct UnitTestHelper { static uint32_t getTdCtlRegisterOffset(); static uint32_t getTdCtlRegisterValue(); + static uint32_t getMiLoadRegisterImmProgrammedCmdsCount(bool debuggingEnabled); + static const uint32_t smallestTestableSimdSize; static const AuxTranslationMode requiredAuxTranslationMode; diff --git a/shared/test/common/helpers/unit_test_helper.inl b/shared/test/common/helpers/unit_test_helper.inl index 61f9455183..3f90f8be70 100644 --- a/shared/test/common/helpers/unit_test_helper.inl +++ b/shared/test/common/helpers/unit_test_helper.inl @@ -108,4 +108,9 @@ uint32_t UnitTestHelper::getProgrammedGrfValue(CommandStreamReceiver return 0u; } +template +uint32_t UnitTestHelper::getMiLoadRegisterImmProgrammedCmdsCount(bool debuggingEnabled) { + return (debuggingEnabled ? 2u : 0u); +} + } // namespace NEO diff --git a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp index ce2fab6079..c840aa3c01 100644 --- a/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp +++ b/shared/test/unit_test/command_stream/stream_properties_tests_common.cpp @@ -123,6 +123,7 @@ HWTEST2_F(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrec auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0]; auto &productHelper = rootDeviceEnvironment.getHelper(); productHelper.fillScmPropertiesSupportStructure(scmPropertiesSupport); + productHelper.fillScmPropertiesSupportStructureExtra(scmPropertiesSupport, rootDeviceEnvironment); int32_t threadArbitrationPolicyValues[] = { ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin, diff --git a/shared/test/unit_test/gen11/test_preamble_gen11.cpp b/shared/test/unit_test/gen11/test_preamble_gen11.cpp index 4f5b6c7423..d805c175d8 100644 --- a/shared/test/unit_test/gen11/test_preamble_gen11.cpp +++ b/shared/test/unit_test/gen11/test_preamble_gen11.cpp @@ -12,6 +12,7 @@ #include "shared/source/helpers/gfx_core_helper.h" #include "shared/test/common/fixtures/preamble_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" +#include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" @@ -194,7 +195,8 @@ GEN11TEST_F(PreambleFixtureGen11, whenKernelDebuggingCommandsAreProgrammedThenCo hwParser.parseCommands(stream); auto cmdList = hwParser.getCommandsList(); - ASSERT_EQ(2u, cmdList.size()); + auto expectedProgrammedCmdsCount = UnitTestHelper::getMiLoadRegisterImmProgrammedCmdsCount(true); + ASSERT_EQ(expectedProgrammedCmdsCount, cmdList.size()); auto it = cmdList.begin(); 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 192f004399..3593dbd1e9 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -747,3 +747,7 @@ HWTEST_F(ProductHelperTest, givenProductHelperAndKernelBinaryFormatsWhenChecking EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor)); } } + +HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsTranslationExceptionSupportedThenReturnFalse) { + EXPECT_FALSE(productHelper->isTranslationExceptionSupported()); +} diff --git a/shared/test/unit_test/preamble/preamble_tests.cpp b/shared/test/unit_test/preamble/preamble_tests.cpp index b5aeb40bb6..85696fbabd 100644 --- a/shared/test/unit_test/preamble/preamble_tests.cpp +++ b/shared/test/unit_test/preamble/preamble_tests.cpp @@ -97,10 +97,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, PreambleTest, givenMidThreadPreemptionWhenPreambleIs } HWTEST_F(PreambleTest, givenActiveKernelDebuggingWhenPreambleKernelDebuggingCommandsSizeIsQueriedThenCorrectSizeIsReturned) { - typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; + using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; + auto size = PreambleHelper::getKernelDebuggingCommandsSize(true); - auto sizeExpected = 2 * sizeof(MI_LOAD_REGISTER_IMM); - EXPECT_EQ(sizeExpected, size); + auto expectedProgrammedCmdsCount = UnitTestHelper::getMiLoadRegisterImmProgrammedCmdsCount(true); + auto expectedSize = expectedProgrammedCmdsCount * sizeof(MI_LOAD_REGISTER_IMM); + EXPECT_EQ(expectedSize, size); } HWTEST_F(PreambleTest, givenInactiveKernelDebuggingWhenPreambleKernelDebuggingCommandsSizeIsQueriedThenZeroIsReturned) { @@ -121,7 +123,8 @@ HWTEST_F(PreambleTest, whenKernelDebuggingCommandsAreProgrammedThenCorrectComman hwParser.parseCommands(stream); auto cmdList = hwParser.getCommandsList(); - ASSERT_EQ(2u, cmdList.size()); + auto expectedProgrammedCmdsCount = UnitTestHelper::getMiLoadRegisterImmProgrammedCmdsCount(true); + ASSERT_EQ(expectedProgrammedCmdsCount, cmdList.size()); auto it = cmdList.begin(); @@ -165,8 +168,9 @@ HWTEST_F(PreambleTest, givenKernelDebuggingActiveWhenPreambleIsProgrammedThenPro cmdList = hwParser2.getCommandsList(); auto miLoadRegImmCountWithDebugging = cmdList.size(); + auto expectedProgrammedCmdsCount = UnitTestHelper::getMiLoadRegisterImmProgrammedCmdsCount(true); ASSERT_LT(miLoadRegImmCountWithoutDebugging, miLoadRegImmCountWithDebugging); - EXPECT_EQ(2u, miLoadRegImmCountWithDebugging - miLoadRegImmCountWithoutDebugging); + EXPECT_EQ(expectedProgrammedCmdsCount, miLoadRegImmCountWithDebugging - miLoadRegImmCountWithoutDebugging); } HWTEST_F(PreambleTest, givenKernelDebuggingActiveAndMidThreadPreemptionWhenGetAdditionalCommandsSizeIsCalledThen2MiLoadRegisterImmCmdsAreAdded) { @@ -180,7 +184,8 @@ HWTEST_F(PreambleTest, givenKernelDebuggingActiveAndMidThreadPreemptionWhenGetAd EXPECT_LT(withoutDebugging, withDebugging); size_t diff = withDebugging - withoutDebugging; - size_t sizeExpected = 2 * sizeof(typename FamilyType::MI_LOAD_REGISTER_IMM); + auto expectedProgrammedCmdsCount = UnitTestHelper::getMiLoadRegisterImmProgrammedCmdsCount(true); + size_t sizeExpected = expectedProgrammedCmdsCount * sizeof(typename FamilyType::MI_LOAD_REGISTER_IMM); EXPECT_EQ(sizeExpected, diff); } diff --git a/shared/test/unit_test/preamble/test_preamble_xe_hpg_core.cpp b/shared/test/unit_test/preamble/test_preamble_xe_hpg_core.cpp index d91fa492a3..c02367a389 100644 --- a/shared/test/unit_test/preamble/test_preamble_xe_hpg_core.cpp +++ b/shared/test/unit_test/preamble/test_preamble_xe_hpg_core.cpp @@ -20,33 +20,6 @@ using PreambleTest = ::testing::Test; using namespace NEO; -HWTEST2_F(PreambleTest, whenKernelDebuggingCommandsAreProgrammedThenCorrectCommandsArePlacedIntoStream, IsXeHpgCore) { - typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM; - - auto bufferSize = PreambleHelper::getKernelDebuggingCommandsSize(true); - auto buffer = std::unique_ptr(new char[bufferSize]); - - LinearStream stream(buffer.get(), bufferSize); - PreambleHelper::programKernelDebugging(&stream); - - HardwareParse hwParser; - hwParser.parseCommands(stream); - auto cmdList = hwParser.getCommandsList(); - - ASSERT_EQ(2u, cmdList.size()); - - auto it = cmdList.begin(); - - MI_LOAD_REGISTER_IMM *pCmd = reinterpret_cast(*it); - EXPECT_EQ(0x20d8u, pCmd->getRegisterOffset()); - EXPECT_EQ((1u << 5) | (1u << 21), pCmd->getDataDword()); - it++; - - pCmd = reinterpret_cast(*it); - EXPECT_EQ(0xe400u, pCmd->getRegisterOffset()); - EXPECT_EQ((1u << 7) | (1u << 4) | (1u << 2) | (1u << 0), pCmd->getDataDword()); -} - HWTEST2_F(PreambleTest, givenDisableEUFusionWhenProgramVFEStateThenFusedEUDispatchIsSetCorrectly, IsXeHpgCore) { typedef typename FamilyType::CFE_STATE CFE_STATE;