2019-11-18 15:12:22 +01:00
|
|
|
/*
|
2024-01-03 07:44:52 +00:00
|
|
|
* Copyright (C) 2019-2024 Intel Corporation
|
2019-11-18 15:12:22 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_container/cmdcontainer.h"
|
2019-11-18 15:12:22 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
|
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
|
|
|
|
#include "shared/source/device/device.h"
|
2023-10-18 18:37:50 +00:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
|
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-12-04 11:28:18 +00:00
|
|
|
#include "shared/source/helpers/api_specific_config.h"
|
2023-06-05 16:53:29 +00:00
|
|
|
#include "shared/source/helpers/bindless_heaps_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/debug_helpers.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/heap_helper.h"
|
2023-02-06 09:05:43 +00:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2022-05-17 19:04:23 +00:00
|
|
|
#include "shared/source/helpers/string.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2022-12-06 11:19:36 +00:00
|
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
2021-12-13 08:48:59 +00:00
|
|
|
#include "shared/source/memory_manager/allocations_list.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
2023-01-10 17:16:08 +00:00
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2019-11-18 15:12:22 +01:00
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
|
|
CommandContainer::~CommandContainer() {
|
|
|
|
|
if (!device) {
|
|
|
|
|
DEBUG_BREAK_IF(device);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 08:48:59 +00:00
|
|
|
this->handleCmdBufferAllocations(0u);
|
2019-11-18 15:12:22 +01:00
|
|
|
|
|
|
|
|
for (auto allocationIndirectHeap : allocationIndirectHeaps) {
|
2020-10-20 19:04:58 +05:30
|
|
|
if (heapHelper) {
|
|
|
|
|
heapHelper->storeHeapAllocation(allocationIndirectHeap);
|
|
|
|
|
}
|
2019-11-18 15:12:22 +01:00
|
|
|
}
|
2020-01-17 08:56:05 +01:00
|
|
|
for (auto deallocation : deallocationContainer) {
|
2023-12-11 14:24:36 +00:00
|
|
|
if (((deallocation->getAllocationType() == AllocationType::internalHeap) || (deallocation->getAllocationType() == AllocationType::linearStream))) {
|
2020-01-17 08:56:05 +01:00
|
|
|
getHeapHelper()->storeHeapAllocation(deallocation);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-18 15:12:22 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-26 10:59:30 +00:00
|
|
|
CommandContainer::CommandContainer() {
|
|
|
|
|
for (auto &indirectHeap : indirectHeaps) {
|
|
|
|
|
indirectHeap = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto &allocationIndirectHeap : allocationIndirectHeaps) {
|
|
|
|
|
allocationIndirectHeap = nullptr;
|
|
|
|
|
}
|
2022-04-06 13:59:23 +00:00
|
|
|
|
|
|
|
|
residencyContainer.reserve(startingResidencyContainerSize);
|
2022-09-19 16:21:08 +00:00
|
|
|
|
2023-11-30 08:32:25 +00:00
|
|
|
if (debugManager.flags.RemoveUserFenceInCmdlistResetAndDestroy.get() != -1) {
|
|
|
|
|
isHandleFenceCompletionRequired = !static_cast<bool>(debugManager.flags.RemoveUserFenceInCmdlistResetAndDestroy.get());
|
2022-09-19 16:21:08 +00:00
|
|
|
}
|
2022-01-26 10:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CommandContainer::CommandContainer(uint32_t maxNumAggregatedIdds) : CommandContainer() {
|
|
|
|
|
numIddsPerBlock = maxNumAggregatedIdds;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-16 00:12:49 +00:00
|
|
|
CommandContainer::ErrorCode CommandContainer::initialize(Device *device, AllocationsList *reusableAllocationList, size_t defaultSshSize, bool requireHeaps, bool createSecondaryCmdBufferInHostMem) {
|
2019-11-18 15:12:22 +01:00
|
|
|
this->device = device;
|
2021-12-13 08:48:59 +00:00
|
|
|
this->reusableAllocationList = reusableAllocationList;
|
2023-03-15 18:38:50 +00:00
|
|
|
size_t usableSize = getMaxUsableSpace();
|
2023-03-16 00:12:49 +00:00
|
|
|
this->defaultSshSize = HeapSize::defaultHeapSize;
|
|
|
|
|
if (this->stateBaseAddressTracking) {
|
|
|
|
|
this->defaultSshSize = defaultSshSize;
|
|
|
|
|
}
|
2021-12-13 08:48:59 +00:00
|
|
|
|
2023-10-18 18:37:50 +00:00
|
|
|
globalBindlessHeapsEnabled = this->device->getExecutionEnvironment()->rootDeviceEnvironments[this->device->getRootDeviceIndex()]->getBindlessHeapsHelper() != nullptr;
|
|
|
|
|
|
2021-12-13 08:48:59 +00:00
|
|
|
auto cmdBufferAllocation = this->obtainNextCommandBufferAllocation();
|
|
|
|
|
|
2020-09-03 17:45:25 +05:30
|
|
|
if (!cmdBufferAllocation) {
|
2023-12-12 11:37:31 +00:00
|
|
|
return ErrorCode::outOfDeviceMemory;
|
2020-09-03 17:45:25 +05:30
|
|
|
}
|
2019-11-18 15:12:22 +01:00
|
|
|
|
2020-01-16 17:58:36 +01:00
|
|
|
cmdBufferAllocations.push_back(cmdBufferAllocation);
|
|
|
|
|
|
2022-12-09 15:11:27 +00:00
|
|
|
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
2023-04-05 13:21:45 +00:00
|
|
|
if (this->usingPrimaryBuffer) {
|
|
|
|
|
this->selectedBbCmdSize = gfxCoreHelper.getBatchBufferStartSize();
|
|
|
|
|
} else {
|
|
|
|
|
this->selectedBbCmdSize = gfxCoreHelper.getBatchBufferEndSize();
|
|
|
|
|
this->bbEndReference = gfxCoreHelper.getBatchBufferEndReference();
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 19:34:37 +00:00
|
|
|
CommandContainer *cmdcontainer = this;
|
|
|
|
|
if (this->immediateCmdListCsr) {
|
|
|
|
|
cmdcontainer = nullptr;
|
|
|
|
|
}
|
2022-01-12 16:57:42 +00:00
|
|
|
commandStream = std::make_unique<LinearStream>(cmdBufferAllocation->getUnderlyingBuffer(),
|
2023-06-27 19:34:37 +00:00
|
|
|
usableSize, cmdcontainer, this->selectedBbCmdSize);
|
2022-01-26 10:59:30 +00:00
|
|
|
|
2019-11-18 15:12:22 +01:00
|
|
|
commandStream->replaceGraphicsAllocation(cmdBufferAllocation);
|
|
|
|
|
|
2023-02-22 07:29:42 +00:00
|
|
|
if (createSecondaryCmdBufferInHostMem) {
|
|
|
|
|
this->useSecondaryCommandStream = true;
|
|
|
|
|
|
|
|
|
|
auto cmdBufferAllocationHost = this->obtainNextCommandBufferAllocation(true);
|
|
|
|
|
if (!cmdBufferAllocationHost) {
|
2023-12-12 11:37:31 +00:00
|
|
|
return ErrorCode::outOfDeviceMemory;
|
2023-02-22 07:29:42 +00:00
|
|
|
}
|
|
|
|
|
secondaryCommandStreamForImmediateCmdList = std::make_unique<LinearStream>(cmdBufferAllocationHost->getUnderlyingBuffer(),
|
2023-04-05 13:21:45 +00:00
|
|
|
usableSize, this, this->selectedBbCmdSize);
|
2023-02-22 07:29:42 +00:00
|
|
|
secondaryCommandStreamForImmediateCmdList->replaceGraphicsAllocation(cmdBufferAllocationHost);
|
|
|
|
|
cmdBufferAllocations.push_back(cmdBufferAllocationHost);
|
2023-03-15 13:01:41 +00:00
|
|
|
addToResidencyContainer(cmdBufferAllocationHost);
|
2023-02-22 07:29:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-15 13:01:41 +00:00
|
|
|
addToResidencyContainer(cmdBufferAllocation);
|
2022-03-24 17:19:42 +00:00
|
|
|
if (requireHeaps) {
|
|
|
|
|
heapHelper = std::unique_ptr<HeapHelper>(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u));
|
|
|
|
|
|
2023-12-13 16:09:52 +00:00
|
|
|
for (uint32_t i = 0; i < IndirectHeap::Type::numTypes; i++) {
|
2023-04-06 00:17:17 +00:00
|
|
|
auto heapType = static_cast<HeapType>(i);
|
|
|
|
|
if (skipHeapAllocationCreation(heapType)) {
|
2022-09-26 22:28:10 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2023-03-06 20:33:50 +00:00
|
|
|
|
2023-04-06 00:17:17 +00:00
|
|
|
size_t heapSize = getHeapSize(heapType);
|
2023-06-05 16:53:29 +00:00
|
|
|
|
2022-03-24 17:19:42 +00:00
|
|
|
allocationIndirectHeaps[i] = heapHelper->getHeapAllocation(i,
|
|
|
|
|
heapSize,
|
2023-03-16 00:12:49 +00:00
|
|
|
defaultHeapAllocationAlignment,
|
2022-03-24 17:19:42 +00:00
|
|
|
device->getRootDeviceIndex());
|
2023-06-05 16:53:29 +00:00
|
|
|
|
2022-03-24 17:19:42 +00:00
|
|
|
if (!allocationIndirectHeaps[i]) {
|
2023-12-12 11:37:31 +00:00
|
|
|
return ErrorCode::outOfDeviceMemory;
|
2022-03-24 17:19:42 +00:00
|
|
|
}
|
|
|
|
|
residencyContainer.push_back(allocationIndirectHeaps[i]);
|
|
|
|
|
|
2023-03-10 15:47:23 +00:00
|
|
|
bool requireInternalHeap = false;
|
2023-12-13 16:09:52 +00:00
|
|
|
if (IndirectHeap::Type::indirectObject == heapType) {
|
2023-03-10 15:47:23 +00:00
|
|
|
requireInternalHeap = true;
|
|
|
|
|
indirectHeapInLocalMemory = allocationIndirectHeaps[i]->isAllocatedInLocalMemoryPool();
|
|
|
|
|
}
|
2022-03-24 17:19:42 +00:00
|
|
|
indirectHeaps[i] = std::make_unique<IndirectHeap>(allocationIndirectHeaps[i], requireInternalHeap);
|
2023-12-13 16:09:52 +00:00
|
|
|
if (IndirectHeap::Type::surfaceState == heapType) {
|
2022-03-24 17:19:42 +00:00
|
|
|
indirectHeaps[i]->getSpace(reservedSshSize);
|
|
|
|
|
}
|
2020-12-04 11:28:18 +00:00
|
|
|
}
|
2019-11-18 15:12:22 +01:00
|
|
|
|
2023-03-10 15:47:23 +00:00
|
|
|
indirectObjectHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), indirectHeapInLocalMemory);
|
2020-09-22 15:48:24 +02:00
|
|
|
|
2022-03-24 17:19:42 +00:00
|
|
|
instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), device->getMemoryManager()->isLocalMemoryUsedForIsa(device->getRootDeviceIndex()));
|
2019-11-18 15:12:22 +01:00
|
|
|
|
2022-03-24 17:19:42 +00:00
|
|
|
iddBlock = nullptr;
|
|
|
|
|
nextIddInBlock = this->getNumIddPerBlock();
|
|
|
|
|
}
|
2023-12-12 11:37:31 +00:00
|
|
|
return ErrorCode::success;
|
2019-11-18 15:12:22 +01:00
|
|
|
}
|
|
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
void CommandContainer::addToResidencyContainer(GraphicsAllocation *alloc) {
|
2019-11-18 15:12:22 +01:00
|
|
|
if (alloc == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->residencyContainer.push_back(alloc);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-22 07:29:42 +00:00
|
|
|
bool CommandContainer::swapStreams() {
|
|
|
|
|
if (this->useSecondaryCommandStream) {
|
|
|
|
|
this->commandStream.swap(this->secondaryCommandStreamForImmediateCmdList);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-12 16:33:22 -07:00
|
|
|
void CommandContainer::removeDuplicatesFromResidencyContainer() {
|
|
|
|
|
std::sort(this->residencyContainer.begin(), this->residencyContainer.end());
|
|
|
|
|
this->residencyContainer.erase(std::unique(this->residencyContainer.begin(), this->residencyContainer.end()), this->residencyContainer.end());
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-18 15:12:22 +01:00
|
|
|
void CommandContainer::reset() {
|
2019-12-02 15:02:51 +01:00
|
|
|
setDirtyStateForAllHeaps(true);
|
2019-11-18 15:12:22 +01:00
|
|
|
slmSize = std::numeric_limits<uint32_t>::max();
|
|
|
|
|
getResidencyContainer().clear();
|
|
|
|
|
getDeallocationContainer().clear();
|
2020-10-09 11:52:12 +02:00
|
|
|
sshAllocations.clear();
|
2019-11-18 15:12:22 +01:00
|
|
|
|
2021-12-13 08:48:59 +00:00
|
|
|
this->handleCmdBufferAllocations(1u);
|
2020-01-16 17:58:36 +01:00
|
|
|
cmdBufferAllocations.erase(cmdBufferAllocations.begin() + 1, cmdBufferAllocations.end());
|
|
|
|
|
|
2023-03-15 18:38:50 +00:00
|
|
|
setCmdBuffer(cmdBufferAllocations[0]);
|
2019-11-18 15:12:22 +01:00
|
|
|
|
2023-12-13 16:09:52 +00:00
|
|
|
for (uint32_t i = 0; i < IndirectHeap::Type::numTypes; i++) {
|
2023-03-14 21:22:30 +00:00
|
|
|
if (indirectHeaps[i] != nullptr) {
|
2023-12-13 16:09:52 +00:00
|
|
|
if (i == IndirectHeap::Type::indirectObject || !this->stateBaseAddressTracking) {
|
2023-03-14 21:22:30 +00:00
|
|
|
indirectHeaps[i]->replaceBuffer(indirectHeaps[i]->getCpuBase(),
|
|
|
|
|
indirectHeaps[i]->getMaxAvailableSpace());
|
2023-12-13 16:09:52 +00:00
|
|
|
if (i == IndirectHeap::Type::surfaceState) {
|
2023-03-14 21:22:30 +00:00
|
|
|
indirectHeaps[i]->getSpace(reservedSshSize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addToResidencyContainer(indirectHeaps[i]->getGraphicsAllocation());
|
2020-12-04 11:28:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-10-07 12:07:34 +02:00
|
|
|
|
2020-09-23 20:41:37 +05:30
|
|
|
iddBlock = nullptr;
|
|
|
|
|
nextIddInBlock = this->getNumIddPerBlock();
|
2020-12-21 00:56:30 +00:00
|
|
|
lastPipelineSelectModeRequired = false;
|
2021-03-29 17:47:53 +00:00
|
|
|
lastSentUseGlobalAtomics = false;
|
2023-04-05 13:21:45 +00:00
|
|
|
endCmdPtr = nullptr;
|
2023-04-06 00:17:17 +00:00
|
|
|
alignedPrimarySize = 0;
|
2019-11-18 15:12:22 +01:00
|
|
|
}
|
|
|
|
|
|
2023-03-15 18:38:50 +00:00
|
|
|
size_t CommandContainer::getAlignedCmdBufferSize() const {
|
2022-09-13 12:12:03 +00:00
|
|
|
auto totalCommandBufferSize = totalCmdBufferSize;
|
2023-11-30 08:32:25 +00:00
|
|
|
if (debugManager.flags.OverrideCmdListCmdBufferSizeInKb.get() > 0) {
|
|
|
|
|
totalCommandBufferSize = static_cast<size_t>(debugManager.flags.OverrideCmdListCmdBufferSizeInKb.get()) * MemoryConstants::kiloByte;
|
2022-09-13 12:12:03 +00:00
|
|
|
totalCommandBufferSize += cmdBufferReservedSize;
|
|
|
|
|
}
|
2023-03-16 00:12:49 +00:00
|
|
|
return alignUp<size_t>(totalCommandBufferSize, defaultCmdBufferAllocationAlignment);
|
2022-09-13 12:12:03 +00:00
|
|
|
}
|
|
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
void *CommandContainer::getHeapSpaceAllowGrow(HeapType heapType,
|
|
|
|
|
size_t size) {
|
2022-11-07 20:01:57 +00:00
|
|
|
return getHeapWithRequiredSize(heapType, size, 0, true)->getSpace(size);
|
2020-01-17 08:56:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType heapType, size_t sizeRequired, size_t alignment) {
|
2022-11-07 20:01:57 +00:00
|
|
|
return getHeapWithRequiredSize(heapType, sizeRequired, alignment, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IndirectHeap *CommandContainer::getHeapWithRequiredSize(HeapType heapType, size_t sizeRequired, size_t alignment, bool allowGrow) {
|
2020-01-14 15:20:13 +01:00
|
|
|
auto indirectHeap = getIndirectHeap(heapType);
|
2022-09-26 22:28:10 +00:00
|
|
|
UNRECOVERABLE_IF(indirectHeap == nullptr);
|
2020-01-14 15:20:13 +01:00
|
|
|
auto sizeRequested = sizeRequired;
|
|
|
|
|
|
|
|
|
|
auto heapBuffer = indirectHeap->getSpace(0);
|
|
|
|
|
if (alignment && (heapBuffer != alignUp(heapBuffer, alignment))) {
|
|
|
|
|
sizeRequested += alignment;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-26 22:28:10 +00:00
|
|
|
if (immediateCmdListSharedHeap(heapType)) {
|
|
|
|
|
UNRECOVERABLE_IF(indirectHeap->getAvailableSpace() < sizeRequested);
|
|
|
|
|
} else {
|
|
|
|
|
if (indirectHeap->getAvailableSpace() < sizeRequested) {
|
2023-03-16 00:12:49 +00:00
|
|
|
size_t newSize = indirectHeap->getMaxAvailableSpace();
|
2022-11-07 20:01:57 +00:00
|
|
|
if (allowGrow) {
|
|
|
|
|
newSize = std::max(newSize, indirectHeap->getAvailableSpace() + sizeRequested);
|
|
|
|
|
}
|
2022-09-26 22:28:10 +00:00
|
|
|
newSize = alignUp(newSize, MemoryConstants::pageSize);
|
|
|
|
|
auto oldAlloc = getIndirectHeapAllocation(heapType);
|
2022-10-05 09:47:39 +00:00
|
|
|
this->createAndAssignNewHeap(heapType, newSize);
|
2023-12-13 16:09:52 +00:00
|
|
|
if (heapType == HeapType::surfaceState) {
|
2022-09-26 22:28:10 +00:00
|
|
|
indirectHeap->getSpace(reservedSshSize);
|
|
|
|
|
sshAllocations.push_back(oldAlloc);
|
|
|
|
|
}
|
2020-07-15 09:10:22 +02:00
|
|
|
}
|
2020-01-14 15:20:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (alignment) {
|
|
|
|
|
indirectHeap->align(alignment);
|
|
|
|
|
}
|
2020-07-15 09:10:22 +02:00
|
|
|
|
2020-01-14 15:20:13 +01:00
|
|
|
return indirectHeap;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-05 09:47:39 +00:00
|
|
|
void CommandContainer::createAndAssignNewHeap(HeapType heapType, size_t size) {
|
|
|
|
|
auto indirectHeap = getIndirectHeap(heapType);
|
|
|
|
|
auto oldAlloc = getIndirectHeapAllocation(heapType);
|
2023-03-16 00:12:49 +00:00
|
|
|
auto newAlloc = getHeapHelper()->getHeapAllocation(heapType, size, defaultHeapAllocationAlignment, device->getRootDeviceIndex());
|
2022-10-05 09:47:39 +00:00
|
|
|
UNRECOVERABLE_IF(!oldAlloc);
|
|
|
|
|
UNRECOVERABLE_IF(!newAlloc);
|
|
|
|
|
auto oldBase = indirectHeap->getHeapGpuBase();
|
|
|
|
|
indirectHeap->replaceGraphicsAllocation(newAlloc);
|
|
|
|
|
indirectHeap->replaceBuffer(newAlloc->getUnderlyingBuffer(),
|
|
|
|
|
newAlloc->getUnderlyingBufferSize());
|
|
|
|
|
auto newBase = indirectHeap->getHeapGpuBase();
|
|
|
|
|
getResidencyContainer().push_back(newAlloc);
|
2022-10-05 16:27:50 +00:00
|
|
|
if (this->immediateCmdListCsr) {
|
|
|
|
|
this->storeAllocationAndFlushTagUpdate(oldAlloc);
|
|
|
|
|
} else {
|
|
|
|
|
getDeallocationContainer().push_back(oldAlloc);
|
|
|
|
|
}
|
2022-10-05 09:47:39 +00:00
|
|
|
setIndirectHeapAllocation(heapType, newAlloc);
|
|
|
|
|
if (oldBase != newBase) {
|
|
|
|
|
setHeapDirty(heapType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 08:48:59 +00:00
|
|
|
void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
|
2022-11-09 15:47:00 +00:00
|
|
|
if (immediateReusableAllocationList != nullptr && !immediateReusableAllocationList->peekIsEmpty() && reusableAllocationList != nullptr) {
|
|
|
|
|
reusableAllocationList->splice(*immediateReusableAllocationList->detachNodes());
|
|
|
|
|
}
|
2021-12-13 08:48:59 +00:00
|
|
|
for (size_t i = startIndex; i < cmdBufferAllocations.size(); i++) {
|
2022-03-10 08:32:37 +01:00
|
|
|
if (this->reusableAllocationList) {
|
2024-01-27 07:53:40 +01:00
|
|
|
bool allocationHandled = false;
|
|
|
|
|
for (auto &engine : this->device->getMemoryManager()->getRegisteredEngines(cmdBufferAllocations[i]->getRootDeviceIndex())) {
|
|
|
|
|
auto osContextId = engine.osContext->getContextId();
|
|
|
|
|
if (cmdBufferAllocations[i]->isUsedByOsContext(osContextId) && engine.commandStreamReceiver->isAnyDirectSubmissionEnabled()) {
|
|
|
|
|
auto lock = engine.commandStreamReceiver->obtainUniqueOwnership();
|
|
|
|
|
auto taskCount = engine.commandStreamReceiver->peekTaskCount() + 1;
|
|
|
|
|
cmdBufferAllocations[i]->updateTaskCount(taskCount, osContextId);
|
|
|
|
|
cmdBufferAllocations[i]->updateResidencyTaskCount(taskCount, osContextId);
|
|
|
|
|
engine.commandStreamReceiver->flushTagUpdate();
|
|
|
|
|
engine.commandStreamReceiver->waitForTaskCount(taskCount);
|
|
|
|
|
allocationHandled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!allocationHandled && isHandleFenceCompletionRequired) {
|
2024-01-17 13:04:27 +00:00
|
|
|
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
|
|
|
|
|
}
|
2024-01-27 07:53:40 +01:00
|
|
|
|
|
|
|
|
for (auto &engine : this->device->getMemoryManager()->getRegisteredEngines(cmdBufferAllocations[i]->getRootDeviceIndex())) {
|
|
|
|
|
auto osContextId = engine.osContext->getContextId();
|
|
|
|
|
cmdBufferAllocations[i]->releaseUsageInOsContext(osContextId);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-18 10:30:17 +00:00
|
|
|
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
|
2022-03-10 08:32:37 +01:00
|
|
|
} else {
|
|
|
|
|
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);
|
|
|
|
|
}
|
2021-12-13 08:48:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphicsAllocation *CommandContainer::obtainNextCommandBufferAllocation() {
|
2023-02-22 07:29:42 +00:00
|
|
|
return this->obtainNextCommandBufferAllocation(false);
|
|
|
|
|
}
|
2021-12-13 08:48:59 +00:00
|
|
|
|
2023-02-22 07:29:42 +00:00
|
|
|
GraphicsAllocation *CommandContainer::obtainNextCommandBufferAllocation(bool forceHostMemory) {
|
|
|
|
|
forceHostMemory &= this->useSecondaryCommandStream;
|
2021-12-13 08:48:59 +00:00
|
|
|
GraphicsAllocation *cmdBufferAllocation = nullptr;
|
|
|
|
|
if (this->reusableAllocationList) {
|
2024-01-17 13:04:27 +00:00
|
|
|
const size_t alignedSize = getAlignedCmdBufferSize();
|
2023-12-11 14:24:36 +00:00
|
|
|
cmdBufferAllocation = this->reusableAllocationList->detachAllocation(alignedSize, nullptr, forceHostMemory, nullptr, AllocationType::commandBuffer).release();
|
2021-12-13 08:48:59 +00:00
|
|
|
}
|
|
|
|
|
if (!cmdBufferAllocation) {
|
2023-02-22 07:29:42 +00:00
|
|
|
cmdBufferAllocation = this->allocateCommandBuffer(forceHostMemory);
|
2021-12-13 08:48:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return cmdBufferAllocation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandContainer::allocateNextCommandBuffer() {
|
|
|
|
|
auto cmdBufferAllocation = this->obtainNextCommandBufferAllocation();
|
2020-01-16 17:58:36 +01:00
|
|
|
UNRECOVERABLE_IF(!cmdBufferAllocation);
|
|
|
|
|
|
|
|
|
|
cmdBufferAllocations.push_back(cmdBufferAllocation);
|
|
|
|
|
|
2022-09-27 11:46:03 +00:00
|
|
|
setCmdBuffer(cmdBufferAllocation);
|
2020-01-16 17:58:36 +01:00
|
|
|
}
|
2021-03-08 17:00:22 +05:30
|
|
|
|
2022-01-12 16:57:42 +00:00
|
|
|
void CommandContainer::closeAndAllocateNextCommandBuffer() {
|
|
|
|
|
auto ptr = commandStream->getSpace(0u);
|
2023-04-05 13:21:45 +00:00
|
|
|
size_t usedSize = commandStream->getUsed();
|
2022-01-12 16:57:42 +00:00
|
|
|
allocateNextCommandBuffer();
|
2023-04-05 13:21:45 +00:00
|
|
|
if (this->usingPrimaryBuffer) {
|
|
|
|
|
auto nextChainedBuffer = commandStream->getGraphicsAllocation();
|
|
|
|
|
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
|
|
|
|
gfxCoreHelper.encodeBatchBufferStart(ptr, nextChainedBuffer->getGpuAddress(), false, false, false);
|
|
|
|
|
alignPrimaryEnding(ptr, usedSize);
|
|
|
|
|
} else {
|
|
|
|
|
memcpy_s(ptr, this->selectedBbCmdSize, this->bbEndReference, this->selectedBbCmdSize);
|
|
|
|
|
}
|
2022-04-25 23:49:47 +00:00
|
|
|
currentLinearStreamStartOffset = 0u;
|
2022-01-12 16:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
2023-04-05 13:21:45 +00:00
|
|
|
void CommandContainer::alignPrimaryEnding(void *endPtr, size_t exactUsedSize) {
|
|
|
|
|
exactUsedSize += this->selectedBbCmdSize;
|
2023-04-06 00:17:17 +00:00
|
|
|
size_t alignedBufferSize = alignUp(exactUsedSize, minCmdBufferPtrAlign);
|
|
|
|
|
if (alignedBufferSize > exactUsedSize) {
|
2023-04-05 13:21:45 +00:00
|
|
|
endPtr = ptrOffset(endPtr, this->selectedBbCmdSize);
|
2023-04-06 00:17:17 +00:00
|
|
|
memset(endPtr, 0, alignedBufferSize - exactUsedSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->alignedPrimarySize == 0) {
|
|
|
|
|
this->alignedPrimarySize = alignedBufferSize;
|
2023-04-05 13:21:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandContainer::endAlignedPrimaryBuffer() {
|
|
|
|
|
this->endCmdPtr = commandStream->getSpace(0u);
|
|
|
|
|
alignPrimaryEnding(this->endCmdPtr, commandStream->getUsed());
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-04 11:28:18 +00:00
|
|
|
void CommandContainer::prepareBindfulSsh() {
|
2023-06-26 17:49:16 +00:00
|
|
|
bool globalBindlessSsh = this->device->getBindlessHeapsHelper() != nullptr;
|
|
|
|
|
if (globalBindlessSsh) {
|
2023-12-13 16:09:52 +00:00
|
|
|
if (allocationIndirectHeaps[IndirectHeap::Type::surfaceState] == nullptr) {
|
2022-09-13 14:17:45 +00:00
|
|
|
constexpr size_t heapSize = MemoryConstants::pageSize64k;
|
2023-12-13 16:09:52 +00:00
|
|
|
allocationIndirectHeaps[IndirectHeap::Type::surfaceState] = heapHelper->getHeapAllocation(IndirectHeap::Type::surfaceState,
|
|
|
|
|
heapSize,
|
|
|
|
|
defaultHeapAllocationAlignment,
|
|
|
|
|
device->getRootDeviceIndex());
|
|
|
|
|
UNRECOVERABLE_IF(!allocationIndirectHeaps[IndirectHeap::Type::surfaceState]);
|
|
|
|
|
residencyContainer.push_back(allocationIndirectHeaps[IndirectHeap::Type::surfaceState]);
|
|
|
|
|
|
|
|
|
|
indirectHeaps[IndirectHeap::Type::surfaceState] = std::make_unique<IndirectHeap>(allocationIndirectHeaps[IndirectHeap::Type::surfaceState], false);
|
|
|
|
|
indirectHeaps[IndirectHeap::Type::surfaceState]->getSpace(reservedSshSize);
|
|
|
|
|
setHeapDirty(IndirectHeap::Type::surfaceState);
|
2020-12-04 11:28:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-26 10:59:30 +00:00
|
|
|
|
|
|
|
|
IndirectHeap *CommandContainer::getIndirectHeap(HeapType heapType) {
|
2022-09-26 22:28:10 +00:00
|
|
|
if (immediateCmdListSharedHeap(heapType)) {
|
2023-12-13 16:09:52 +00:00
|
|
|
return heapType == HeapType::surfaceState ? sharedSshCsrHeap : sharedDshCsrHeap;
|
2022-09-26 22:28:10 +00:00
|
|
|
} else {
|
|
|
|
|
return indirectHeaps[heapType].get();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-02 18:57:24 +00:00
|
|
|
IndirectHeap *CommandContainer::initIndirectHeapReservation(ReservedIndirectHeap *indirectHeapReservation, size_t size, size_t alignment, HeapType heapType) {
|
|
|
|
|
void *currentHeap = immediateCmdListCsr->getIndirectHeapCurrentPtr(heapType);
|
|
|
|
|
auto totalRequiredSize = size + ptrDiff(alignUp(currentHeap, alignment), currentHeap);
|
2023-02-02 18:57:24 +00:00
|
|
|
|
2023-02-02 18:57:24 +00:00
|
|
|
auto baseHeap = &immediateCmdListCsr->getIndirectHeap(heapType, totalRequiredSize);
|
|
|
|
|
|
|
|
|
|
auto usedSize = baseHeap->getUsed();
|
|
|
|
|
void *heapCpuBase = baseHeap->getCpuBase();
|
|
|
|
|
auto consumedSize = usedSize + totalRequiredSize;
|
|
|
|
|
|
|
|
|
|
baseHeap->getSpace(totalRequiredSize);
|
|
|
|
|
|
|
|
|
|
indirectHeapReservation->replaceGraphicsAllocation(baseHeap->getGraphicsAllocation());
|
|
|
|
|
indirectHeapReservation->replaceBuffer(heapCpuBase, consumedSize);
|
|
|
|
|
indirectHeapReservation->getSpace(usedSize);
|
|
|
|
|
indirectHeapReservation->setHeapSizeInPages(baseHeap->getHeapSizeInPages());
|
2023-02-02 18:57:24 +00:00
|
|
|
|
|
|
|
|
return baseHeap;
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-02 18:57:24 +00:00
|
|
|
void CommandContainer::reserveSpaceForDispatch(HeapReserveArguments &sshReserveArg, HeapReserveArguments &dshReserveArg, bool getDsh) {
|
|
|
|
|
size_t sshAlignment = sshReserveArg.alignment;
|
|
|
|
|
size_t dshAlignment = dshReserveArg.alignment;
|
|
|
|
|
if (sshReserveArg.size == 0) {
|
|
|
|
|
sshAlignment = 1;
|
|
|
|
|
}
|
|
|
|
|
if (dshReserveArg.size == 0) {
|
|
|
|
|
dshAlignment = 1;
|
|
|
|
|
}
|
2023-01-26 14:33:36 +00:00
|
|
|
if (immediateCmdListCsr) {
|
|
|
|
|
auto lock = immediateCmdListCsr->obtainUniqueOwnership();
|
2023-12-13 16:09:52 +00:00
|
|
|
sharedSshCsrHeap = this->initIndirectHeapReservation(sshReserveArg.indirectHeapReservation, sshReserveArg.size, sshAlignment, HeapType::surfaceState);
|
2022-09-26 22:28:10 +00:00
|
|
|
|
2023-01-26 14:33:36 +00:00
|
|
|
if (getDsh) {
|
2023-12-13 16:09:52 +00:00
|
|
|
sharedDshCsrHeap = this->initIndirectHeapReservation(dshReserveArg.indirectHeapReservation, dshReserveArg.size, dshAlignment, HeapType::dynamicState);
|
2023-01-26 14:33:36 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2023-06-26 17:49:16 +00:00
|
|
|
if (sshReserveArg.size > 0) {
|
|
|
|
|
prepareBindfulSsh();
|
2023-12-13 16:09:52 +00:00
|
|
|
this->getHeapWithRequiredSizeAndAlignment(HeapType::surfaceState, sshReserveArg.size, sshAlignment);
|
2023-06-26 17:49:16 +00:00
|
|
|
}
|
2023-02-02 18:57:24 +00:00
|
|
|
|
2023-01-26 14:33:36 +00:00
|
|
|
if (getDsh) {
|
2023-12-13 16:09:52 +00:00
|
|
|
this->getHeapWithRequiredSizeAndAlignment(HeapType::dynamicState, dshReserveArg.size, dshAlignment);
|
2023-01-26 14:33:36 +00:00
|
|
|
}
|
2023-02-02 18:57:24 +00:00
|
|
|
// private heaps can be accessed directly
|
|
|
|
|
sshReserveArg.indirectHeapReservation = nullptr;
|
|
|
|
|
dshReserveArg.indirectHeapReservation = nullptr;
|
2022-09-26 22:28:10 +00:00
|
|
|
}
|
2022-01-26 10:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
2022-09-27 11:46:03 +00:00
|
|
|
GraphicsAllocation *CommandContainer::reuseExistingCmdBuffer() {
|
2023-02-22 07:29:42 +00:00
|
|
|
return this->reuseExistingCmdBuffer(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphicsAllocation *CommandContainer::reuseExistingCmdBuffer(bool forceHostMemory) {
|
|
|
|
|
forceHostMemory &= this->useSecondaryCommandStream;
|
2023-03-15 18:38:50 +00:00
|
|
|
size_t alignedSize = getAlignedCmdBufferSize();
|
2023-12-11 14:24:36 +00:00
|
|
|
auto cmdBufferAllocation = this->immediateReusableAllocationList->detachAllocation(alignedSize, nullptr, forceHostMemory, this->immediateCmdListCsr, AllocationType::commandBuffer).release();
|
2022-11-09 15:47:00 +00:00
|
|
|
if (!cmdBufferAllocation) {
|
2023-12-11 14:24:36 +00:00
|
|
|
this->reusableAllocationList->detachAllocation(alignedSize, nullptr, forceHostMemory, this->immediateCmdListCsr, AllocationType::commandBuffer).release();
|
2022-11-09 15:47:00 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-13 11:30:33 +00:00
|
|
|
if (cmdBufferAllocation) {
|
|
|
|
|
this->cmdBufferAllocations.push_back(cmdBufferAllocation);
|
|
|
|
|
}
|
2022-09-27 11:46:03 +00:00
|
|
|
return cmdBufferAllocation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandContainer::addCurrentCommandBufferToReusableAllocationList() {
|
2022-10-13 11:30:33 +00:00
|
|
|
this->cmdBufferAllocations.erase(std::find(this->cmdBufferAllocations.begin(), this->cmdBufferAllocations.end(), this->commandStream->getGraphicsAllocation()));
|
2022-10-05 16:27:50 +00:00
|
|
|
this->storeAllocationAndFlushTagUpdate(this->commandStream->getGraphicsAllocation());
|
2022-09-27 11:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandContainer::setCmdBuffer(GraphicsAllocation *cmdBuffer) {
|
2023-03-15 18:38:50 +00:00
|
|
|
commandStream->replaceBuffer(cmdBuffer->getUnderlyingBuffer(), getMaxUsableSpace());
|
2022-09-27 11:46:03 +00:00
|
|
|
commandStream->replaceGraphicsAllocation(cmdBuffer);
|
|
|
|
|
|
|
|
|
|
if (!getFlushTaskUsedForImmediate()) {
|
|
|
|
|
addToResidencyContainer(cmdBuffer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphicsAllocation *CommandContainer::allocateCommandBuffer() {
|
2023-02-22 07:29:42 +00:00
|
|
|
return this->allocateCommandBuffer(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GraphicsAllocation *CommandContainer::allocateCommandBuffer(bool forceHostMemory) {
|
2023-03-15 18:38:50 +00:00
|
|
|
size_t alignedSize = getAlignedCmdBufferSize();
|
2022-09-27 11:46:03 +00:00
|
|
|
AllocationProperties properties{device->getRootDeviceIndex(),
|
|
|
|
|
true /* allocateMemory*/,
|
|
|
|
|
alignedSize,
|
2023-12-11 14:24:36 +00:00
|
|
|
AllocationType::commandBuffer,
|
2022-09-27 11:46:03 +00:00
|
|
|
(device->getNumGenericSubDevices() > 1u) /* multiOsContextCapable */,
|
|
|
|
|
false,
|
|
|
|
|
device->getDeviceBitfield()};
|
2023-02-22 07:29:42 +00:00
|
|
|
properties.flags.forceSystemMemory = forceHostMemory && this->useSecondaryCommandStream;
|
2022-09-27 11:46:03 +00:00
|
|
|
|
2023-07-05 16:01:51 +00:00
|
|
|
auto commandBufferAllocation = device->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
|
|
|
|
if (commandBufferAllocation) {
|
|
|
|
|
commandBufferAllocation->storageInfo.systemMemoryForced = properties.flags.forceSystemMemory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return commandBufferAllocation;
|
2022-09-27 11:46:03 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-05 16:27:50 +00:00
|
|
|
void CommandContainer::fillReusableAllocationLists() {
|
2023-02-15 12:34:14 +00:00
|
|
|
if (this->immediateReusableAllocationList) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-09 15:47:00 +00:00
|
|
|
this->immediateReusableAllocationList = std::make_unique<NEO::AllocationsList>();
|
2023-03-06 20:33:50 +00:00
|
|
|
|
2022-12-09 15:11:27 +00:00
|
|
|
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
2022-12-08 12:22:35 +00:00
|
|
|
auto amountToFill = gfxCoreHelper.getAmountOfAllocationsToFill();
|
2022-10-05 16:27:50 +00:00
|
|
|
if (amountToFill == 0u) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto i = 0u; i < amountToFill; i++) {
|
|
|
|
|
auto allocToReuse = this->allocateCommandBuffer();
|
2022-11-09 15:47:00 +00:00
|
|
|
this->immediateReusableAllocationList->pushTailOne(*allocToReuse);
|
2022-10-05 16:27:50 +00:00
|
|
|
this->getResidencyContainer().push_back(allocToReuse);
|
2023-02-24 08:47:31 +00:00
|
|
|
|
|
|
|
|
if (this->useSecondaryCommandStream) {
|
|
|
|
|
auto hostAllocToReuse = this->allocateCommandBuffer(true);
|
|
|
|
|
this->immediateReusableAllocationList->pushTailOne(*hostAllocToReuse);
|
|
|
|
|
this->getResidencyContainer().push_back(hostAllocToReuse);
|
|
|
|
|
}
|
2022-10-05 16:27:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!this->heapHelper) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto i = 0u; i < amountToFill; i++) {
|
2023-12-13 16:09:52 +00:00
|
|
|
for (auto heapType = 0u; heapType < IndirectHeap::Type::numTypes; heapType++) {
|
2023-03-06 20:33:50 +00:00
|
|
|
if (skipHeapAllocationCreation(static_cast<HeapType>(heapType))) {
|
2022-10-05 16:27:50 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2023-03-16 00:12:49 +00:00
|
|
|
size_t heapSize = getHeapSize(static_cast<HeapType>(heapType));
|
2022-10-05 16:27:50 +00:00
|
|
|
auto heapToReuse = heapHelper->getHeapAllocation(heapType,
|
|
|
|
|
heapSize,
|
2023-03-16 00:12:49 +00:00
|
|
|
defaultHeapAllocationAlignment,
|
2022-10-05 16:27:50 +00:00
|
|
|
device->getRootDeviceIndex());
|
2022-12-08 10:53:14 +00:00
|
|
|
if (heapToReuse != nullptr) {
|
|
|
|
|
this->immediateCmdListCsr->makeResident(*heapToReuse);
|
|
|
|
|
}
|
2022-10-05 16:27:50 +00:00
|
|
|
this->heapHelper->storeHeapAllocation(heapToReuse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandContainer::storeAllocationAndFlushTagUpdate(GraphicsAllocation *allocation) {
|
|
|
|
|
auto lock = this->immediateCmdListCsr->obtainUniqueOwnership();
|
|
|
|
|
auto taskCount = this->immediateCmdListCsr->peekTaskCount() + 1;
|
|
|
|
|
auto osContextId = this->immediateCmdListCsr->getOsContext().getContextId();
|
|
|
|
|
allocation->updateTaskCount(taskCount, osContextId);
|
|
|
|
|
allocation->updateResidencyTaskCount(taskCount, osContextId);
|
2023-12-11 14:24:36 +00:00
|
|
|
if (allocation->getAllocationType() == AllocationType::commandBuffer) {
|
2022-11-09 15:47:00 +00:00
|
|
|
this->immediateReusableAllocationList->pushTailOne(*allocation);
|
2022-10-05 16:27:50 +00:00
|
|
|
} else {
|
|
|
|
|
getHeapHelper()->storeHeapAllocation(allocation);
|
|
|
|
|
}
|
|
|
|
|
this->immediateCmdListCsr->flushTagUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-02 18:57:24 +00:00
|
|
|
HeapReserveData::HeapReserveData() {
|
|
|
|
|
object = std::make_unique<NEO::ReservedIndirectHeap>(nullptr, false);
|
|
|
|
|
indirectHeapReservation = object.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HeapReserveData::~HeapReserveData() {
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-06 20:33:50 +00:00
|
|
|
bool CommandContainer::skipHeapAllocationCreation(HeapType heapType) {
|
2023-12-13 16:09:52 +00:00
|
|
|
if (heapType == IndirectHeap::Type::indirectObject) {
|
2023-03-06 20:33:50 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const auto &hardwareInfo = this->device->getHardwareInfo();
|
|
|
|
|
|
2023-12-13 16:09:52 +00:00
|
|
|
bool skipCreation = (globalBindlessHeapsEnabled && IndirectHeap::Type::surfaceState == heapType) ||
|
2023-03-06 20:33:50 +00:00
|
|
|
this->immediateCmdListSharedHeap(heapType) ||
|
2023-12-13 16:09:52 +00:00
|
|
|
(!hardwareInfo.capabilityTable.supportsImages && IndirectHeap::Type::dynamicState == heapType) ||
|
2023-12-12 11:37:31 +00:00
|
|
|
(this->heapAddressModel != HeapAddressModel::privateHeaps);
|
2023-03-06 20:33:50 +00:00
|
|
|
return skipCreation;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-16 00:12:49 +00:00
|
|
|
size_t CommandContainer::getHeapSize(HeapType heapType) {
|
|
|
|
|
size_t defaultHeapSize = HeapSize::defaultHeapSize;
|
2023-12-13 16:09:52 +00:00
|
|
|
if (HeapType::surfaceState == heapType) {
|
2023-03-16 00:12:49 +00:00
|
|
|
defaultHeapSize = this->defaultSshSize;
|
|
|
|
|
}
|
|
|
|
|
return HeapSize::getDefaultHeapSize(defaultHeapSize);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-18 15:12:22 +01:00
|
|
|
} // namespace NEO
|