Skip to content

Commit

Permalink
Add api specific config for allocation cache
Browse files Browse the repository at this point in the history
Currently disabled for both opencl and level zero

Related-To: NEO-6893

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
  • Loading branch information
ddabek-i authored and Compute-Runtime-Automation committed Sep 5, 2022
1 parent 09bb076 commit 1679846
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions level_zero/core/source/helpers/api_specific_config_l0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
}
}

bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
return false;
}

ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return ApiSpecificConfig::L0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions opencl/source/helpers/api_specific_config_ocl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
}
}

bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
return false;
}

ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return ApiSpecificConfig::OCL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion shared/source/debug_settings/debug_variables_base.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions shared/source/helpers/api_specific_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions shared/source/memory_manager/unified_memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
}
}

bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
return false;
}

ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
return apiTypeForUlts;
}
Expand Down
2 changes: 1 addition & 1 deletion shared/test/common/test_files/igdrcl.config
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ FailBuildProgramWithStatefulAccess = -1
ForceUncachedGmmUsageType = 0
OverrideDeviceName = unk
EnablePrivateBO = 0
ExperimentalEnableDeviceAllocationCache = 0
ExperimentalEnableDeviceAllocationCache = -1
OverrideL1CachePolicyInSurfaceStateAndStateless = -1
EnableBcsSwControlWa = -1
ExperimentalEnableL0DebuggerForOpenCL = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1679846

Please sign in to comment.