mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
CacheSettingsHelper - heaps support
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d6eaab18b4
commit
abd90308f3
@@ -7,22 +7,44 @@
|
||||
|
||||
#include "shared/source/gmm_helper/cache_settings_helper.h"
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/memory_manager/allocation_type.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
namespace CacheSettingsHelper {
|
||||
GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached) {
|
||||
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getGmmUsageType(AllocationType allocationType, bool forceUncached) {
|
||||
if (forceUncached) {
|
||||
return (allocationType == AllocationType::PREEMPTION) ? GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC
|
||||
: GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED;
|
||||
return getDefaultUsageTypeWithCachingDisabled(allocationType);
|
||||
} else {
|
||||
return getDefaultUsageTypeWithCachingEnabled(allocationType);
|
||||
}
|
||||
|
||||
if (allocationType == AllocationType::IMAGE) {
|
||||
return GMM_RESOURCE_USAGE_OCL_IMAGE;
|
||||
}
|
||||
|
||||
return GMM_RESOURCE_USAGE_OCL_BUFFER;
|
||||
}
|
||||
} // namespace CacheSettingsHelper
|
||||
|
||||
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType) {
|
||||
switch (allocationType) {
|
||||
case AllocationType::IMAGE:
|
||||
return GMM_RESOURCE_USAGE_OCL_IMAGE;
|
||||
case AllocationType::INTERNAL_HEAP:
|
||||
case AllocationType::LINEAR_STREAM:
|
||||
if (DebugManager.flags.DisableCachingForHeaps.get()) {
|
||||
return getDefaultUsageTypeWithCachingDisabled(allocationType);
|
||||
}
|
||||
return GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER;
|
||||
default:
|
||||
return GMM_RESOURCE_USAGE_OCL_BUFFER;
|
||||
}
|
||||
}
|
||||
|
||||
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType) {
|
||||
switch (allocationType) {
|
||||
case AllocationType::PREEMPTION:
|
||||
return GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC;
|
||||
case AllocationType::INTERNAL_HEAP:
|
||||
case AllocationType::LINEAR_STREAM:
|
||||
return GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED;
|
||||
default:
|
||||
return GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -11,7 +11,11 @@
|
||||
namespace NEO {
|
||||
enum class AllocationType;
|
||||
|
||||
namespace CacheSettingsHelper {
|
||||
GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached);
|
||||
}
|
||||
struct CacheSettingsHelper {
|
||||
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached);
|
||||
|
||||
protected:
|
||||
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType);
|
||||
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType);
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/memory_compression_state.h"
|
||||
#include "shared/source/gmm_helper/cache_settings_helper.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
@@ -75,7 +76,10 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
|
||||
stateBaseAddress->setInstructionBaseAddress(instructionHeapBaseAddress);
|
||||
stateBaseAddress->setInstructionBufferSizeModifyEnable(true);
|
||||
stateBaseAddress->setInstructionBufferSize(MemoryConstants::sizeOf4GBinPageEntities);
|
||||
stateBaseAddress->setInstructionMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
|
||||
|
||||
auto resourceUsage = CacheSettingsHelper::getGmmUsageType(AllocationType::INTERNAL_HEAP, DebugManager.flags.DisableCachingForHeaps.get());
|
||||
|
||||
stateBaseAddress->setInstructionMemoryObjectControlState(gmmHelper->getMOCS(resourceUsage));
|
||||
}
|
||||
|
||||
if (setGeneralStateBaseAddress) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/command_stream/csr_definitions.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/gmm_helper/cache_settings_helper.h"
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/state_base_address_base.inl"
|
||||
@@ -52,20 +53,14 @@ void StateBaseAddressHelper<GfxFamily>::appendStateBaseAddressParameters(
|
||||
|
||||
stateBaseAddress->setBindlessSamplerStateBaseAddressModifyEnable(true);
|
||||
|
||||
auto l3CacheOnPolicy = GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER;
|
||||
auto l1L3CacheOnPolicy = GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC;
|
||||
auto heapResourceUsage = CacheSettingsHelper::getGmmUsageType(AllocationType::INTERNAL_HEAP, DebugManager.flags.DisableCachingForHeaps.get());
|
||||
auto heapMocsValue = gmmHelper->getMOCS(heapResourceUsage);
|
||||
|
||||
if (DebugManager.flags.DisableCachingForHeaps.get()) {
|
||||
l3CacheOnPolicy = GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED;
|
||||
l1L3CacheOnPolicy = GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED;
|
||||
stateBaseAddress->setInstructionMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED));
|
||||
}
|
||||
|
||||
stateBaseAddress->setSurfaceStateMemoryObjectControlState(gmmHelper->getMOCS(l3CacheOnPolicy));
|
||||
stateBaseAddress->setDynamicStateMemoryObjectControlState(gmmHelper->getMOCS(l3CacheOnPolicy));
|
||||
stateBaseAddress->setGeneralStateMemoryObjectControlState(gmmHelper->getMOCS(l3CacheOnPolicy));
|
||||
stateBaseAddress->setBindlessSurfaceStateMemoryObjectControlState(gmmHelper->getMOCS(l3CacheOnPolicy));
|
||||
stateBaseAddress->setBindlessSamplerStateMemoryObjectControlState(gmmHelper->getMOCS(l3CacheOnPolicy));
|
||||
stateBaseAddress->setSurfaceStateMemoryObjectControlState(heapMocsValue);
|
||||
stateBaseAddress->setDynamicStateMemoryObjectControlState(heapMocsValue);
|
||||
stateBaseAddress->setGeneralStateMemoryObjectControlState(heapMocsValue);
|
||||
stateBaseAddress->setBindlessSurfaceStateMemoryObjectControlState(heapMocsValue);
|
||||
stateBaseAddress->setBindlessSamplerStateMemoryObjectControlState(heapMocsValue);
|
||||
|
||||
bool enableMultiGpuAtomics = isMultiOsContextCapable;
|
||||
if (DebugManager.flags.EnableMultiGpuAtomicsOptimization.get()) {
|
||||
|
||||
Reference in New Issue
Block a user