Add api specific config for allocation cache

Currently disabled for both opencl and level zero

Related-To: NEO-6893

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek 2022-09-05 13:17:18 +00:00 committed by Compute-Runtime-Automation
parent 09bb0766e2
commit 16798467ac
10 changed files with 40 additions and 4 deletions

View File

@ -31,6 +31,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
}
}
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
return false;
}
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return ApiSpecificConfig::L0;
}

View File

@ -41,6 +41,11 @@ TEST(ApiSpecificConfigL0Tests, givenMaxAllocSizeWhenGettingReducedMaxAllocSizeTh
TEST(ApiSpecificConfigL0Tests, WhenGettingRegistryPathThenL0RegistryPathIsReturned) {
EXPECT_STREQ(L0::registryPath, ApiSpecificConfig::getRegistryPath());
}
TEST(ApiSpecificConfigL0Tests, WhenCheckingIfDeviceAllocationCacheIsEnabledThenReturnFalse) {
EXPECT_FALSE(ApiSpecificConfig::isDeviceAllocationCacheEnabled());
}
TEST(ImplicitScalingApiTests, givenLevelZeroApiUsedThenSupportEnabled) {
EXPECT_TRUE(ImplicitScaling::apiSupport);
}

View File

@ -31,6 +31,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
}
}
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
return false;
}
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return ApiSpecificConfig::OCL;
}

View File

@ -44,6 +44,10 @@ TEST(ApiSpecificConfigOclTests, WhenGettingRegistryPathThenOclRegistryPathIsRetu
EXPECT_STREQ(oclRegPath, ApiSpecificConfig::getRegistryPath());
}
TEST(ApiSpecificConfigOclTests, WhenCheckingIfDeviceAllocationCacheIsEnabledThenReturnFalse) {
EXPECT_FALSE(ApiSpecificConfig::isDeviceAllocationCacheEnabled());
}
TEST(ApiSpecificConfigOclTests, givenEnableStatelessCompressionWhenProvidingSvmGpuAllocationThenPreferCompressedBuffer) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);

View File

@ -418,10 +418,10 @@ DECLARE_DEBUG_VARIABLE(int32_t, UsePipeControlAfterPartitionedWalker, -1, "-1: d
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalSetWalkerPartitionCount, 0, "Experimental implementation: Set number of COMPUTE_WALKERs for a given Partition Type, 0 - do not set the feature.")
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalSetWalkerPartitionType, -1, "Experimental implementation: Set COMPUTE_WALKER Partition Type. Valid values for types from 1 to 3")
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalEnableCustomLocalMemoryAlignment, 0, "Align local memory allocations to a given value. Works only with allocations at least as big as the value. 0: no effect, 2097152: 2 megabytes, 1073741824: 1 gigabyte")
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalEnableDeviceAllocationCache, -1, "Experimentally enable allocation cache.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableSourceLevelDebugger, false, "Experimentally enable source level debugger.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableL0DebuggerForOpenCL, false, "Experimentally enable debugging OCL with L0 Debug API.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableTileAttach, false, "Experimentally enable attaching to tiles (subdevices).")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableDeviceAllocationCache, false, "Experimentally enable allocation cache.")
/*DRIVER TOGGLES*/
DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger")

View File

@ -17,6 +17,7 @@ struct ApiSpecificConfig {
static bool isBcsSplitWaSupported();
static bool getHeapConfiguration();
static bool getBindlessConfiguration();
static bool isDeviceAllocationCacheEnabled();
static ApiType getApiType();
static std::string getName();
static uint64_t getReducedMaxAllocSize(uint64_t maxAllocSize);

View File

@ -9,6 +9,7 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/memory_properties_helpers.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/os_interface/hw_info_config.h"
@ -137,9 +138,12 @@ void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &co
SVMAllocsManager::SVMAllocsManager(MemoryManager *memoryManager, bool multiOsContextSupport)
: memoryManager(memoryManager), multiOsContextSupport(multiOsContextSupport) {
if (DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get()) {
this->usmDeviceAllocationsCacheEnabled = NEO::ApiSpecificConfig::isDeviceAllocationCacheEnabled();
if (DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get() != -1) {
this->usmDeviceAllocationsCacheEnabled = !!DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get();
}
if (this->usmDeviceAllocationsCacheEnabled) {
this->initUsmDeviceAllocationsCache();
this->usmDeviceAllocationsCacheEnabled = true;
}
}

View File

@ -27,6 +27,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
}
}
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
return false;
}
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return apiTypeForUlts;
}

View File

@ -441,7 +441,7 @@ FailBuildProgramWithStatefulAccess = -1
ForceUncachedGmmUsageType = 0
OverrideDeviceName = unk
EnablePrivateBO = 0
ExperimentalEnableDeviceAllocationCache = 0
ExperimentalEnableDeviceAllocationCache = -1
OverrideL1CachePolicyInSurfaceStateAndStateless = -1
EnableBcsSwControlWa = -1
ExperimentalEnableL0DebuggerForOpenCL = 0

View File

@ -16,6 +16,16 @@
using namespace NEO;
TEST(SvmDeviceAllocationCacheTest, givenAllocationCacheDefaultWhenCheckingIfEnabledThenItIsDisabled) {
std::unique_ptr<UltDeviceFactory> deviceFactory(new UltDeviceFactory(1, 1));
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
auto device = deviceFactory->rootDevices[0];
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
ASSERT_EQ(DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get(), -1);
EXPECT_FALSE(svmManager->usmDeviceAllocationsCacheEnabled);
}
struct SvmDeviceAllocationCacheSimpleTestDataType {
size_t allocationSize;
void *allocation;