performance: Use 2MB heap for cl_buffers if possible

Related-To: NEO-16165

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-10-09 16:23:38 +00:00
committed by Compute-Runtime-Automation
parent 6515e422e9
commit 435c43d142
13 changed files with 40 additions and 57 deletions

View File

@@ -968,7 +968,7 @@ void Device::initializeRTMemoryBackedBuffer() {
AllocationProperties allocProps(getRootDeviceIndex(), true, size, AllocationType::buffer, true, getDeviceBitfield());
auto &productHelper = getProductHelper();
allocProps.flags.resource48Bit = productHelper.is48bResourceNeededForRayTracing();
allocProps.flags.isUSMDeviceAllocation = true;
allocProps.flags.isHostInaccessibleAllocation = true;
rtMemoryBackedBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(allocProps);
}
@@ -1174,7 +1174,7 @@ void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
AllocationProperties arrayAllocProps(getRootDeviceIndex(), true, dispatchGlobalsSize,
AllocationType::globalSurface, true, getDeviceBitfield());
arrayAllocProps.flags.resource48Bit = productHelper.is48bResourceNeededForRayTracing();
arrayAllocProps.flags.isUSMDeviceAllocation = true;
arrayAllocProps.flags.isHostInaccessibleAllocation = true;
dispatchGlobalsArrayAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(arrayAllocProps);
if (dispatchGlobalsArrayAllocation == nullptr) {
@@ -1189,7 +1189,7 @@ void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
AllocationProperties allocProps(getRootDeviceIndex(), true, rtStackSize, AllocationType::buffer, true, deviceBitfield);
allocProps.flags.resource48Bit = productHelper.is48bResourceNeededForRayTracing();
allocProps.flags.isUSMDeviceAllocation = true;
allocProps.flags.isHostInaccessibleAllocation = true;
auto rtStackAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(allocProps);

View File

@@ -24,7 +24,7 @@ struct AllocationProperties {
uint32_t shareable : 1;
uint32_t resource48Bit : 1;
uint32_t isUSMHostAllocation : 1;
uint32_t isUSMDeviceAllocation : 1;
uint32_t isHostInaccessibleAllocation : 1;
uint32_t use32BitFrontWindow : 1;
uint32_t forceSystemMemory : 1;
uint32_t preferCompressed : 1;
@@ -111,7 +111,7 @@ struct AllocationData {
uint32_t resource48Bit : 1;
uint32_t isUSMHostAllocation : 1;
uint32_t use32BitFrontWindow : 1;
uint32_t isUSMDeviceMemory : 1;
uint32_t isHostInaccessibleAllocation : 1;
uint32_t zeroMemory : 1;
uint32_t cantBeReadOnly : 1;
uint32_t shareableWithoutNTHandle : 1;

View File

@@ -643,7 +643,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
allocationData.makeGPUVaDifferentThanCPUPtr = properties.makeGPUVaDifferentThanCPUPtr;
allocationData.flags.shareable = properties.flags.shareable;
allocationData.flags.shareableWithoutNTHandle = properties.flags.shareableWithoutNTHandle;
allocationData.flags.isUSMDeviceMemory = properties.flags.isUSMDeviceAllocation;
allocationData.flags.isHostInaccessibleAllocation = properties.flags.isHostInaccessibleAllocation;
allocationData.flags.requiresCpuAccess = GraphicsAllocation::isCpuAccessRequired(properties.allocationType);
allocationData.flags.allocateMemory = properties.flags.allocateMemory;
allocationData.flags.allow32Bit = allow32Bit;
@@ -737,7 +737,7 @@ GraphicsAllocation *MemoryManager::allocatePhysicalGraphicsMemory(const Allocati
getAllocationData(allocationData, properties, nullptr, createStorageInfoFromProperties(properties));
AllocationStatus status = AllocationStatus::Error;
if (allocationData.flags.isUSMDeviceMemory) {
if (allocationData.flags.isHostInaccessibleAllocation) {
if (this->localMemorySupported[allocationData.rootDeviceIndex]) {
allocation = allocatePhysicalLocalDeviceMemory(allocationData, status);
if (allocation) {
@@ -850,7 +850,7 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &
UNRECOVERABLE_IF(allocationData.imgInfo == nullptr);
return allocateGraphicsMemoryForImage(allocationData);
}
if (allocationData.flags.shareable || allocationData.flags.isUSMDeviceMemory) {
if (allocationData.flags.shareable || allocationData.flags.isHostInaccessibleAllocation) {
return allocateMemoryByKMD(allocationData);
}
if (((false == allocationData.flags.isUSMHostAllocation) || (nullptr == allocationData.hostPtr)) &&

View File

@@ -448,7 +448,7 @@ void *SVMAllocsManager::createHostUnifiedMemoryAllocation(size_t size,
unifiedMemoryProperties.flags.preferCompressed = compressionEnabled;
unifiedMemoryProperties.flags.shareable = memoryProperties.allocationFlags.flags.shareable;
unifiedMemoryProperties.flags.isUSMHostAllocation = true;
unifiedMemoryProperties.flags.isUSMDeviceAllocation = false;
unifiedMemoryProperties.flags.isHostInaccessibleAllocation = false;
unifiedMemoryProperties.cacheRegion = MemoryPropertiesHelper::getCacheRegion(memoryProperties.allocationFlags);
if (this->usmHostAllocationsCache) {
@@ -509,7 +509,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
multiStorageAllocation,
deviceBitfield};
unifiedMemoryProperties.alignment = alignUpNonZero<size_t>(memoryProperties.alignment, pageSizeForAlignment);
unifiedMemoryProperties.flags.isUSMDeviceAllocation = false;
unifiedMemoryProperties.flags.isHostInaccessibleAllocation = false;
unifiedMemoryProperties.flags.shareable = memoryProperties.allocationFlags.flags.shareable;
unifiedMemoryProperties.flags.shareableWithoutNTHandle = memoryProperties.allocationFlags.flags.shareableWithoutNTHandle;
unifiedMemoryProperties.cacheRegion = MemoryPropertiesHelper::getCacheRegion(memoryProperties.allocationFlags);
@@ -519,7 +519,7 @@ void *SVMAllocsManager::createUnifiedMemoryAllocation(size_t size,
unifiedMemoryProperties.flags.resource48Bit = memoryProperties.allocationFlags.flags.resource48Bit;
if (memoryProperties.memoryType == InternalMemoryType::deviceUnifiedMemory) {
unifiedMemoryProperties.flags.isUSMDeviceAllocation = true;
unifiedMemoryProperties.flags.isHostInaccessibleAllocation = true;
if (this->usmDeviceAllocationsCache &&
false == memoryProperties.isInternalAllocation) {
void *allocationFromCache = this->usmDeviceAllocationsCache->get(size, memoryProperties);