mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
feature: Enabling debug variables reader in ocloc
This allows for using debug variables in ocloc with a few by-design limitations : * debug var needs to be prefixed with NEO_OCLOC_ (when setting-up at runtime as environment variable or using .config file) * debug var needs to be tagged with S_OCLOC scope (at compile time, in debug_variable .inl files) Related-To: NEO-14473 Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
09c9b555f9
commit
72ae27d51e
@@ -106,6 +106,7 @@ set(IGDRCL_SRCS_offline_compiler_tests
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/signal_utils.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/create_directory.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/debug_settings_reader_creator.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/test_excludes.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/virtual_file_system_listener.cpp
|
||||
${IGDRCL_SRCS_cloc}
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
#include "shared/source/compiler_interface/intermediate_representations.h"
|
||||
#include "shared/source/compiler_interface/oclc_extensions.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/debug_settings/debug_variables_helper.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_decoder.h"
|
||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
@@ -5631,4 +5633,20 @@ __kernel void CopyBuffer(__global unsigned int *src, __global unsigned int *dst)
|
||||
"-invalid_ocloc_option") != std::string::npos);
|
||||
EXPECT_FALSE(output.find("Building with ocloc options:") != std::string::npos);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
TEST(OclocApiSpecificConfigTests, givenOclocApiConfigThenOnlyOclocPrefixIsAllowed) {
|
||||
NEO::ApiSpecificConfig config;
|
||||
auto prefixStrings = config.getPrefixStrings();
|
||||
ASSERT_EQ(1U, prefixStrings.size());
|
||||
EXPECT_STREQ("NEO_OCLOC_", prefixStrings[0]);
|
||||
|
||||
auto prefixStringTypes = config.getPrefixTypes();
|
||||
ASSERT_EQ(1U, prefixStringTypes.size());
|
||||
EXPECT_EQ(DebugVarPrefix::neoOcloc, prefixStringTypes[0]);
|
||||
}
|
||||
|
||||
TEST(OclocApiSpecificConfigTests, givenOclocThenDebugKeysAreAllowedOnlyInDebug) {
|
||||
EXPECT_FALSE(NEO::isDebugKeysReadEnabled());
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -123,6 +123,10 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${OCLOC_DIRECTORY}/source/offline_compiler.cpp
|
||||
${OCLOC_DIRECTORY}/source/offline_compiler.h
|
||||
${OCLOC_DIRECTORY}/source/offline_compiler_helper.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/debug_settings/debug_settings_manager.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/utilities/debug_settings_reader.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/utilities/debug_file_reader.cpp
|
||||
${NEO_SOURCE_DIR}/shared/source/os_interface/debug_env_reader.cpp
|
||||
${OCLOC_DIRECTORY}/source/offline_compiler_options.cpp
|
||||
${OCLOC_DIRECTORY}/source/offline_linker.cpp
|
||||
${OCLOC_DIRECTORY}/source/offline_linker.h
|
||||
@@ -157,7 +161,9 @@ if(WIN32)
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/sys_calls.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/windows/directory.cpp
|
||||
${NEO_SHARED_DIRECTORY}/ail/windows${BRANCH_DIR_SUFFIX}/ail_ov_comp_wa_windows.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/debug_registry_reader.cpp
|
||||
${OCLOC_DIRECTORY}/source/windows/ocloc_supported_devices_helper_windows.cpp
|
||||
${OCLOC_DIRECTORY}/source/windows/ocloc_reg_path.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND CLOC_LIB_SRCS_LIB
|
||||
@@ -173,8 +179,10 @@ else()
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/sys_calls_linux.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/linux/directory.cpp
|
||||
${NEO_SHARED_DIRECTORY}/ail/linux/ail_ov_comp_wa_linux.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/settings_reader_create.cpp
|
||||
${OCLOC_DIRECTORY}/source/linux/os_library_ocloc_helper.cpp
|
||||
${OCLOC_DIRECTORY}/source/linux/ocloc_supported_devices_helper_linux.cpp
|
||||
${OCLOC_DIRECTORY}/source/linux/ocloc_reg_path.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -338,7 +346,9 @@ set(CLOC_LIB_SRCS
|
||||
${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/file_io_load.cpp
|
||||
)
|
||||
add_library(${OCLOC_NAME}_lib SHARED ${CLOC_LIB_SRCS})
|
||||
add_library(${OCLOC_NAME}_lib SHARED ${CLOC_LIB_SRCS}
|
||||
${NEO_SOURCE_DIR}/shared/source/utilities/debug_settings_reader_creator.cpp
|
||||
)
|
||||
add_subdirectories()
|
||||
|
||||
create_project_source_tree(${OCLOC_NAME}_lib)
|
||||
|
||||
10
shared/offline_compiler/source/linux/ocloc_reg_path.cpp
Normal file
10
shared/offline_compiler/source/linux/ocloc_reg_path.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Ocloc {
|
||||
const char *oclocRegPath = "";
|
||||
}
|
||||
11
shared/offline_compiler/source/ocloc_reg_path.h
Normal file
11
shared/offline_compiler/source/ocloc_reg_path.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
namespace Ocloc {
|
||||
extern const char *oclocRegPath;
|
||||
} // namespace Ocloc
|
||||
@@ -1,24 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/offline_compiler/source/ocloc_reg_path.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/utilities/debug_settings_reader_creator.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <DebugFunctionalityLevel debugLevel>
|
||||
DebugSettingsManager<debugLevel>::DebugSettingsManager(const char *registryPath) {
|
||||
StackVec<const char *, 4> validOclocPrefixes;
|
||||
StackVec<NEO::DebugVarPrefix, 4> validOclocPrefixTypes;
|
||||
|
||||
void translateDebugSettings(DebugVariables &debugVariables) {
|
||||
}
|
||||
|
||||
template <DebugFunctionalityLevel debugLevel>
|
||||
DebugSettingsManager<debugLevel>::~DebugSettingsManager() {
|
||||
readerImpl.reset();
|
||||
};
|
||||
void ApiSpecificConfig::initPrefixes() {
|
||||
validOclocPrefixes = {"NEO_OCLOC_"};
|
||||
validOclocPrefixTypes = {DebugVarPrefix::neoOcloc};
|
||||
}
|
||||
|
||||
// Global Debug Settings Manager
|
||||
DebugSettingsManager<globalDebugFunctionalityLevel> debugManager("");
|
||||
const StackVec<const char *, 4> &ApiSpecificConfig::getPrefixStrings() {
|
||||
return validOclocPrefixes;
|
||||
}
|
||||
|
||||
const StackVec<DebugVarPrefix, 4> &ApiSpecificConfig::getPrefixTypes() {
|
||||
return validOclocPrefixTypes;
|
||||
}
|
||||
|
||||
bool isDebugKeysReadEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugSettingsManager<globalDebugFunctionalityLevel> debugManager(Ocloc::oclocRegPath);
|
||||
} // namespace NEO
|
||||
|
||||
10
shared/offline_compiler/source/windows/ocloc_reg_path.cpp
Normal file
10
shared/offline_compiler/source/windows/ocloc_reg_path.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Ocloc {
|
||||
const char *oclocRegPath = "Software\\Intel\\IGFX\\OCLOC\\";
|
||||
}
|
||||
@@ -149,6 +149,7 @@ struct DebugVariables { // NOLINT(clang-analyzer
|
||||
#undef S_L0
|
||||
#undef S_OCL
|
||||
#undef S_NEO
|
||||
#undef S_NONE
|
||||
#undef DECLARE_DEBUG_SCOPED_V
|
||||
#undef DECLARE_DEBUG_VARIABLE
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user