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:
Chodor, Jaroslaw
2025-04-08 14:43:25 +00:00
committed by Compute-Runtime-Automation
parent 09c9b555f9
commit 72ae27d51e
8 changed files with 88 additions and 11 deletions

View File

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

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
namespace Ocloc {
const char *oclocRegPath = "";
}

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
namespace Ocloc {
extern const char *oclocRegPath;
} // namespace Ocloc

View File

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

View File

@@ -0,0 +1,10 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
namespace Ocloc {
const char *oclocRegPath = "Software\\Intel\\IGFX\\OCLOC\\";
}