mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
refactor: extract ApiSpecificConfig methods to separate cpp file
- split ult config and ApiSpecificConfig used in ULTs Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5a22477b83
commit
dc32e2b7da
@@ -15,6 +15,7 @@ link_libraries(${ASAN_LIBS} ${TSAN_LIBS})
|
|||||||
|
|
||||||
add_executable(neo_shared_tests
|
add_executable(neo_shared_tests
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/api_specific_config_ult.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_specific_config.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ult_specific_config.cpp
|
||||||
${NEO_SHARED_DIRECTORY}/helpers/allow_deferred_deleter.cpp
|
${NEO_SHARED_DIRECTORY}/helpers/allow_deferred_deleter.cpp
|
||||||
${NEO_SHARED_TEST_DIRECTORY}/common/common_main.cpp
|
${NEO_SHARED_TEST_DIRECTORY}/common/common_main.cpp
|
||||||
|
|||||||
80
shared/test/unit_test/api_specific_config_ult.cpp
Normal file
80
shared/test/unit_test/api_specific_config_ult.cpp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||||
|
#include "shared/source/helpers/api_specific_config.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
|
||||||
|
ApiSpecificConfig::ApiType apiTypeForUlts = ApiSpecificConfig::OCL;
|
||||||
|
bool isStatelessCompressionSupportedForUlts = true;
|
||||||
|
|
||||||
|
StackVec<const char *, 4> validUltL0Prefixes = {"NEO_L0_", "NEO_", ""};
|
||||||
|
StackVec<NEO::DebugVarPrefix, 4> validUltL0PrefixTypes = {DebugVarPrefix::Neo_L0, DebugVarPrefix::Neo, DebugVarPrefix::None};
|
||||||
|
StackVec<const char *, 4> validUltOclPrefixes = {"NEO_OCL_", "NEO_", ""};
|
||||||
|
StackVec<NEO::DebugVarPrefix, 4> validUltOclPrefixTypes = {DebugVarPrefix::Neo_Ocl, DebugVarPrefix::Neo, DebugVarPrefix::None};
|
||||||
|
|
||||||
|
bool ApiSpecificConfig::isStatelessCompressionSupported() {
|
||||||
|
return isStatelessCompressionSupportedForUlts;
|
||||||
|
}
|
||||||
|
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration() {
|
||||||
|
return DebugManager.flags.UseExternalAllocatorForSshAndDsh.get();
|
||||||
|
}
|
||||||
|
bool ApiSpecificConfig::getBindlessMode() {
|
||||||
|
if (DebugManager.flags.UseBindlessMode.get() != -1) {
|
||||||
|
return DebugManager.flags.UseBindlessMode.get();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ApiSpecificConfig::isDynamicPostSyncAllocLayoutEnabled() {
|
||||||
|
return (NEO::DebugManager.flags.EnableDynamicPostSyncAllocLayout.get() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
|
||||||
|
return apiTypeForUlts;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t ApiSpecificConfig::getReducedMaxAllocSize(uint64_t maxAllocSize) {
|
||||||
|
return maxAllocSize / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ApiSpecificConfig::getName() {
|
||||||
|
return "shared";
|
||||||
|
}
|
||||||
|
const char *ApiSpecificConfig::getRegistryPath() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApiSpecificConfig::initPrefixes() {
|
||||||
|
}
|
||||||
|
|
||||||
|
const StackVec<const char *, 4> &ApiSpecificConfig::getPrefixStrings() {
|
||||||
|
if (apiTypeForUlts == ApiSpecificConfig::L0) {
|
||||||
|
return validUltL0Prefixes;
|
||||||
|
} else {
|
||||||
|
return validUltOclPrefixes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const StackVec<DebugVarPrefix, 4> &ApiSpecificConfig::getPrefixTypes() {
|
||||||
|
if (apiTypeForUlts == ApiSpecificConfig::L0) {
|
||||||
|
return validUltL0PrefixTypes;
|
||||||
|
} else {
|
||||||
|
return validUltOclPrefixTypes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace NEO
|
||||||
@@ -25,10 +25,6 @@ bool apiSupport = false;
|
|||||||
} // namespace ImplicitScaling
|
} // namespace ImplicitScaling
|
||||||
|
|
||||||
const char *neoMockSettingsFileName = "neo_mock.config";
|
const char *neoMockSettingsFileName = "neo_mock.config";
|
||||||
StackVec<const char *, 4> validUltL0Prefixes = {"NEO_L0_", "NEO_", ""};
|
|
||||||
StackVec<NEO::DebugVarPrefix, 4> validUltL0PrefixTypes = {DebugVarPrefix::Neo_L0, DebugVarPrefix::Neo, DebugVarPrefix::None};
|
|
||||||
StackVec<const char *, 4> validUltOclPrefixes = {"NEO_OCL_", "NEO_", ""};
|
|
||||||
StackVec<NEO::DebugVarPrefix, 4> validUltOclPrefixTypes = {DebugVarPrefix::Neo_Ocl, DebugVarPrefix::Neo, DebugVarPrefix::None};
|
|
||||||
|
|
||||||
bool CompressionSelector::preferCompressedAllocation(const AllocationProperties &properties) {
|
bool CompressionSelector::preferCompressedAllocation(const AllocationProperties &properties) {
|
||||||
return false;
|
return false;
|
||||||
@@ -45,64 +41,6 @@ const char *getAdditionalBuiltinAsString(EBuiltInOps::Type builtin) { return nul
|
|||||||
void RootDeviceEnvironment::initApiGfxCoreHelper() {
|
void RootDeviceEnvironment::initApiGfxCoreHelper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiSpecificConfig::ApiType apiTypeForUlts = ApiSpecificConfig::OCL;
|
|
||||||
bool isStatelessCompressionSupportedForUlts = true;
|
|
||||||
|
|
||||||
bool ApiSpecificConfig::isStatelessCompressionSupported() {
|
|
||||||
return isStatelessCompressionSupportedForUlts;
|
|
||||||
}
|
|
||||||
bool ApiSpecificConfig::getGlobalBindlessHeapConfiguration() {
|
|
||||||
return DebugManager.flags.UseExternalAllocatorForSshAndDsh.get();
|
|
||||||
}
|
|
||||||
bool ApiSpecificConfig::getBindlessMode() {
|
|
||||||
if (DebugManager.flags.UseBindlessMode.get() != -1) {
|
|
||||||
return DebugManager.flags.UseBindlessMode.get();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ApiSpecificConfig::isDynamicPostSyncAllocLayoutEnabled() {
|
|
||||||
return (NEO::DebugManager.flags.EnableDynamicPostSyncAllocLayout.get() == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
|
|
||||||
return apiTypeForUlts;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t ApiSpecificConfig::getReducedMaxAllocSize(uint64_t maxAllocSize) {
|
|
||||||
return maxAllocSize / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ApiSpecificConfig::getName() {
|
|
||||||
return "shared";
|
|
||||||
}
|
|
||||||
const char *ApiSpecificConfig::getRegistryPath() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
void ApiSpecificConfig::initPrefixes() {
|
|
||||||
}
|
|
||||||
|
|
||||||
const StackVec<const char *, 4> &ApiSpecificConfig::getPrefixStrings() {
|
|
||||||
if (apiTypeForUlts == ApiSpecificConfig::L0) {
|
|
||||||
return validUltL0Prefixes;
|
|
||||||
} else {
|
|
||||||
return validUltOclPrefixes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const StackVec<DebugVarPrefix, 4> &ApiSpecificConfig::getPrefixTypes() {
|
|
||||||
if (apiTypeForUlts == ApiSpecificConfig::L0) {
|
|
||||||
return validUltL0PrefixTypes;
|
|
||||||
} else {
|
|
||||||
return validUltOclPrefixTypes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|||||||
Reference in New Issue
Block a user