mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Pass CsrDependencies from events to BlitProperties
- move files to core - extract struct and enums to headers Change-Id: Id5509f284dfa9ffc5e5d9173124af8a860f5a6f4 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
4d36054254
commit
a2b123a058
@@ -6,6 +6,7 @@
|
||||
|
||||
set(NEO_CORE_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_subcapture_status.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/csr_definitions.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.h
|
||||
@@ -15,6 +16,8 @@ set(NEO_CORE_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preemption.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preemption.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/preemption.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy.h
|
||||
)
|
||||
|
||||
|
||||
16
core/command_stream/aub_subcapture_status.h
Normal file
16
core/command_stream/aub_subcapture_status.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct AubSubCaptureStatus {
|
||||
bool isActive;
|
||||
bool wasActiveInPreviousEnqueue;
|
||||
};
|
||||
} // namespace NEO
|
||||
114
core/command_stream/submissions_aggregator.cpp
Normal file
114
core/command_stream/submissions_aggregator.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "submissions_aggregator.h"
|
||||
|
||||
#include "core/helpers/flush_stamp.h"
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
|
||||
void NEO::SubmissionAggregator::recordCommandBuffer(CommandBuffer *commandBuffer) {
|
||||
this->cmdBuffers.pushTailOne(*commandBuffer);
|
||||
}
|
||||
|
||||
void NEO::SubmissionAggregator::aggregateCommandBuffers(ResourcePackage &resourcePackage, size_t &totalUsedSize, size_t totalMemoryBudget, uint32_t osContextId) {
|
||||
auto primaryCommandBuffer = this->cmdBuffers.peekHead();
|
||||
auto currentInspection = this->inspectionId;
|
||||
|
||||
if (!primaryCommandBuffer) {
|
||||
return;
|
||||
}
|
||||
auto primaryBatchGraphicsAllocation = primaryCommandBuffer->batchBuffer.commandBufferAllocation;
|
||||
|
||||
this->inspectionId++;
|
||||
primaryCommandBuffer->inspectionId = currentInspection;
|
||||
|
||||
//primary command buffers must fix to budget
|
||||
for (auto &graphicsAllocation : primaryCommandBuffer->surfaces) {
|
||||
if (graphicsAllocation->getInspectionId(osContextId) < currentInspection) {
|
||||
graphicsAllocation->setInspectionId(currentInspection, osContextId);
|
||||
resourcePackage.push_back(graphicsAllocation);
|
||||
totalUsedSize += graphicsAllocation->getUnderlyingBufferSize();
|
||||
}
|
||||
}
|
||||
|
||||
//check if we have anything for merge
|
||||
if (!primaryCommandBuffer->next) {
|
||||
return;
|
||||
}
|
||||
|
||||
//check if next cmd buffer is compatible
|
||||
if (primaryCommandBuffer->next->batchBuffer.requiresCoherency != primaryCommandBuffer->batchBuffer.requiresCoherency) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (primaryCommandBuffer->next->batchBuffer.low_priority != primaryCommandBuffer->batchBuffer.low_priority) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (primaryCommandBuffer->next->batchBuffer.throttle != primaryCommandBuffer->batchBuffer.throttle) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (primaryCommandBuffer->next->batchBuffer.sliceCount != primaryCommandBuffer->batchBuffer.sliceCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto nextCommandBuffer = primaryCommandBuffer->next;
|
||||
ResourcePackage newResources;
|
||||
|
||||
while (nextCommandBuffer) {
|
||||
size_t nextCommandBufferNewResourcesSize = 0;
|
||||
//evaluate if buffer fits
|
||||
for (auto &graphicsAllocation : nextCommandBuffer->surfaces) {
|
||||
if (graphicsAllocation == primaryBatchGraphicsAllocation) {
|
||||
continue;
|
||||
}
|
||||
if (graphicsAllocation->getInspectionId(osContextId) < currentInspection) {
|
||||
graphicsAllocation->setInspectionId(currentInspection, osContextId);
|
||||
newResources.push_back(graphicsAllocation);
|
||||
nextCommandBufferNewResourcesSize += graphicsAllocation->getUnderlyingBufferSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (nextCommandBuffer->batchBuffer.commandBufferAllocation && (nextCommandBuffer->batchBuffer.commandBufferAllocation != primaryBatchGraphicsAllocation)) {
|
||||
if (nextCommandBuffer->batchBuffer.commandBufferAllocation->getInspectionId(osContextId) < currentInspection) {
|
||||
nextCommandBuffer->batchBuffer.commandBufferAllocation->setInspectionId(currentInspection, osContextId);
|
||||
newResources.push_back(nextCommandBuffer->batchBuffer.commandBufferAllocation);
|
||||
nextCommandBufferNewResourcesSize += nextCommandBuffer->batchBuffer.commandBufferAllocation->getUnderlyingBufferSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (nextCommandBufferNewResourcesSize + totalUsedSize <= totalMemoryBudget) {
|
||||
auto currentNode = nextCommandBuffer;
|
||||
nextCommandBuffer = nextCommandBuffer->next;
|
||||
totalUsedSize += nextCommandBufferNewResourcesSize;
|
||||
currentNode->inspectionId = currentInspection;
|
||||
|
||||
for (auto &newResource : newResources) {
|
||||
resourcePackage.push_back(newResource);
|
||||
}
|
||||
newResources.clear();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NEO::BatchBuffer::BatchBuffer(GraphicsAllocation *commandBufferAllocation, size_t startOffset,
|
||||
size_t chainedBatchBufferStartOffset, GraphicsAllocation *chainedBatchBuffer,
|
||||
bool requiresCoherency, bool lowPriority,
|
||||
QueueThrottle throttle, uint64_t sliceCount,
|
||||
size_t usedSize, LinearStream *stream)
|
||||
: commandBufferAllocation(commandBufferAllocation), startOffset(startOffset),
|
||||
chainedBatchBufferStartOffset(chainedBatchBufferStartOffset), chainedBatchBuffer(chainedBatchBuffer),
|
||||
requiresCoherency(requiresCoherency), low_priority(lowPriority),
|
||||
throttle(throttle), sliceCount(sliceCount),
|
||||
usedSize(usedSize), stream(stream) {}
|
||||
|
||||
NEO::CommandBuffer::CommandBuffer(Device &device) : device(device) {
|
||||
flushStamp.reset(new FlushStampTracker(false));
|
||||
}
|
||||
75
core/command_stream/submissions_aggregator.h
Normal file
75
core/command_stream/submissions_aggregator.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/command_stream/csr_definitions.h"
|
||||
#include "core/command_stream/linear_stream.h"
|
||||
#include "core/memory_manager/residency_container.h"
|
||||
#include "core/utilities/idlist.h"
|
||||
#include "core/utilities/stackvec.h"
|
||||
|
||||
#include <vector>
|
||||
namespace NEO {
|
||||
class Device;
|
||||
class Event;
|
||||
class FlushStampTracker;
|
||||
class GraphicsAllocation;
|
||||
|
||||
struct BatchBuffer {
|
||||
BatchBuffer(GraphicsAllocation *commandBufferAllocation,
|
||||
size_t startOffset,
|
||||
size_t chainedBatchBufferStartOffset,
|
||||
GraphicsAllocation *chainedBatchBuffer,
|
||||
bool requiresCoherency,
|
||||
bool lowPriority,
|
||||
QueueThrottle throttle,
|
||||
uint64_t sliceCount,
|
||||
size_t usedSize,
|
||||
LinearStream *stream);
|
||||
BatchBuffer() {}
|
||||
GraphicsAllocation *commandBufferAllocation = nullptr;
|
||||
size_t startOffset = 0u;
|
||||
size_t chainedBatchBufferStartOffset = 0u;
|
||||
GraphicsAllocation *chainedBatchBuffer = nullptr;
|
||||
bool requiresCoherency = false;
|
||||
bool low_priority = false;
|
||||
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
||||
uint64_t sliceCount = QueueSliceCount::defaultSliceCount;
|
||||
size_t usedSize = 0u;
|
||||
|
||||
//only used in drm csr in gem close worker active mode
|
||||
LinearStream *stream = nullptr;
|
||||
};
|
||||
|
||||
struct CommandBuffer : public IDNode<CommandBuffer> {
|
||||
CommandBuffer(Device &device);
|
||||
ResidencyContainer surfaces;
|
||||
BatchBuffer batchBuffer;
|
||||
void *batchBufferEndLocation = nullptr;
|
||||
uint32_t inspectionId = 0;
|
||||
uint32_t taskCount = 0u;
|
||||
void *pipeControlThatMayBeErasedLocation = nullptr;
|
||||
void *epiloguePipeControlLocation = nullptr;
|
||||
std::unique_ptr<FlushStampTracker> flushStamp;
|
||||
Device &device;
|
||||
};
|
||||
|
||||
struct CommandBufferList : public IDList<CommandBuffer, false, true, false> {};
|
||||
|
||||
using ResourcePackage = StackVec<GraphicsAllocation *, 128>;
|
||||
|
||||
class SubmissionAggregator {
|
||||
public:
|
||||
void recordCommandBuffer(CommandBuffer *commandBuffer);
|
||||
void aggregateCommandBuffers(ResourcePackage &resourcePackage, size_t &totalUsedSize, size_t totalMemoryBudget, uint32_t osContextId);
|
||||
CommandBufferList &peekCmdBufferList() { return cmdBuffers; }
|
||||
|
||||
protected:
|
||||
CommandBufferList cmdBuffers;
|
||||
uint32_t inspectionId = 1;
|
||||
};
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user