diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d193f096..24921c65d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2017-2020 Intel Corporation +# Copyright (C) 2017-2021 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -199,6 +199,12 @@ if(MSVC) string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASEINTERNAL "${CMAKE_CXX_FLAGS_RELEASEINTERNAL}") + + string(REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + add_definitions(-D_HAS_STATIC_RTTI=0) + add_definitions(-DPURGE_DEBUG_KEY_NAMES=1) +else() + add_definitions(-DPURGE_DEBUG_KEY_NAMES=0) endif() if(NOT SKIP_UNIT_TESTS) diff --git a/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp index 494bed6644..eb60b4d0d4 100644 --- a/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/device_command_stream_tests.cpp @@ -912,7 +912,7 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer WddmCommandStreamReceiver wddmCsr(*pDevice->executionEnvironment, 0, 1); auto wddmFromCsr = wddmCsr.peekWddm(); - EXPECT_EQ(typeid(*wddmFromCsr), typeid(WddmMock)); + EXPECT_NE(nullptr, wddmFromCsr); } struct WddmCsrCompressionTests : ::testing::Test { diff --git a/opencl/test/unit_test/windows/wddm_create_tests.cpp b/opencl/test/unit_test/windows/wddm_create_tests.cpp index c2e65be56d..0108cefc5f 100644 --- a/opencl/test/unit_test/windows/wddm_create_tests.cpp +++ b/opencl/test/unit_test/windows/wddm_create_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 Intel Corporation + * Copyright (C) 2018-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,5 +23,5 @@ TEST(wddmCreateTests, givenInputVersionWhenCreatingThenCreateRequestedObject) { RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment); auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment); std::unique_ptr wddm(Wddm::createWddm(std::move(hwDeviceIds[0]), rootDeviceEnvironment)); - EXPECT_EQ(typeid(*wddm.get()), typeid(Wddm)); + EXPECT_NE(nullptr, wddm); } diff --git a/shared/source/debug_settings/debug_settings_manager.cpp b/shared/source/debug_settings/debug_settings_manager.cpp index 583af40417..7990a59216 100644 --- a/shared/source/debug_settings/debug_settings_manager.cpp +++ b/shared/source/debug_settings/debug_settings_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -71,12 +71,18 @@ void DebugSettingsManager::dumpFlags() const { std::ofstream settingsDumpFile{settingsDumpFileName, std::ios::out}; DEBUG_BREAK_IF(!settingsDumpFile.good()); -#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ - settingsDumpFile << #variableName << " = " << flags.variableName.get() << '\n'; \ - dumpNonDefaultFlag(#variableName, flags.variableName.get(), defaultValue); +#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ + settingsDumpFile << getNonReleaseKeyName(#variableName) << " = " << flags.variableName.get() << '\n'; \ + dumpNonDefaultFlag(getNonReleaseKeyName(#variableName), flags.variableName.get(), defaultValue); + if (registryReadAvailable() || isDebugKeysReadEnabled()) { #include "debug_variables.inl" } +#undef DECLARE_DEBUG_VARIABLE + +#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ + settingsDumpFile << #variableName << " = " << flags.variableName.get() << '\n'; \ + dumpNonDefaultFlag(#variableName, flags.variableName.get(), defaultValue); #include "release_variables.inl" #undef DECLARE_DEBUG_VARIABLE } @@ -84,15 +90,22 @@ void DebugSettingsManager::dumpFlags() const { template void DebugSettingsManager::injectSettingsFromReader() { #undef DECLARE_DEBUG_VARIABLE -#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ - { \ - dataType tempData = readerImpl->getSetting(#variableName, flags.variableName.get()); \ - flags.variableName.set(tempData); \ +#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ + { \ + dataType tempData = readerImpl->getSetting(getNonReleaseKeyName(#variableName), flags.variableName.get()); \ + flags.variableName.set(tempData); \ } if (registryReadAvailable() || isDebugKeysReadEnabled()) { #include "debug_variables.inl" } + +#undef DECLARE_DEBUG_VARIABLE +#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \ + { \ + dataType tempData = readerImpl->getSetting(#variableName, flags.variableName.get()); \ + flags.variableName.set(tempData); \ + } #include "release_variables.inl" #undef DECLARE_DEBUG_VARIABLE } diff --git a/shared/source/debug_settings/debug_settings_manager.h b/shared/source/debug_settings/debug_settings_manager.h index 132030ed4c..9062d67cce 100644 --- a/shared/source/debug_settings/debug_settings_manager.h +++ b/shared/source/debug_settings/debug_settings_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -106,6 +106,10 @@ class DebugSettingsManager { return readerImpl.get(); } + static constexpr const char *getNonReleaseKeyName(const char *key) { + return (disabled() && PURGE_DEBUG_KEY_NAMES) ? "" : key; + } + protected: std::unique_ptr readerImpl; std::mutex mtx; diff --git a/shared/source/helpers/CMakeLists.txt b/shared/source/helpers/CMakeLists.txt index acf8023a54..adfc25fd82 100644 --- a/shared/source/helpers/CMakeLists.txt +++ b/shared/source/helpers/CMakeLists.txt @@ -80,6 +80,7 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/preamble.h ${CMAKE_CURRENT_SOURCE_DIR}/preamble_base.inl ${CMAKE_CURRENT_SOURCE_DIR}/preamble_bdw_plus.inl + ${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.h ${CMAKE_CURRENT_SOURCE_DIR}/ptr_math.h ${CMAKE_CURRENT_SOURCE_DIR}/register_offsets.h ${CMAKE_CURRENT_SOURCE_DIR}/registered_method_dispatcher.h diff --git a/shared/source/helpers/debug_helpers.h b/shared/source/helpers/debug_helpers.h index 1ca2febc68..f3213c6b1f 100644 --- a/shared/source/helpers/debug_helpers.h +++ b/shared/source/helpers/debug_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,11 +7,11 @@ #pragma once #include "shared/source/helpers/abort.h" +#include "shared/source/helpers/preprocessor.h" -#define UNRECOVERABLE_IF(expression) \ - \ - if (expression) { \ - NEO::abortUnrecoverable(__LINE__, __FILE__); \ +#define UNRECOVERABLE_IF(expression) \ + if (expression) { \ + NEO::abortUnrecoverable(__LINE__, NEO_SOURCE_FILE_PATH); \ } #define UNREACHABLE(...) std::abort() diff --git a/shared/source/helpers/preprocessor.h b/shared/source/helpers/preprocessor.h new file mode 100644 index 0000000000..9e55b77ee6 --- /dev/null +++ b/shared/source/helpers/preprocessor.h @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#ifndef NEO_DISABLE_SOURCE_FILE_PATHS +#define NEO_SOURCE_FILE_PATH __FILE__ +#else +#define NEO_SOURCE_FILE_PATH "" +#endif