Optimizing binary size

Signed-off-by: Jaroslaw Chodor <jaroslaw.chodor@intel.com>
This commit is contained in:
Jaroslaw Chodor
2021-01-10 21:36:01 +01:00
committed by Compute-Runtime-Automation
parent 5c9d43e618
commit b0c915c61d
8 changed files with 56 additions and 18 deletions

View File

@ -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)

View File

@ -912,7 +912,7 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
WddmCommandStreamReceiver<FamilyType> wddmCsr(*pDevice->executionEnvironment, 0, 1);
auto wddmFromCsr = wddmCsr.peekWddm();
EXPECT_EQ(typeid(*wddmFromCsr), typeid(WddmMock));
EXPECT_NE(nullptr, wddmFromCsr);
}
struct WddmCsrCompressionTests : ::testing::Test {

View File

@ -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(Wddm::createWddm(std::move(hwDeviceIds[0]), rootDeviceEnvironment));
EXPECT_EQ(typeid(*wddm.get()), typeid(Wddm));
EXPECT_NE(nullptr, wddm);
}

View File

@ -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<DebugLevel>::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<dataType>(#variableName, flags.variableName.get(), defaultValue);
#define DECLARE_DEBUG_VARIABLE(dataType, variableName, defaultValue, description) \
settingsDumpFile << getNonReleaseKeyName(#variableName) << " = " << flags.variableName.get() << '\n'; \
dumpNonDefaultFlag<dataType>(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<dataType>(#variableName, flags.variableName.get(), defaultValue);
#include "release_variables.inl"
#undef DECLARE_DEBUG_VARIABLE
}
@ -84,15 +90,22 @@ void DebugSettingsManager<DebugLevel>::dumpFlags() const {
template <DebugFunctionalityLevel DebugLevel>
void DebugSettingsManager<DebugLevel>::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
}

View File

@ -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<SettingsReader> readerImpl;
std::mutex mtx;

View File

@ -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

View File

@ -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()

View File

@ -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