mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Fix OCL specific registry path in a core dir
Change-Id: I5b7792582e6c77a29ffb42b8fe024bc826ae1867 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
712313a3be
commit
86edfea3bf
@ -9,13 +9,10 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
SettingsReader *SettingsReader::createOsReader(bool userScope) {
|
||||
SettingsReader *SettingsReader::createOsReader(bool userScope, const std::string ®Key) {
|
||||
return new EnvironmentVariableReader;
|
||||
}
|
||||
|
||||
SettingsReader *SettingsReader::createOsReader(const std::string ®Key) {
|
||||
return new EnvironmentVariableReader;
|
||||
}
|
||||
const char *EnvironmentVariableReader::appSpecificLocation(const std::string &name) {
|
||||
return name.c_str();
|
||||
}
|
||||
|
@ -15,20 +15,15 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
SettingsReader *SettingsReader::createOsReader(bool userScope) {
|
||||
return new RegistryReader(userScope);
|
||||
}
|
||||
SettingsReader *SettingsReader::createOsReader(const std::string ®Key) {
|
||||
return new RegistryReader("Software\\Intel\\IGFX\\OCL\\" + regKey);
|
||||
SettingsReader *SettingsReader::createOsReader(bool userScope, const std::string ®Key) {
|
||||
return new RegistryReader(userScope, regKey);
|
||||
}
|
||||
|
||||
RegistryReader::RegistryReader(bool userScope) {
|
||||
RegistryReader::RegistryReader(bool userScope, const std::string ®Key) : registryReadRootKey(regKey) {
|
||||
igdrclHkeyType = userScope ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
|
||||
setUpProcessName();
|
||||
}
|
||||
RegistryReader::RegistryReader(const std::string ®Key) : registryReadRootKey(regKey) {
|
||||
setUpProcessName();
|
||||
}
|
||||
|
||||
void RegistryReader::setUpProcessName() {
|
||||
char buff[MAX_PATH];
|
||||
GetModuleFileNameA(nullptr, buff, MAX_PATH);
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "core/utilities/debug_settings_reader.h"
|
||||
|
||||
#include "os_inc.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#include <stdint.h>
|
||||
@ -18,16 +17,16 @@
|
||||
namespace NEO {
|
||||
class RegistryReader : public SettingsReader {
|
||||
public:
|
||||
RegistryReader() = delete;
|
||||
RegistryReader(bool userScope, const std::string ®Key);
|
||||
int32_t getSetting(const char *settingName, int32_t defaultValue) override;
|
||||
bool getSetting(const char *settingName, bool defaultValue) override;
|
||||
std::string getSetting(const char *settingName, const std::string &value) override;
|
||||
RegistryReader(bool userScope);
|
||||
RegistryReader(const std::string ®Key);
|
||||
const char *appSpecificLocation(const std::string &name) override;
|
||||
|
||||
protected:
|
||||
HKEY igdrclHkeyType = HKEY_LOCAL_MACHINE;
|
||||
std::string registryReadRootKey = "Software\\Intel\\IGFX\\OCL";
|
||||
HKEY igdrclHkeyType;
|
||||
std::string registryReadRootKey;
|
||||
void setUpProcessName();
|
||||
std::string processName;
|
||||
};
|
||||
|
@ -15,15 +15,14 @@ namespace NEO {
|
||||
class SettingsReader {
|
||||
public:
|
||||
virtual ~SettingsReader() {}
|
||||
static SettingsReader *create() {
|
||||
static SettingsReader *create(const std::string ®Key) {
|
||||
SettingsReader *readerImpl = createFileReader();
|
||||
if (readerImpl != nullptr)
|
||||
return readerImpl;
|
||||
|
||||
return createOsReader(false);
|
||||
return createOsReader(false, regKey);
|
||||
}
|
||||
static SettingsReader *createOsReader(bool userScope);
|
||||
static SettingsReader *createOsReader(const std::string ®Key);
|
||||
static SettingsReader *createOsReader(bool userScope, const std::string ®Key);
|
||||
static SettingsReader *createFileReader();
|
||||
virtual int32_t getSetting(const char *settingName, int32_t defaultValue) = 0;
|
||||
virtual bool getSetting(const char *settingName, bool defaultValue) = 0;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "core/utilities/debug_settings_reader_creator.h"
|
||||
|
||||
namespace NEO {
|
||||
std::unique_ptr<SettingsReader> SettingsReaderCreator::create() {
|
||||
return std::unique_ptr<SettingsReader>(SettingsReader::create());
|
||||
std::unique_ptr<SettingsReader> SettingsReaderCreator::create(const std::string ®Key) {
|
||||
return std::unique_ptr<SettingsReader>(SettingsReader::create(regKey));
|
||||
}
|
||||
}; // namespace NEO
|
||||
|
@ -14,6 +14,6 @@
|
||||
namespace NEO {
|
||||
class SettingsReaderCreator {
|
||||
public:
|
||||
static std::unique_ptr<SettingsReader> create();
|
||||
static std::unique_ptr<SettingsReader> create(const std::string ®Key);
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -10,12 +10,13 @@
|
||||
#include "core/utilities/debug_settings_reader.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/kernel/kernel.h"
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
AubSubCaptureManager::AubSubCaptureManager(const std::string &fileName, AubSubCaptureCommon &subCaptureCommon)
|
||||
: initialFileName(fileName), subCaptureCommon(subCaptureCommon) {
|
||||
settingsReader.reset(SettingsReader::createOsReader(true));
|
||||
settingsReader.reset(SettingsReader::createOsReader(true, oclRegPath));
|
||||
}
|
||||
|
||||
AubSubCaptureManager::~AubSubCaptureManager() = default;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <runtime/helpers/file_io.h>
|
||||
#include <runtime/helpers/hash.h>
|
||||
#include <runtime/helpers/hw_info.h>
|
||||
#include <runtime/os_interface/ocl_reg_path.h>
|
||||
#include <runtime/os_interface/os_inc_base.h>
|
||||
#include <runtime/program/program.h>
|
||||
|
||||
@ -53,8 +54,9 @@ const std::string BinaryCache::getCachedFileName(const HardwareInfo &hwInfo, con
|
||||
}
|
||||
|
||||
BinaryCache::BinaryCache() {
|
||||
std::string keyName = "cl_cache_dir";
|
||||
std::unique_ptr<SettingsReader> settingsReader(SettingsReader::createOsReader(keyName));
|
||||
std::string keyName = oclRegPath;
|
||||
keyName += "cl_cache_dir";
|
||||
std::unique_ptr<SettingsReader> settingsReader(SettingsReader::createOsReader(false, keyName));
|
||||
clCacheLocation = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast<std::string>(CL_CACHE_LOCATION));
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_bdw_plus.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/metrics_library.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/metrics_library.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_inc_base.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_interface.h
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "runtime/kernel/kernel.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/os_interface/definitions/translate_debug_settings.h"
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
|
||||
@ -37,7 +38,7 @@ DebugSettingsManager<DebugLevel>::DebugSettingsManager() {
|
||||
|
||||
logFileName = "igdrcl.log";
|
||||
if (registryReadAvailable()) {
|
||||
readerImpl = SettingsReaderCreator::create();
|
||||
readerImpl = SettingsReaderCreator::create(oclRegPath);
|
||||
injectSettingsFromReader();
|
||||
dumpFlags();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h
|
||||
|
12
runtime/os_interface/linux/ocl_reg_path.cpp
Normal file
12
runtime/os_interface/linux/ocl_reg_path.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
|
||||
namespace NEO {
|
||||
const char *oclRegPath = "";
|
||||
}
|
11
runtime/os_interface/ocl_reg_path.h
Normal file
11
runtime/os_interface/ocl_reg_path.h
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
namespace NEO {
|
||||
extern const char *oclRegPath;
|
||||
} // namespace NEO
|
@ -27,6 +27,7 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener${KMDAF_FILE_SUFFIX}.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_win.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h
|
||||
|
@ -24,7 +24,7 @@ DriverInfo *DriverInfo::create(OSInterface *osInterface) {
|
||||
auto result = new DriverInfoWindows();
|
||||
path = result->trimRegistryKey(path);
|
||||
|
||||
result->setRegistryReader(new RegistryReader(path));
|
||||
result->setRegistryReader(new RegistryReader(false, path));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
12
runtime/os_interface/windows/ocl_reg_path.cpp
Normal file
12
runtime/os_interface/windows/ocl_reg_path.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
|
||||
namespace NEO {
|
||||
const char *oclRegPath = "Software\\Intel\\IGFX\\OCL\\";
|
||||
}
|
@ -49,7 +49,7 @@ Wddm::Wddm() {
|
||||
memset(gtSystemInfo.get(), 0, sizeof(*gtSystemInfo));
|
||||
memset(gfxPlatform.get(), 0, sizeof(*gfxPlatform));
|
||||
|
||||
registryReader.reset(new RegistryReader("System\\CurrentControlSet\\Control\\GraphicsDrivers\\Scheduler"));
|
||||
registryReader.reset(new RegistryReader(false, "System\\CurrentControlSet\\Control\\GraphicsDrivers\\Scheduler"));
|
||||
adapterLuid.HighPart = 0;
|
||||
adapterLuid.LowPart = 0;
|
||||
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
#include "unit_tests/custom_event_listener.h"
|
||||
#include "unit_tests/mocks/mock_gmm.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
@ -275,7 +276,7 @@ int main(int argc, char **argv) {
|
||||
generateRandomInput = true;
|
||||
} else if (!strcmp("--read-config", argv[i]) && testMode == TestMode::AubTests) {
|
||||
if (DebugManager.registryReadAvailable()) {
|
||||
DebugManager.setReaderImpl(SettingsReader::create());
|
||||
DebugManager.setReaderImpl(SettingsReader::create(oclRegPath));
|
||||
DebugManager.injectSettingsFromReader();
|
||||
}
|
||||
} else if (!strcmp("--dump_buffer_format", argv[i]) && testMode == TestMode::AubTests) {
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "core/utilities/debug_file_reader.h"
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
#include "unit_tests/fixtures/buffer_fixture.h"
|
||||
#include "unit_tests/fixtures/image_fixture.h"
|
||||
#include "unit_tests/mocks/mock_buffer.h"
|
||||
@ -42,7 +43,7 @@ TEST(DebugSettingsManager, WithDebugFunctionalityCreatesAndDumpsToLogFile) {
|
||||
|
||||
FullyEnabledTestDebugManager debugManager;
|
||||
if (debugManager.registryReadAvailable()) {
|
||||
debugManager.setReaderImpl(SettingsReader::create());
|
||||
debugManager.setReaderImpl(SettingsReader::create(oclRegPath));
|
||||
debugManager.injectSettingsFromReader();
|
||||
}
|
||||
debugManager.logApiCall("searchString", true, 0);
|
||||
@ -850,16 +851,16 @@ TEST(DebugSettingsManager, givenStringDebugVariableWhenLongValueExeedingSmallStr
|
||||
|
||||
TEST(DebugSettingsManager, givenNullAsReaderImplInDebugManagerWhenSettingReaderImplThenItsSetProperly) {
|
||||
FullyDisabledTestDebugManager debugManager;
|
||||
auto readerImpl = SettingsReader::create();
|
||||
auto readerImpl = SettingsReader::create(oclRegPath);
|
||||
debugManager.setReaderImpl(readerImpl);
|
||||
EXPECT_EQ(readerImpl, debugManager.getReaderImpl());
|
||||
}
|
||||
TEST(DebugSettingsManager, givenReaderImplInDebugManagerWhenSettingDifferentReaderImplThenItsSetProperly) {
|
||||
FullyDisabledTestDebugManager debugManager;
|
||||
auto readerImpl = SettingsReader::create();
|
||||
auto readerImpl = SettingsReader::create(oclRegPath);
|
||||
debugManager.setReaderImpl(readerImpl);
|
||||
|
||||
auto readerImpl2 = SettingsReader::create();
|
||||
auto readerImpl2 = SettingsReader::create(oclRegPath);
|
||||
debugManager.setReaderImpl(readerImpl2);
|
||||
EXPECT_EQ(readerImpl2, debugManager.getReaderImpl());
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace NEO {
|
||||
class DebugEnvReaderTests : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
evr = SettingsReader::createOsReader(false);
|
||||
evr = SettingsReader::createOsReader(false, "");
|
||||
EXPECT_NE(nullptr, evr);
|
||||
}
|
||||
void TearDown() override {
|
||||
@ -79,7 +79,7 @@ TEST_F(DebugEnvReaderTests, appSpecificLacationReturnClCacheLocation) {
|
||||
}
|
||||
|
||||
TEST_F(DebugEnvReaderTests, givenEnvironmentVariableReaderWhenCreateOsReaderWithStringThenNotNullPointer) {
|
||||
std::unique_ptr<SettingsReader> evr(SettingsReader::createOsReader(""));
|
||||
std::unique_ptr<SettingsReader> evr(SettingsReader::createOsReader(false, ""));
|
||||
EXPECT_NE(nullptr, evr);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -6,12 +6,13 @@
|
||||
*/
|
||||
|
||||
#include "core/os_interface/windows/debug_registry_reader.h"
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
|
||||
namespace NEO {
|
||||
class TestedRegistryReader : public RegistryReader {
|
||||
public:
|
||||
TestedRegistryReader(bool userScope) : RegistryReader(userScope){};
|
||||
TestedRegistryReader(std::string regKey) : RegistryReader(regKey){};
|
||||
TestedRegistryReader(bool userScope) : RegistryReader(userScope, oclRegPath){};
|
||||
TestedRegistryReader(std::string regKey) : RegistryReader(false, regKey){};
|
||||
HKEY getHkeyType() const {
|
||||
return igdrclHkeyType;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "core/utilities/debug_settings_reader_creator.h"
|
||||
|
||||
namespace NEO {
|
||||
std::unique_ptr<SettingsReader> SettingsReaderCreator::create() {
|
||||
return std::unique_ptr<SettingsReader>(SettingsReader::createOsReader(false));
|
||||
std::unique_ptr<SettingsReader> SettingsReaderCreator::create(const std::string ®Key) {
|
||||
return std::unique_ptr<SettingsReader>(SettingsReader::createOsReader(false, regKey));
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "core/utilities/debug_settings_reader.h"
|
||||
#include "runtime/helpers/file_io.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/ocl_reg_path.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@ -19,7 +20,7 @@ using namespace NEO;
|
||||
using namespace std;
|
||||
|
||||
TEST(SettingsReader, Create) {
|
||||
SettingsReader *reader = SettingsReader::create();
|
||||
SettingsReader *reader = SettingsReader::create(oclRegPath);
|
||||
EXPECT_NE(nullptr, reader);
|
||||
delete reader;
|
||||
}
|
||||
@ -40,14 +41,14 @@ TEST(SettingsReader, CreateFileReader) {
|
||||
}
|
||||
|
||||
TEST(SettingsReader, CreateOsReader) {
|
||||
SettingsReader *reader = SettingsReader::createOsReader(false);
|
||||
SettingsReader *reader = SettingsReader::createOsReader(false, oclRegPath);
|
||||
EXPECT_NE(nullptr, reader);
|
||||
delete reader;
|
||||
}
|
||||
|
||||
TEST(SettingsReader, CreateOsReaderWithRegKey) {
|
||||
std::string regKey = "Software\\Intel\\OpenCL";
|
||||
unique_ptr<SettingsReader> reader(SettingsReader::createOsReader(regKey));
|
||||
std::string regKey = oclRegPath;
|
||||
unique_ptr<SettingsReader> reader(SettingsReader::createOsReader(false, regKey));
|
||||
EXPECT_NE(nullptr, reader);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user