Skip to content

Commit

Permalink
Encapsulate creation of Scratch Space surface
Browse files Browse the repository at this point in the history
Change-Id: Ifd1d794e0d8b7053cf5c37bdd867ab64f84241cc
  • Loading branch information
zzdanowicz authored and Compute-Runtime-Automation committed Sep 13, 2018
1 parent 81a1e43 commit 888b067
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions runtime/command_stream/command_stream_receiver_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
void programOutOfDeviceWaitlistSemaphores(LinearStream &csr, DispatchFlags &dispatchFlags, Device &currentDevice);
virtual void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags);
virtual void initPageTableManagerRegisters(LinearStream &csr){};
void createScratchSpaceAllocation(size_t requiredScratchSizeInBytes);

void addPipeControlWA(LinearStream &commandStream, bool flushDC);
void addDcFlushToPipeControl(typename GfxFamily::PIPE_CONTROL *pCmd, bool flushDC);
Expand Down
7 changes: 6 additions & 1 deletion runtime/command_stream/command_stream_receiver_hw.inl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
scratchAllocation->taskCount = this->taskCount;
getMemoryManager()->storeAllocation(std::unique_ptr<GraphicsAllocation>(scratchAllocation), TEMPORARY_ALLOCATION);
}
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryInPreferredPool(true, nullptr, requiredScratchSizeInBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE);
createScratchSpaceAllocation(requiredScratchSizeInBytes);
overrideMediaVFEStateDirty(true);
if (is64bit && !force32BitAllocations) {
stateBaseAddressDirty = true;
Expand Down Expand Up @@ -800,4 +800,9 @@ void CommandStreamReceiverHw<GfxFamily>::programOutOfDeviceWaitlistSemaphores(Li
KernelCommandsHelper<GfxFamily>::programMiSemaphoreWait(csr, compareAddress, 1);
}
}

template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::createScratchSpaceAllocation(size_t requiredScratchSizeInBytes) {
scratchAllocation = getMemoryManager()->allocateGraphicsMemoryInPreferredPool(true, nullptr, requiredScratchSizeInBytes, GraphicsAllocation::AllocationType::SCRATCH_SURFACE);
}
} // namespace OCLRT
4 changes: 4 additions & 0 deletions unit_tests/libult/ult_command_stream_receiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
using BaseClass = CommandStreamReceiverHw<GfxFamily>;

public:
using BaseClass::createScratchSpaceAllocation;
using BaseClass::dshState;
using BaseClass::getScratchPatchAddress;
using BaseClass::hwInfo;
using BaseClass::indirectHeap;
using BaseClass::iohState;
Expand All @@ -57,7 +59,9 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
using BaseClass::CommandStreamReceiver::latestFlushedTaskCount;
using BaseClass::CommandStreamReceiver::latestSentStatelessMocsConfig;
using BaseClass::CommandStreamReceiver::mediaVfeStateDirty;
using BaseClass::CommandStreamReceiver::requiredScratchSize;
using BaseClass::CommandStreamReceiver::requiredThreadArbitrationPolicy;
using BaseClass::CommandStreamReceiver::scratchAllocation;
using BaseClass::CommandStreamReceiver::submissionAggregator;
using BaseClass::CommandStreamReceiver::taskCount;
using BaseClass::CommandStreamReceiver::taskLevel;
Expand Down

0 comments on commit 888b067

Please sign in to comment.