mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
Extend batch buffer flattening in AubCSR to BatchedDispatch mode
- batch buffer flatening in batched mode
- added MI_USER_INTERRUPT command
- added GUC Work Queue Item
Change-Id: I35142da34b30d3006bb4ffc1521db7f6ebe68ebc
This commit is contained in:
@@ -63,13 +63,10 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
|
||||
MemoryManager *createMemoryManager(bool enable64kbPages) override {
|
||||
this->memoryManager = new OsAgnosticMemoryManager(enable64kbPages);
|
||||
this->flatBatchBufferHelper->setMemoryManager(this->memoryManager);
|
||||
return this->memoryManager;
|
||||
}
|
||||
|
||||
bool setPatchInfoData(PatchInfoData &data) override;
|
||||
|
||||
std::vector<PatchInfoData> patchInfoCollection;
|
||||
|
||||
static const AubMemDump::LrcaHelper &getCsTraits(EngineType engineType);
|
||||
|
||||
struct EngineInfo {
|
||||
@@ -91,7 +88,8 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw<GfxFamily> {
|
||||
// remap CPU VA -> GGTT VA
|
||||
AddressMapper gttRemap;
|
||||
|
||||
MOCKABLE_VIRTUAL void *flattenBatchBuffer(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer);
|
||||
MOCKABLE_VIRTUAL bool addPatchInfoComments();
|
||||
void addGUCStartMessage(uint64_t batchBufferAddress, EngineType engineType);
|
||||
uint32_t getGUCWorkQueueItemHeader(EngineType engineType);
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -37,9 +37,9 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
|
||||
: BaseClass(hwInfoIn),
|
||||
stream(std::unique_ptr<AUBCommandStreamReceiver::AubFileStream>(new AUBCommandStreamReceiver::AubFileStream())),
|
||||
standalone(standalone) {
|
||||
this->dispatchMode = CommandStreamReceiver::DispatchMode::BatchedDispatch;
|
||||
this->dispatchMode = DispatchMode::BatchedDispatch;
|
||||
if (DebugManager.flags.CsrDispatchMode.get()) {
|
||||
this->dispatchMode = (CommandStreamReceiver::DispatchMode)DebugManager.flags.CsrDispatchMode.get();
|
||||
this->dispatchMode = (DispatchMode)DebugManager.flags.CsrDispatchMode.get();
|
||||
}
|
||||
for (auto &engineInfo : engineInfoTable) {
|
||||
engineInfo.pLRCA = nullptr;
|
||||
@@ -221,8 +221,8 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
auto sizeBatchBuffer = currentOffset - batchBuffer.startOffset;
|
||||
|
||||
std::unique_ptr<void, std::function<void(void *)>> flatBatchBuffer(nullptr, [&](void *ptr) { this->getMemoryManager()->alignedFreeWrapper(ptr); });
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get() && (this->dispatchMode == CommandStreamReceiver::DispatchMode::ImmediateDispatch)) {
|
||||
flatBatchBuffer.reset(flattenBatchBuffer(batchBuffer, sizeBatchBuffer));
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBuffer.reset(this->flatBatchBufferHelper->flattenBatchBuffer(batchBuffer, sizeBatchBuffer, this->dispatchMode));
|
||||
if (flatBatchBuffer.get() != nullptr) {
|
||||
pBatchBuffer = flatBatchBuffer.get();
|
||||
}
|
||||
@@ -248,7 +248,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
}
|
||||
|
||||
if (this->standalone) {
|
||||
if (this->dispatchMode == CommandStreamReceiver::DispatchMode::ImmediateDispatch) {
|
||||
if (this->dispatchMode == DispatchMode::ImmediateDispatch) {
|
||||
if (!DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
makeResident(*batchBuffer.commandBufferAllocation);
|
||||
}
|
||||
@@ -259,6 +259,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
processResidency(allocationsForResidency);
|
||||
}
|
||||
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
addGUCStartMessage(static_cast<uint64_t>(reinterpret_cast<std::uintptr_t>(pBatchBuffer)), engineType);
|
||||
addPatchInfoComments();
|
||||
}
|
||||
|
||||
@@ -387,32 +388,13 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void *AUBCommandStreamReceiverHw<GfxFamily>::flattenBatchBuffer(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer) {
|
||||
void *flatBatchBuffer = nullptr;
|
||||
|
||||
if (batchBuffer.chainedBatchBuffer) {
|
||||
batchBuffer.chainedBatchBuffer->setTypeAubNonWritable();
|
||||
auto sizeMainBatchBuffer = batchBuffer.chainedBatchBufferStartOffset - batchBuffer.startOffset;
|
||||
auto flatBatchBufferSize = alignUp(sizeMainBatchBuffer + batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), MemoryConstants::pageSize);
|
||||
flatBatchBuffer = this->getMemoryManager()->alignedMallocWrapper(flatBatchBufferSize, MemoryConstants::pageSize);
|
||||
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);
|
||||
// Copy FLB
|
||||
memcpy_s(flatBatchBuffer, sizeMainBatchBuffer, ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.startOffset), sizeMainBatchBuffer);
|
||||
// Copy SLB
|
||||
memcpy_s(ptrOffset(flatBatchBuffer, sizeMainBatchBuffer), batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), batchBuffer.chainedBatchBuffer->getUnderlyingBuffer(), batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize());
|
||||
sizeBatchBuffer = flatBatchBufferSize;
|
||||
}
|
||||
return flatBatchBuffer;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::addPatchInfoComments() {
|
||||
std::map<uint64_t, uint64_t> allocationsMap;
|
||||
|
||||
std::ostringstream str;
|
||||
str << "PatchInfoData" << std::endl;
|
||||
for (auto &patchInfoData : this->patchInfoCollection) {
|
||||
for (auto &patchInfoData : this->flatBatchBufferHelper->getPatchInfoCollection()) {
|
||||
str << std::hex << patchInfoData.sourceAllocation << ";";
|
||||
str << std::hex << patchInfoData.sourceAllocationOffset << ";";
|
||||
str << std::hex << patchInfoData.sourceType << ";";
|
||||
@@ -432,7 +414,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::addPatchInfoComments() {
|
||||
}
|
||||
}
|
||||
bool result = stream->addComment(str.str().c_str());
|
||||
this->patchInfoCollection.clear();
|
||||
this->flatBatchBufferHelper->getPatchInfoCollection().clear();
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
@@ -547,8 +529,41 @@ void AUBCommandStreamReceiverHw<GfxFamily>::addContextToken() {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::setPatchInfoData(PatchInfoData &data) {
|
||||
patchInfoCollection.push_back(data);
|
||||
return true;
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::addGUCStartMessage(uint64_t batchBufferAddress, EngineType engineType) {
|
||||
typedef typename GfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
||||
|
||||
auto bufferSize = sizeof(uint32_t) + sizeof(MI_BATCH_BUFFER_START);
|
||||
|
||||
std::unique_ptr<void, std::function<void(void *)>> buffer(this->getMemoryManager()->alignedMallocWrapper(bufferSize, MemoryConstants::pageSize), [&](void *ptr) { this->getMemoryManager()->alignedFreeWrapper(ptr); });
|
||||
LinearStream linearStream(buffer.get(), bufferSize);
|
||||
|
||||
uint32_t *header = static_cast<uint32_t *>(linearStream.getSpace(sizeof(uint32_t)));
|
||||
*header = getGUCWorkQueueItemHeader(engineType);
|
||||
|
||||
MI_BATCH_BUFFER_START *miBatchBufferStart = linearStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
|
||||
DEBUG_BREAK_IF(bufferSize != linearStream.getUsed());
|
||||
miBatchBufferStart->init();
|
||||
miBatchBufferStart->setBatchBufferStartAddressGraphicsaddress472(AUB::ptrToPPGTT(buffer.get()));
|
||||
miBatchBufferStart->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
|
||||
|
||||
auto physBufferAddres = ppgtt.map(reinterpret_cast<uintptr_t>(buffer.get()), bufferSize);
|
||||
AUB::reserveAddressPPGTT(*stream, reinterpret_cast<uintptr_t>(buffer.get()), bufferSize, physBufferAddres);
|
||||
|
||||
AUB::addMemoryWrite(
|
||||
*stream,
|
||||
physBufferAddres,
|
||||
buffer.get(),
|
||||
bufferSize,
|
||||
AubMemDump::AddressSpaceValues::TraceNonlocal);
|
||||
|
||||
PatchInfoData patchInfoData(batchBufferAddress, 0u, PatchInfoAllocationType::Default, reinterpret_cast<uintptr_t>(buffer.get()), sizeof(uint32_t) + sizeof(MI_BATCH_BUFFER_START) - sizeof(uint64_t), PatchInfoAllocationType::GUCStartMessage);
|
||||
this->flatBatchBufferHelper->setPatchInfoData(patchInfoData);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getGUCWorkQueueItemHeader(EngineType engineType) {
|
||||
uint32_t GUCWorkQueueItemHeader = 0x00030001;
|
||||
return GUCWorkQueueItemHeader;
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -127,6 +127,9 @@ MemoryManager *CommandStreamReceiver::getMemoryManager() {
|
||||
|
||||
void CommandStreamReceiver::setMemoryManager(MemoryManager *mm) {
|
||||
memoryManager = mm;
|
||||
if (flatBatchBufferHelper) {
|
||||
flatBatchBufferHelper->setMemoryManager(mm);
|
||||
}
|
||||
}
|
||||
|
||||
LinearStream &CommandStreamReceiver::getCS(size_t minRequiredSize) {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "runtime/helpers/completion_stamp.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/address_patch.h"
|
||||
#include "runtime/helpers/flat_batch_buffer_helper.h"
|
||||
#include "runtime/command_stream/csr_definitions.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -40,16 +41,16 @@ class MemoryManager;
|
||||
class OSInterface;
|
||||
class GraphicsAllocation;
|
||||
|
||||
enum class DispatchMode {
|
||||
DeviceDefault = 0, //default for given device
|
||||
ImmediateDispatch, //everything is submitted to the HW immediately
|
||||
AdaptiveDispatch, //dispatching is handled to async thread, which combines batch buffers basing on load (not implemented)
|
||||
BatchedDispatchWithCounter, //dispatching is batched, after n commands there is implicit flush (not implemented)
|
||||
BatchedDispatch // dispatching is batched, explicit clFlush is required
|
||||
};
|
||||
|
||||
class CommandStreamReceiver {
|
||||
public:
|
||||
enum DispatchMode {
|
||||
DeviceDefault = 0, //default for given device
|
||||
ImmediateDispatch, //everything is submitted to the HW immediately
|
||||
AdaptiveDispatch, //dispatching is handled to async thread, which combines batch buffers basing on load (not implemented)
|
||||
BatchedDispatchWithCounter, //dispatching is batched, after n commands there is implicit flush (not implemented)
|
||||
BatchedDispatch // dispatching is batched, explicit clFlush is required
|
||||
};
|
||||
|
||||
enum class SamplerCacheFlushState {
|
||||
samplerCacheFlushNotRequired,
|
||||
samplerCacheFlushBefore, //add sampler cache flush before Walker with redescribed image
|
||||
@@ -102,7 +103,7 @@ class CommandStreamReceiver {
|
||||
|
||||
uint32_t peekLatestFlushedTaskCount() const { return latestFlushedTaskCount; }
|
||||
|
||||
void overrideDispatchPolicy(CommandStreamReceiver::DispatchMode overrideValue) { this->dispatchMode = overrideValue; }
|
||||
void overrideDispatchPolicy(DispatchMode overrideValue) { this->dispatchMode = overrideValue; }
|
||||
|
||||
virtual void overrideMediaVFEStateDirty(bool dirty) { mediaVfeStateDirty = dirty; }
|
||||
|
||||
@@ -122,8 +123,8 @@ class CommandStreamReceiver {
|
||||
|
||||
void setSamplerCacheFlushRequired(SamplerCacheFlushState value) { this->samplerCacheFlushRequired = value; }
|
||||
|
||||
// Collect patch info data
|
||||
virtual bool setPatchInfoData(PatchInfoData &data) { return false; }
|
||||
FlatBatchBufferHelper &getFlatBatchBufferHelper() { return *flatBatchBufferHelper.get(); }
|
||||
void overwriteFlatBatchBufferHelper(FlatBatchBufferHelper *newHelper) { flatBatchBufferHelper.reset(newHelper); }
|
||||
|
||||
protected:
|
||||
void setDisableL3Cache(bool val) {
|
||||
@@ -167,11 +168,12 @@ class CommandStreamReceiver {
|
||||
std::unique_ptr<OSInterface> osInterface;
|
||||
std::unique_ptr<SubmissionAggregator> submissionAggregator;
|
||||
|
||||
DispatchMode dispatchMode = ImmediateDispatch;
|
||||
DispatchMode dispatchMode = DispatchMode::ImmediateDispatch;
|
||||
bool disableL3Cache = false;
|
||||
uint32_t requiredScratchSize = 0;
|
||||
uint64_t totalMemoryUsed = 0u;
|
||||
SamplerCacheFlushState samplerCacheFlushRequired = SamplerCacheFlushState::samplerCacheFlushNotRequired;
|
||||
std::unique_ptr<FlatBatchBufferHelper> flatBatchBufferHelper;
|
||||
};
|
||||
|
||||
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump);
|
||||
|
||||
@@ -55,7 +55,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
int getRequiredPipeControlSize() const;
|
||||
|
||||
static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation);
|
||||
static void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress);
|
||||
void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress);
|
||||
static void alignToCacheLine(LinearStream &commandStream);
|
||||
|
||||
size_t getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags);
|
||||
@@ -71,13 +71,12 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
const HardwareInfo &peekHwInfo() const { return hwInfo; }
|
||||
|
||||
void collectStateBaseAddresPatchInfo(
|
||||
uint64_t baseAddress,
|
||||
uint64_t commandBufferAddress,
|
||||
uint64_t commandOffset,
|
||||
const LinearStream &dsh,
|
||||
const LinearStream &ioh,
|
||||
const LinearStream &ssh,
|
||||
uint64_t generalStateBase,
|
||||
uint64_t internalHeapBaseAddress);
|
||||
uint64_t generalStateBase);
|
||||
|
||||
void resetKmdNotifyHelper(KmdNotifyHelper *newHelper);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
#include "runtime/helpers/cache_policy.h"
|
||||
#include "runtime/helpers/flat_batch_buffer_helper_hw.h"
|
||||
#include "runtime/helpers/preamble.h"
|
||||
#include "runtime/helpers/ptr_math.h"
|
||||
#include "runtime/helpers/state_base_address.h"
|
||||
@@ -41,6 +42,7 @@ template <typename GfxFamily>
|
||||
CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(const HardwareInfo &hwInfoIn) : hwInfo(hwInfoIn) {
|
||||
requiredThreadArbitrationPolicy = PreambleHelper<GfxFamily>::getDefaultThreadArbitrationPolicy();
|
||||
resetKmdNotifyHelper(new KmdNotifyHelper(&(hwInfoIn.capabilityTable.kmdNotifyProperties)));
|
||||
flatBatchBufferHelper.reset(new FlatBatchBufferHelperHw<GfxFamily>(this->memoryManager));
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@@ -64,6 +66,9 @@ inline void CommandStreamReceiverHw<GfxFamily>::addBatchBufferStart(MI_BATCH_BUF
|
||||
*commandBufferMemory = GfxFamily::cmdInitBatchBufferStart;
|
||||
commandBufferMemory->setBatchBufferStartAddressGraphicsaddress472(startAddress);
|
||||
commandBufferMemory->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerBatchBufferStartAddress(reinterpret_cast<uint64_t>(commandBufferMemory), startAddress);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@@ -135,7 +140,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
Device *device = this->getMemoryManager()->device;
|
||||
|
||||
if (dispatchFlags.blocking || dispatchFlags.dcFlush || dispatchFlags.guardCommandBufferWithPipeControl) {
|
||||
if (this->dispatchMode == ImmediateDispatch) {
|
||||
if (this->dispatchMode == DispatchMode::ImmediateDispatch) {
|
||||
//for ImmediateDispatch we will send this right away, therefore this pipe control will close the level
|
||||
//for BatchedSubmissions it will be nooped and only last ppc in batch will be emitted.
|
||||
levelClosed = true;
|
||||
@@ -178,6 +183,18 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
|
||||
this->latestSentTaskCount = taskCount + 1;
|
||||
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", taskCount);
|
||||
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
flatBatchBufferHelper->setPatchInfoData(PatchInfoData(address, 0u,
|
||||
PatchInfoAllocationType::TagAddress,
|
||||
commandStreamTask.getGraphicsAllocation()->getGpuAddress(),
|
||||
commandStreamTask.getUsed() - 2 * sizeof(uint64_t),
|
||||
PatchInfoAllocationType::Default));
|
||||
flatBatchBufferHelper->setPatchInfoData(PatchInfoData(address, 0u,
|
||||
PatchInfoAllocationType::TagValue,
|
||||
commandStreamTask.getGraphicsAllocation()->getGpuAddress(),
|
||||
commandStreamTask.getUsed() - sizeof(uint64_t),
|
||||
PatchInfoAllocationType::Default));
|
||||
}
|
||||
}
|
||||
|
||||
if (DebugManager.flags.ForceSLML3Config.get()) {
|
||||
@@ -277,7 +294,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
latestSentStatelessMocsConfig = requiredL3Index;
|
||||
|
||||
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
collectStateBaseAddresPatchInfo(commandStream.getGpuBase(), stateBaseAddressCmdOffset, dsh, ioh, ssh, newGSHbase, memoryManager->getInternalHeapBaseAddress());
|
||||
collectStateBaseAddresPatchInfo(commandStream.getGraphicsAllocation()->getGpuAddress(), stateBaseAddressCmdOffset, dsh, ioh, ssh, newGSHbase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,6 +361,14 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
// Add MI_BATCH_BUFFER_START to chain from CSR -> Task
|
||||
auto pBBS = reinterpret_cast<MI_BATCH_BUFFER_START *>(commandStreamCSR.getSpace(sizeof(MI_BATCH_BUFFER_START)));
|
||||
addBatchBufferStart(pBBS, ptrOffset(commandStreamTask.getGraphicsAllocation()->getGpuAddress(), commandStreamStartTask));
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(commandStreamTask.getGraphicsAllocation()->getGpuAddress(),
|
||||
reinterpret_cast<uint64_t>(commandStreamTask.getCpuBase()),
|
||||
commandStreamStartTask,
|
||||
static_cast<uint64_t>(ptrDiff(bbEndLocation,
|
||||
commandStreamTask.getGraphicsAllocation()->getGpuAddress())) +
|
||||
sizeof(MI_BATCH_BUFFER_START));
|
||||
}
|
||||
|
||||
auto commandStreamAllocation = commandStreamTask.getGraphicsAllocation();
|
||||
DEBUG_BREAK_IF(commandStreamAllocation == nullptr);
|
||||
@@ -418,7 +443,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
if (this->dispatchMode == this->ImmediateDispatch) {
|
||||
if (this->dispatchMode == DispatchMode::ImmediateDispatch) {
|
||||
return;
|
||||
}
|
||||
typedef typename GfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
||||
@@ -449,9 +474,15 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
currentPipeControlForNooping = primaryCmdBuffer->pipeControlThatMayBeErasedLocation;
|
||||
epiloguePipeControlLocation = primaryCmdBuffer->epiloguePipeControlLocation;
|
||||
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(primaryCmdBuffer.get()->batchBuffer, sizeof(MI_BATCH_BUFFER_START));
|
||||
}
|
||||
while (nextCommandBuffer && nextCommandBuffer->inspectionId == primaryCmdBuffer->inspectionId) {
|
||||
//noop pipe control
|
||||
if (currentPipeControlForNooping) {
|
||||
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
flatBatchBufferHelper->removePipeControlData(pipeControlLocationSize, currentPipeControlForNooping);
|
||||
}
|
||||
memset(currentPipeControlForNooping, 0, pipeControlLocationSize);
|
||||
}
|
||||
//obtain next candidate for nooping
|
||||
@@ -463,6 +494,10 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
auto nextCommandBufferAddress = nextCommandBuffer->batchBuffer.commandBufferAllocation->getUnderlyingBuffer();
|
||||
auto offsetedCommandBuffer = (uint64_t)ptrOffset(nextCommandBufferAddress, nextCommandBuffer->batchBuffer.startOffset);
|
||||
addBatchBufferStart((MI_BATCH_BUFFER_START *)currentBBendLocation, offsetedCommandBuffer);
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(nextCommandBuffer->batchBuffer, sizeof(MI_BATCH_BUFFER_START));
|
||||
}
|
||||
|
||||
currentBBendLocation = nextCommandBuffer->batchBufferEndLocation;
|
||||
lastTaskCount = nextCommandBuffer->taskCount;
|
||||
nextCommandBuffer = nextCommandBuffer->next;
|
||||
@@ -659,22 +694,19 @@ void CommandStreamReceiverHw<GfxFamily>::collectStateBaseAddresPatchInfo(
|
||||
const LinearStream &dsh,
|
||||
const LinearStream &ioh,
|
||||
const LinearStream &ssh,
|
||||
uint64_t generalStateBase,
|
||||
uint64_t internalHeapOffset) {
|
||||
uint64_t generalStateBase) {
|
||||
|
||||
typedef typename GfxFamily::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
|
||||
|
||||
PatchInfoData dynamicStatePatchInfo = {dsh.getGpuBase(), 0u, PatchInfoAllocationType::DynamicStateHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::DYNAMICSTATEBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData dynamicStatePatchInfo = {dsh.getGraphicsAllocation()->getGpuAddress(), 0u, PatchInfoAllocationType::DynamicStateHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::DYNAMICSTATEBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData generalStatePatchInfo = {generalStateBase, 0u, PatchInfoAllocationType::GeneralStateHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::GENERALSTATEBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData surfaceStatePatchInfo = {ssh.getGpuBase(), 0u, PatchInfoAllocationType::SurfaceStateHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::SURFACESTATEBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData indirectObjectPatchInfo = {ioh.getGpuBase(), 0u, PatchInfoAllocationType::IndirectObjectHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::INDIRECTOBJECTBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData instructionPatchInfo = {internalHeapOffset, 0u, PatchInfoAllocationType::InstructionHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::INSTRUCTIONBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData surfaceStatePatchInfo = {ssh.getGraphicsAllocation()->getGpuAddress(), 0u, PatchInfoAllocationType::SurfaceStateHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::SURFACESTATEBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
PatchInfoData indirectObjectPatchInfo = {ioh.getGraphicsAllocation()->getGpuAddress(), 0u, PatchInfoAllocationType::IndirectObjectHeap, baseAddress, commandOffset + STATE_BASE_ADDRESS::PATCH_CONSTANTS::INDIRECTOBJECTBASEADDRESS_BYTEOFFSET, PatchInfoAllocationType::Default};
|
||||
|
||||
setPatchInfoData(dynamicStatePatchInfo);
|
||||
setPatchInfoData(generalStatePatchInfo);
|
||||
setPatchInfoData(surfaceStatePatchInfo);
|
||||
setPatchInfoData(indirectObjectPatchInfo);
|
||||
setPatchInfoData(instructionPatchInfo);
|
||||
flatBatchBufferHelper->setPatchInfoData(dynamicStatePatchInfo);
|
||||
flatBatchBufferHelper->setPatchInfoData(generalStatePatchInfo);
|
||||
flatBatchBufferHelper->setPatchInfoData(surfaceStatePatchInfo);
|
||||
flatBatchBufferHelper->setPatchInfoData(indirectObjectPatchInfo);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
Reference in New Issue
Block a user