mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 15:12:56 +08:00
Do not use heap for command queue command buffer manager
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0192e8038f
commit
065406e222
@@ -55,10 +55,9 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) {
|
||||
if (returnValue == ZE_RESULT_SUCCESS) {
|
||||
NEO::GraphicsAllocation *bufferAllocation = buffers.getCurrentBufferAllocation();
|
||||
UNRECOVERABLE_IF(bufferAllocation == nullptr);
|
||||
commandStream = new NEO::LinearStream(bufferAllocation->getUnderlyingBuffer(),
|
||||
defaultQueueCmdBufferSize);
|
||||
UNRECOVERABLE_IF(commandStream == nullptr);
|
||||
commandStream->replaceGraphicsAllocation(bufferAllocation);
|
||||
commandStream.replaceBuffer(bufferAllocation->getUnderlyingBuffer(),
|
||||
defaultQueueCmdBufferSize);
|
||||
commandStream.replaceGraphicsAllocation(bufferAllocation);
|
||||
isCopyOnlyCommandQueue = copyOnly;
|
||||
preemptionCmdSyncProgramming = getPreemptionCmdProgramming();
|
||||
activeSubDevices = static_cast<uint32_t>(csr->getOsContext().getDeviceBitfield().count());
|
||||
@@ -75,14 +74,13 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) {
|
||||
NEO::WaitStatus CommandQueueImp::reserveLinearStreamSize(size_t size) {
|
||||
auto waitStatus{NEO::WaitStatus::Ready};
|
||||
|
||||
UNRECOVERABLE_IF(commandStream == nullptr);
|
||||
if (commandStream->getAvailableSpace() < size) {
|
||||
if (commandStream.getAvailableSpace() < size) {
|
||||
waitStatus = buffers.switchBuffers(csr);
|
||||
|
||||
NEO::GraphicsAllocation *nextBufferAllocation = buffers.getCurrentBufferAllocation();
|
||||
commandStream->replaceBuffer(nextBufferAllocation->getUnderlyingBuffer(),
|
||||
defaultQueueCmdBufferSize);
|
||||
commandStream->replaceGraphicsAllocation(nextBufferAllocation);
|
||||
commandStream.replaceBuffer(nextBufferAllocation->getUnderlyingBuffer(),
|
||||
defaultQueueCmdBufferSize);
|
||||
commandStream.replaceGraphicsAllocation(nextBufferAllocation);
|
||||
}
|
||||
|
||||
return waitStatus;
|
||||
@@ -92,18 +90,18 @@ NEO::SubmissionStatus CommandQueueImp::submitBatchBuffer(size_t offset, NEO::Res
|
||||
bool isCooperative) {
|
||||
UNRECOVERABLE_IF(csr == nullptr);
|
||||
|
||||
NEO::BatchBuffer batchBuffer(commandStream->getGraphicsAllocation(), offset, 0u, nullptr, false, false,
|
||||
NEO::BatchBuffer batchBuffer(commandStream.getGraphicsAllocation(), offset, 0u, nullptr, false, false,
|
||||
NEO::QueueThrottle::HIGH, NEO::QueueSliceCount::defaultSliceCount,
|
||||
commandStream->getUsed(), commandStream, endingCmdPtr, isCooperative);
|
||||
commandStream.getUsed(), &commandStream, endingCmdPtr, isCooperative);
|
||||
|
||||
commandStream->getGraphicsAllocation()->updateTaskCount(csr->peekTaskCount() + 1, csr->getOsContext().getContextId());
|
||||
commandStream->getGraphicsAllocation()->updateResidencyTaskCount(csr->peekTaskCount() + 1, csr->getOsContext().getContextId());
|
||||
commandStream.getGraphicsAllocation()->updateTaskCount(csr->peekTaskCount() + 1, csr->getOsContext().getContextId());
|
||||
commandStream.getGraphicsAllocation()->updateResidencyTaskCount(csr->peekTaskCount() + 1, csr->getOsContext().getContextId());
|
||||
|
||||
csr->setActivePartitions(partitionCount);
|
||||
auto ret = csr->submitBatchBuffer(batchBuffer, csr->getResidencyAllocations());
|
||||
if (ret != NEO::SubmissionStatus::SUCCESS) {
|
||||
commandStream->getGraphicsAllocation()->updateTaskCount(csr->peekTaskCount(), csr->getOsContext().getContextId());
|
||||
commandStream->getGraphicsAllocation()->updateResidencyTaskCount(csr->peekTaskCount(), csr->getOsContext().getContextId());
|
||||
commandStream.getGraphicsAllocation()->updateTaskCount(csr->peekTaskCount(), csr->getOsContext().getContextId());
|
||||
commandStream.getGraphicsAllocation()->updateResidencyTaskCount(csr->peekTaskCount(), csr->getOsContext().getContextId());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::createFence(const ze_fence_desc_t *de
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandQueueHw<gfxCoreFamily>::destroy() {
|
||||
if (commandStream) {
|
||||
delete commandStream;
|
||||
commandStream = nullptr;
|
||||
if (commandStream.getCpuBase() != nullptr) {
|
||||
commandStream.replaceGraphicsAllocation(nullptr);
|
||||
commandStream.replaceBuffer(nullptr, 0);
|
||||
}
|
||||
buffers.destroy(this->getDevice());
|
||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {
|
||||
@@ -659,8 +659,8 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::makeAlignedChildStreamAndSetGpuBase(N
|
||||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
child.replaceBuffer(this->commandStream->getSpace(alignedSize), alignedSize);
|
||||
child.setGpuBase(ptrOffset(this->commandStream->getGpuBase(), this->commandStream->getUsed() - alignedSize));
|
||||
child.replaceBuffer(this->commandStream.getSpace(alignedSize), alignedSize);
|
||||
child.setGpuBase(ptrOffset(this->commandStream.getGpuBase(), this->commandStream.getUsed() - alignedSize));
|
||||
this->alignedChildStreamPadding = alignedSize - requiredSize;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ NEO::SubmissionStatus CommandQueueHw<gfxCoreFamily>::prepareAndSubmitBatchBuffer
|
||||
|
||||
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
|
||||
|
||||
auto &outerCommandStream = *this->commandStream;
|
||||
auto &outerCommandStream = this->commandStream;
|
||||
|
||||
void *endingCmd = nullptr;
|
||||
if (ctx.isDirectSubmissionEnabled) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_container/cmdcontainer.h"
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/submission_status.h"
|
||||
#include "shared/source/command_stream/wait_status.h"
|
||||
#include "shared/source/helpers/completion_stamp.h"
|
||||
@@ -98,7 +99,7 @@ struct CommandQueueImp : public CommandQueue {
|
||||
|
||||
Device *device = nullptr;
|
||||
NEO::CommandStreamReceiver *csr = nullptr;
|
||||
NEO::LinearStream *commandStream = nullptr;
|
||||
NEO::LinearStream commandStream{};
|
||||
|
||||
std::atomic<uint32_t> taskCount{0};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user