Add initial support for KernelArgsBuffer allocation

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2022-08-03 11:54:08 +00:00
committed by Compute-Runtime-Automation
parent d3796b2b2d
commit 98d776867f
42 changed files with 147 additions and 40 deletions

View File

@@ -324,6 +324,11 @@ void CommandStreamReceiver::cleanupResources() {
getMemoryManager()->freeGraphicsMemory(workPartitionAllocation);
workPartitionAllocation = nullptr;
}
if (kernelArgsBufferAllocation) {
getMemoryManager()->freeGraphicsMemory(kernelArgsBufferAllocation);
kernelArgsBufferAllocation = nullptr;
}
}
WaitStatus CommandStreamReceiver::waitForCompletionWithTimeout(const WaitParams &params, uint32_t taskCountToWait) {

View File

@@ -160,6 +160,7 @@ class CommandStreamReceiver {
GraphicsAllocation *getPreemptionAllocation() const { return preemptionAllocation; }
GraphicsAllocation *getGlobalFenceAllocation() const { return globalFenceAllocation; }
GraphicsAllocation *getWorkPartitionAllocation() const { return workPartitionAllocation; }
GraphicsAllocation *getKernelArgsBufferAllocation() const { return kernelArgsBufferAllocation; }
void requestStallingCommandsOnNextFlush() { stallingCommandsOnNextFlushRequired = true; }
bool isStallingCommandsOnNextFlushRequired() const { return stallingCommandsOnNextFlushRequired; }
@@ -192,6 +193,7 @@ class CommandStreamReceiver {
MOCKABLE_VIRTUAL bool createGlobalFenceAllocation();
MOCKABLE_VIRTUAL bool createPreemptionAllocation();
MOCKABLE_VIRTUAL bool createPerDssBackedBuffer(Device &device);
virtual void createKernelArgsBufferAllocation() = 0;
MOCKABLE_VIRTUAL std::unique_lock<MutexType> obtainUniqueOwnership();
bool peekTimestampPacketWriteEnabled() const { return timestampPacketWriteEnabled; }
@@ -405,6 +407,7 @@ class CommandStreamReceiver {
GraphicsAllocation *perDssBackedBuffer = nullptr;
GraphicsAllocation *clearColorAllocation = nullptr;
GraphicsAllocation *workPartitionAllocation = nullptr;
GraphicsAllocation *kernelArgsBufferAllocation = nullptr;
MultiGraphicsAllocation *tagsMultiAllocation = nullptr;

View File

@@ -176,6 +176,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
void configurePostSyncWriteOffset();
void unregisterDirectSubmissionFromController();
constexpr bool isGlobalAtomicsProgrammingRequired(bool currentValue) const;
void createKernelArgsBufferAllocation() override;
HeapDirtyState dshState;
HeapDirtyState iohState;

View File

@@ -345,6 +345,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
programPreemption(commandStreamCSR, dispatchFlags);
EncodeKernelArgsBuffer<GfxFamily>::encodeKernelArgsBufferCmds(kernelArgsBufferAllocation, logicalStateHelper.get());
if (stallingCommandsOnNextFlushRequired) {
programStallingCommandsForBarrier(commandStreamCSR, dispatchFlags);
}
@@ -421,8 +423,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
isMultiOsContextCapable(),
memoryCompressionState,
dispatchFlags.useGlobalAtomics,
dispatchFlags.areMultipleSubDevicesInContext,
logicalStateHelper.get());
dispatchFlags.areMultipleSubDevicesInContext);
if (pCmd) {
*pCmd = cmd;
@@ -539,6 +540,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
makeResident(*workPartitionAllocation);
}
if (kernelArgsBufferAllocation) {
makeResident(*kernelArgsBufferAllocation);
}
if (logicalStateHelper) {
logicalStateHelper->writeStreamInline(commandStreamCSR, false);
}
@@ -866,6 +871,8 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
size += TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(dispatchFlags.csrDependencies);
size += TimestampPacketHelper::getRequiredCmdStreamSizeForTaskCountContainer<GfxFamily>(dispatchFlags.csrDependencies);
size += EncodeKernelArgsBuffer<GfxFamily>::getKernelArgsBufferCmdsSize(kernelArgsBufferAllocation, logicalStateHelper.get());
if (stallingCommandsOnNextFlushRequired) {
size += getCmdSizeForStallingCommands(dispatchFlags);
}
@@ -1452,4 +1459,9 @@ template <typename GfxFamily>
constexpr bool CommandStreamReceiverHw<GfxFamily>::isGlobalAtomicsProgrammingRequired(bool currentVal) const {
return false;
}
template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::createKernelArgsBufferAllocation() {
}
} // namespace NEO