mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Improve TimestampPackets handling in blocked path
Change-Id: Idf381a8750cebec6196eb299661dda892e11144d Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
@@ -345,7 +345,7 @@ class CommandQueueHw : public CommandQueue {
|
||||
Surface **surfacesForResidency,
|
||||
size_t surfacesCount,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
TimestampPacketContainer &previousTimestampPacketNodes,
|
||||
TimestampPacketDependencies ×tampPacketDependencies,
|
||||
std::unique_ptr<KernelOperation> &blockedCommandsData,
|
||||
const EnqueueProperties &enqueueProperties,
|
||||
EventsRequest &eventsRequest,
|
||||
|
||||
@@ -354,7 +354,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
|
||||
surfacesForResidency,
|
||||
numSurfaceForResidency,
|
||||
multiDispatchInfo,
|
||||
timestampPacketDependencies.previousEnqueueNodes,
|
||||
timestampPacketDependencies,
|
||||
blockedCommandsData,
|
||||
enqueueProperties,
|
||||
eventsRequest,
|
||||
@@ -796,7 +796,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
|
||||
Surface **surfaces,
|
||||
size_t surfaceCount,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
TimestampPacketContainer &previousTimestampPacketNodes,
|
||||
TimestampPacketDependencies ×tampPacketDependencies,
|
||||
std::unique_ptr<KernelOperation> &blockedCommandsData,
|
||||
const EnqueueProperties &enqueueProperties,
|
||||
EventsRequest &eventsRequest,
|
||||
@@ -875,7 +875,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
|
||||
auto event = castToObjectOrAbort<Event>(eventsRequest.eventWaitList[i]);
|
||||
event->incRefInternal();
|
||||
}
|
||||
command->setTimestampPacketNode(*timestampPacketContainer, std::move(previousTimestampPacketNodes));
|
||||
command->setTimestampPacketNode(*timestampPacketContainer, std::move(timestampPacketDependencies));
|
||||
command->setEventsRequest(eventsRequest);
|
||||
}
|
||||
outEvent->setCommand(std::move(command));
|
||||
|
||||
@@ -252,14 +252,14 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
|
||||
return completionStamp;
|
||||
}
|
||||
|
||||
void CommandWithoutKernel::dispatchBlitOperation(TimestampPacketContainer &barrierTimestampPacketNodes) {
|
||||
void CommandWithoutKernel::dispatchBlitOperation() {
|
||||
auto bcsCsr = commandQueue.getBcsCommandStreamReceiver();
|
||||
|
||||
UNRECOVERABLE_IF(kernelOperation->blitPropertiesContainer.size() != 1);
|
||||
auto &blitProperties = *kernelOperation->blitPropertiesContainer.begin();
|
||||
blitProperties.csrDependencies.fillFromEventsRequest(eventsRequest, *bcsCsr, CsrDependencies::DependenciesType::All);
|
||||
blitProperties.csrDependencies.push_back(previousTimestampPacketNodes.get());
|
||||
blitProperties.csrDependencies.push_back(&barrierTimestampPacketNodes);
|
||||
blitProperties.csrDependencies.push_back(×tampPacketDependencies->previousEnqueueNodes);
|
||||
blitProperties.csrDependencies.push_back(×tampPacketDependencies->barrierNodes);
|
||||
blitProperties.outputTimestampPacket = currentTimestampPacketNodes->peekNodes()[0];
|
||||
|
||||
auto bcsTaskCount = bcsCsr->blitBuffer(kernelOperation->blitPropertiesContainer, false);
|
||||
@@ -283,18 +283,17 @@ CompletionStamp &CommandWithoutKernel::submit(uint32_t taskLevel, bool terminate
|
||||
}
|
||||
|
||||
auto lockCSR = commandStreamReceiver.obtainUniqueOwnership();
|
||||
TimestampPacketContainer barrierTimestampPacketNodes;
|
||||
|
||||
if (kernelOperation->blitEnqueue) {
|
||||
if (commandStreamReceiver.isStallingPipeControlOnNextFlushRequired()) {
|
||||
barrierTimestampPacketNodes.add(commandStreamReceiver.getTimestampPacketAllocator()->getTag());
|
||||
timestampPacketDependencies->barrierNodes.add(commandStreamReceiver.getTimestampPacketAllocator()->getTag());
|
||||
}
|
||||
dispatchBlitOperation(barrierTimestampPacketNodes);
|
||||
dispatchBlitOperation();
|
||||
}
|
||||
|
||||
DispatchFlags dispatchFlags(
|
||||
{}, //csrDependencies
|
||||
&barrierTimestampPacketNodes, //barrierTimestampPacketNodes
|
||||
×tampPacketDependencies->barrierNodes, //barrierTimestampPacketNodes
|
||||
{}, //pipelineSelectArgs
|
||||
commandQueue.flushStamp->getStampReference(), //flushStampReference
|
||||
commandQueue.getThrottle(), //throttle
|
||||
@@ -345,12 +344,12 @@ void Command::setEventsRequest(EventsRequest &eventsRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
void Command::setTimestampPacketNode(TimestampPacketContainer ¤t, TimestampPacketContainer &&previous) {
|
||||
void Command::setTimestampPacketNode(TimestampPacketContainer ¤t, TimestampPacketDependencies &&dependencies) {
|
||||
currentTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
|
||||
currentTimestampPacketNodes->assignAndIncrementNodesRefCounts(current);
|
||||
|
||||
previousTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
|
||||
*previousTimestampPacketNodes = std::move(previous);
|
||||
timestampPacketDependencies = std::make_unique<TimestampPacketDependencies>();
|
||||
*timestampPacketDependencies = std::move(dependencies);
|
||||
}
|
||||
|
||||
Command::~Command() {
|
||||
@@ -376,8 +375,8 @@ void Command::makeTimestampPacketsResident(CommandStreamReceiver &commandStreamR
|
||||
if (currentTimestampPacketNodes) {
|
||||
currentTimestampPacketNodes->makeResident(commandStreamReceiver);
|
||||
}
|
||||
if (previousTimestampPacketNodes) {
|
||||
previousTimestampPacketNodes->makeResident(commandStreamReceiver);
|
||||
if (timestampPacketDependencies) {
|
||||
timestampPacketDependencies->previousEnqueueNodes.makeResident(commandStreamReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class Command : public IFNode<Command> {
|
||||
virtual LinearStream *getCommandStream() {
|
||||
return nullptr;
|
||||
}
|
||||
void setTimestampPacketNode(TimestampPacketContainer ¤t, TimestampPacketContainer &&previous);
|
||||
void setTimestampPacketNode(TimestampPacketContainer ¤t, TimestampPacketDependencies &&dependencies);
|
||||
void setEventsRequest(EventsRequest &eventsRequest);
|
||||
void makeTimestampPacketsResident(CommandStreamReceiver &commandStreamReceiver);
|
||||
|
||||
@@ -105,7 +105,7 @@ class Command : public IFNode<Command> {
|
||||
CommandQueue &commandQueue;
|
||||
std::unique_ptr<KernelOperation> kernelOperation;
|
||||
std::unique_ptr<TimestampPacketContainer> currentTimestampPacketNodes;
|
||||
std::unique_ptr<TimestampPacketContainer> previousTimestampPacketNodes;
|
||||
std::unique_ptr<TimestampPacketDependencies> timestampPacketDependencies;
|
||||
EventsRequest eventsRequest = {0, nullptr, nullptr};
|
||||
std::vector<cl_event> eventsWaitlist;
|
||||
};
|
||||
@@ -152,6 +152,6 @@ class CommandWithoutKernel : public Command {
|
||||
public:
|
||||
using Command::Command;
|
||||
CompletionStamp &submit(uint32_t taskLevel, bool terminated) override;
|
||||
void dispatchBlitOperation(TimestampPacketContainer &barrierTimestampPacketNodes);
|
||||
void dispatchBlitOperation();
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -61,7 +61,7 @@ HWTEST_F(EnqueueHandlerTest, givenNonBlitPropertyWhenEnqueueIsBlockedThenDontReg
|
||||
|
||||
auto blockedCommandsDataForDependencyFlush = new KernelOperation(commandStream, *csr.getInternalAllocationStorage());
|
||||
|
||||
TimestampPacketContainer previousTimestampPacketNodes;
|
||||
TimestampPacketDependencies timestampPacketDependencies;
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
EventsRequest eventsRequest(0, nullptr, nullptr);
|
||||
EventBuilder eventBuilder;
|
||||
@@ -70,7 +70,7 @@ HWTEST_F(EnqueueHandlerTest, givenNonBlitPropertyWhenEnqueueIsBlockedThenDontReg
|
||||
|
||||
auto blockedCommandsData = std::unique_ptr<KernelOperation>(blockedCommandsDataForDependencyFlush);
|
||||
Surface *surfaces[] = {nullptr};
|
||||
mockCmdQ->enqueueBlocked(CL_COMMAND_MARKER, surfaces, size_t(0), multiDispatchInfo, previousTimestampPacketNodes,
|
||||
mockCmdQ->enqueueBlocked(CL_COMMAND_MARKER, surfaces, size_t(0), multiDispatchInfo, timestampPacketDependencies,
|
||||
blockedCommandsData, enqueuePropertiesForDependencyFlush, eventsRequest,
|
||||
eventBuilder, std::unique_ptr<PrintfHandler>(nullptr));
|
||||
EXPECT_FALSE(blockedCommandsDataForDependencyFlush->blitEnqueue);
|
||||
@@ -85,7 +85,7 @@ HWTEST_F(EnqueueHandlerTest, givenBlitPropertyWhenEnqueueIsBlockedThenRegisterBl
|
||||
|
||||
auto blockedCommandsDataForBlitEnqueue = new KernelOperation(commandStream, *csr.getInternalAllocationStorage());
|
||||
|
||||
TimestampPacketContainer previousTimestampPacketNodes;
|
||||
TimestampPacketDependencies timestampPacketDependencies;
|
||||
MultiDispatchInfo multiDispatchInfo;
|
||||
EventsRequest eventsRequest(0, nullptr, nullptr);
|
||||
EventBuilder eventBuilder;
|
||||
@@ -99,7 +99,7 @@ HWTEST_F(EnqueueHandlerTest, givenBlitPropertyWhenEnqueueIsBlockedThenRegisterBl
|
||||
|
||||
auto blockedCommandsData = std::unique_ptr<KernelOperation>(blockedCommandsDataForBlitEnqueue);
|
||||
Surface *surfaces[] = {nullptr};
|
||||
mockCmdQ->enqueueBlocked(CL_COMMAND_READ_BUFFER, surfaces, size_t(0), multiDispatchInfo, previousTimestampPacketNodes,
|
||||
mockCmdQ->enqueueBlocked(CL_COMMAND_READ_BUFFER, surfaces, size_t(0), multiDispatchInfo, timestampPacketDependencies,
|
||||
blockedCommandsData, enqueuePropertiesForBlitEnqueue, eventsRequest,
|
||||
eventBuilder, std::unique_ptr<PrintfHandler>(nullptr));
|
||||
EXPECT_TRUE(blockedCommandsDataForBlitEnqueue->blitEnqueue);
|
||||
|
||||
@@ -258,7 +258,9 @@ HWTEST_F(DispatchFlagsTests, givenCommandWithoutKernelWhenSubmitThenPassCorrectD
|
||||
auto mockCsr = static_cast<CsrType *>(&mockCmdQ->getGpgpuCommandStreamReceiver());
|
||||
|
||||
mockCsr->timestampPacketWriteEnabled = true;
|
||||
mockCmdQ->timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
|
||||
IndirectHeap *ih1 = nullptr, *ih2 = nullptr, *ih3 = nullptr;
|
||||
TimestampPacketDependencies timestampPacketDependencies;
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 1, ih1);
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::INDIRECT_OBJECT, 1, ih2);
|
||||
mockCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 1, ih3);
|
||||
@@ -267,6 +269,7 @@ HWTEST_F(DispatchFlagsTests, givenCommandWithoutKernelWhenSubmitThenPassCorrectD
|
||||
auto kernelOperation = std::make_unique<KernelOperation>(cmdStream, *mockCmdQ->getGpgpuCommandStreamReceiver().getInternalAllocationStorage());
|
||||
kernelOperation->setHeaps(ih1, ih2, ih3);
|
||||
std::unique_ptr<Command> command(new CommandWithoutKernel(*mockCmdQ, kernelOperation));
|
||||
command->setTimestampPacketNode(*mockCmdQ->timestampPacketContainer, std::move(timestampPacketDependencies));
|
||||
|
||||
command->submit(20, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user