[21/n] Remove Instruction Heap from enqueue path.

- This removes Instruction Heap allocation from enqueue path
- Blocked path is handled as well
- Heap is no longer allocated on demand it is bind to kernelInfo.

Change-Id: I54545beceed3404ee0330a8bac2b0934944cac30
This commit is contained in:
Mrozek, Michal 2018-03-28 19:21:07 +02:00
parent f2b96fa508
commit 2be5934096
21 changed files with 49 additions and 277 deletions

View File

@ -438,7 +438,7 @@ void dispatchWalker(
unsigned int commandType = 0) { unsigned int commandType = 0) {
OCLRT::LinearStream *commandStream = nullptr; OCLRT::LinearStream *commandStream = nullptr;
OCLRT::IndirectHeap *dsh = nullptr, *ish = nullptr, *ioh = nullptr, *ssh = nullptr; OCLRT::IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
bool executionModelKernel = multiDispatchInfo.begin()->getKernel()->isParentKernel; bool executionModelKernel = multiDispatchInfo.begin()->getKernel()->isParentKernel;
for (auto &dispatchInfo : multiDispatchInfo) { for (auto &dispatchInfo : multiDispatchInfo) {
@ -450,7 +450,6 @@ void dispatchWalker(
} }
// Allocate command stream and indirect heaps // Allocate command stream and indirect heaps
size_t cmdQInstructionHeapReservedBlockSize = 0;
if (blockQueue) { if (blockQueue) {
using KCH = KernelCommandsHelper<GfxFamily>; using KCH = KernelCommandsHelper<GfxFamily>;
commandStream = new LinearStream(alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize), MemoryConstants::pageSize); commandStream = new LinearStream(alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize), MemoryConstants::pageSize);
@ -465,13 +464,10 @@ void dispatchWalker(
dsh = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredDSH(multiDispatchInfo); }); dsh = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredDSH(multiDispatchInfo); });
ioh = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredIOH(multiDispatchInfo); }); ioh = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredIOH(multiDispatchInfo); });
} }
ish = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredIH(multiDispatchInfo); });
cmdQInstructionHeapReservedBlockSize = commandQueue.getInstructionHeapReservedBlockSize();
ssh = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredSSH(multiDispatchInfo); }); ssh = allocateIndirectHeap([&multiDispatchInfo] { return KCH::getTotalSizeRequiredSSH(multiDispatchInfo); });
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
*blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(commandStream), UniqueIH(dsh), *blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(commandStream), UniqueIH(dsh), UniqueIH(ioh), UniqueIH(ssh));
UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh));
if (executionModelKernel) { if (executionModelKernel) {
(*blockedCommandsData)->doNotFreeISH = true; (*blockedCommandsData)->doNotFreeISH = true;
} }
@ -481,7 +477,6 @@ void dispatchWalker(
commandQueue.releaseIndirectHeap(IndirectHeap::SURFACE_STATE); commandQueue.releaseIndirectHeap(IndirectHeap::SURFACE_STATE);
} }
dsh = &getIndirectHeap<GfxFamily, IndirectHeap::DYNAMIC_STATE>(commandQueue, multiDispatchInfo); dsh = &getIndirectHeap<GfxFamily, IndirectHeap::DYNAMIC_STATE>(commandQueue, multiDispatchInfo);
ish = &getIndirectHeap<GfxFamily, IndirectHeap::INSTRUCTION>(commandQueue, multiDispatchInfo);
ioh = &getIndirectHeap<GfxFamily, IndirectHeap::INDIRECT_OBJECT>(commandQueue, multiDispatchInfo); ioh = &getIndirectHeap<GfxFamily, IndirectHeap::INDIRECT_OBJECT>(commandQueue, multiDispatchInfo);
ssh = &getIndirectHeap<GfxFamily, IndirectHeap::SURFACE_STATE>(commandQueue, multiDispatchInfo); ssh = &getIndirectHeap<GfxFamily, IndirectHeap::SURFACE_STATE>(commandQueue, multiDispatchInfo);
} }
@ -680,13 +675,12 @@ void dispatchScheduler(
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
OCLRT::LinearStream *commandStream = nullptr; OCLRT::LinearStream *commandStream = nullptr;
OCLRT::IndirectHeap *dsh = nullptr, *ish = nullptr, *ioh = nullptr, *ssh = nullptr; OCLRT::IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
commandStream = &commandQueue.getCS(0); commandStream = &commandQueue.getCS(0);
// note : below code assumes that caller to dispatchScheduler "preallocated" memory // note : below code assumes that caller to dispatchScheduler "preallocated" memory
// required for execution model in below heap managers // required for execution model in below heap managers
dsh = devQueueHw.getIndirectHeap(IndirectHeap::DYNAMIC_STATE); dsh = devQueueHw.getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
ish = &commandQueue.getIndirectHeap(IndirectHeap::INSTRUCTION);
ssh = &commandQueue.getIndirectHeap(IndirectHeap::SURFACE_STATE); ssh = &commandQueue.getIndirectHeap(IndirectHeap::SURFACE_STATE);
bool dcFlush = false; bool dcFlush = false;
@ -919,14 +913,13 @@ IndirectHeap &getIndirectHeap(CommandQueue &commandQueue, const MultiDispatchInf
// clang-format off // clang-format off
switch(heapType) { switch(heapType) {
case IndirectHeap::DYNAMIC_STATE: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredDSH(multiDispatchInfo); break; case IndirectHeap::DYNAMIC_STATE: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredDSH(multiDispatchInfo); break;
case IndirectHeap::INSTRUCTION: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredIH( multiDispatchInfo); break;
case IndirectHeap::INDIRECT_OBJECT: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredIOH(multiDispatchInfo); break; case IndirectHeap::INDIRECT_OBJECT: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredIOH(multiDispatchInfo); break;
case IndirectHeap::SURFACE_STATE: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredSSH(multiDispatchInfo); break; case IndirectHeap::SURFACE_STATE: expectedSize = KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredSSH(multiDispatchInfo); break;
} }
// clang-format on // clang-format on
if (multiDispatchInfo.begin()->getKernel()->isParentKernel) { if (multiDispatchInfo.begin()->getKernel()->isParentKernel) {
if (heapType == IndirectHeap::INSTRUCTION || heapType == IndirectHeap::SURFACE_STATE) { if (heapType == IndirectHeap::SURFACE_STATE) {
expectedSize += KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<heapType>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel()))); expectedSize += KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<heapType>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel())));
} else //if (heapType == IndirectHeap::DYNAMIC_STATE || heapType == IndirectHeap::INDIRECT_OBJECT) } else //if (heapType == IndirectHeap::DYNAMIC_STATE || heapType == IndirectHeap::INDIRECT_OBJECT)
{ {

View File

@ -271,12 +271,10 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
CompletionStamp completionStamp; CompletionStamp completionStamp;
if (!blockQueue) { if (!blockQueue) {
if (executionModelKernel) { if (executionModelKernel) {
size_t minSizeISHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel())));
size_t minSizeSSHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel()))); size_t minSizeSSHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel())));
uint32_t taskCount = commandStreamReceiver.peekTaskCount() + 1; uint32_t taskCount = commandStreamReceiver.peekTaskCount() + 1;
devQueueHw->setupExecutionModelDispatch(getIndirectHeap(IndirectHeap::INSTRUCTION, minSizeISHForEM), devQueueHw->setupExecutionModelDispatch(getIndirectHeap(IndirectHeap::SURFACE_STATE, minSizeSSHForEM),
getIndirectHeap(IndirectHeap::SURFACE_STATE, minSizeSSHForEM),
multiDispatchInfo.begin()->getKernel(), multiDispatchInfo.begin()->getKernel(),
(uint32_t)multiDispatchInfo.size(), (uint32_t)multiDispatchInfo.size(),
taskCount, taskCount,
@ -385,9 +383,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
if (blockQueue) { if (blockQueue) {
if (executionModelKernel) { if (executionModelKernel) {
size_t minSizeISHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel())));
size_t minSizeSSHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel()))); size_t minSizeSSHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*(multiDispatchInfo.begin()->getKernel())));
blockedCommandsData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandsData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandsData->surfaceStateHeapSizeEM = minSizeSSHForEM;
} }

View File

@ -156,12 +156,12 @@ void DeviceQueue::initDeviceQueue() {
igilEventPool->m_size = caps.maxOnDeviceEvents; igilEventPool->m_size = caps.maxOnDeviceEvents;
} }
void DeviceQueue::setupExecutionModelDispatch(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentCount, uint32_t taskCount, HwTimeStamps *hwTimeStamp) { void DeviceQueue::setupExecutionModelDispatch(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentCount, uint32_t taskCount, HwTimeStamps *hwTimeStamp) {
setupIndirectState(instructionHeap, surfaceStateHeap, parentKernel, parentCount); setupIndirectState(surfaceStateHeap, parentKernel, parentCount);
addExecutionModelCleanUpSection(parentKernel, hwTimeStamp, taskCount); addExecutionModelCleanUpSection(parentKernel, hwTimeStamp, taskCount);
} }
void DeviceQueue::setupIndirectState(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) { void DeviceQueue::setupIndirectState(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) {
return; return;
} }

View File

@ -81,9 +81,9 @@ class DeviceQueue : public BaseObject<_device_queue> {
size_t paramValueSize, void *paramValue, size_t paramValueSize, void *paramValue,
size_t *paramValueSizeRet); size_t *paramValueSizeRet);
void setupExecutionModelDispatch(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentCount, uint32_t taskCount, HwTimeStamps *hwTimeStamp); void setupExecutionModelDispatch(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentCount, uint32_t taskCount, HwTimeStamps *hwTimeStamp);
virtual void setupIndirectState(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount); virtual void setupIndirectState(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount);
virtual void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount); virtual void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount);
MOCKABLE_VIRTUAL bool isEMCriticalSectionFree() { MOCKABLE_VIRTUAL bool isEMCriticalSectionFree() {

View File

@ -72,7 +72,7 @@ class DeviceQueueHw : public DeviceQueue {
size_t setSchedulerCrossThreadData(SchedulerKernel &scheduler); size_t setSchedulerCrossThreadData(SchedulerKernel &scheduler);
void setupIndirectState(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) override; void setupIndirectState(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) override;
void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount) override; void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount) override;
void resetDeviceQueue() override; void resetDeviceQueue() override;

View File

@ -291,7 +291,7 @@ IndirectHeap *DeviceQueueHw<GfxFamily>::getIndirectHeap(IndirectHeap::Type type)
} }
template <typename GfxFamily> template <typename GfxFamily>
void DeviceQueueHw<GfxFamily>::setupIndirectState(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) { void DeviceQueueHw<GfxFamily>::setupIndirectState(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) {
void *pDSH = dshBuffer->getUnderlyingBuffer(); void *pDSH = dshBuffer->getUnderlyingBuffer();
// Heap and dshBuffer shoud be the same if heap is created // Heap and dshBuffer shoud be the same if heap is created

View File

@ -105,8 +105,6 @@ struct KernelCommandsHelper : public PerThreadDataHelper {
static bool isPipeControlWArequired(); static bool isPipeControlWArequired();
static size_t getSizeRequiredDSH( static size_t getSizeRequiredDSH(
const Kernel &kernel); const Kernel &kernel);
static size_t getSizeRequiredIH(
const Kernel &kernel);
static size_t getSizeRequiredIOH( static size_t getSizeRequiredIOH(
const Kernel &kernel, const Kernel &kernel,
size_t localWorkSize = 256); size_t localWorkSize = 256);
@ -115,8 +113,6 @@ struct KernelCommandsHelper : public PerThreadDataHelper {
static size_t getTotalSizeRequiredDSH( static size_t getTotalSizeRequiredDSH(
const MultiDispatchInfo &multiDispatchInfo); const MultiDispatchInfo &multiDispatchInfo);
static size_t getTotalSizeRequiredIH(
const MultiDispatchInfo &multiDispatchInfo);
static size_t getTotalSizeRequiredIOH( static size_t getTotalSizeRequiredIOH(
const MultiDispatchInfo &multiDispatchInfo); const MultiDispatchInfo &multiDispatchInfo);
static size_t getTotalSizeRequiredSSH( static size_t getTotalSizeRequiredSSH(
@ -127,46 +123,33 @@ struct KernelCommandsHelper : public PerThreadDataHelper {
typedef typename GfxFamily::BINDING_TABLE_STATE BINDING_TABLE_STATE; typedef typename GfxFamily::BINDING_TABLE_STATE BINDING_TABLE_STATE;
size_t totalSize = 0; size_t totalSize = 0;
if (kernel.isParentKernel) { BlockKernelManager *blockManager = kernel.getProgram()->getBlockKernelManager();
BlockKernelManager *blockManager = kernel.getProgram()->getBlockKernelManager(); uint32_t blockCount = static_cast<uint32_t>(blockManager->getCount());
uint32_t blockCount = static_cast<uint32_t>(blockManager->getCount()); uint32_t maxBindingTableCount = 0;
uint32_t maxBindingTableCount = 0;
if (heapType == IndirectHeap::SURFACE_STATE || heapType == IndirectHeap::INSTRUCTION) { if (heapType == IndirectHeap::SURFACE_STATE) {
if (heapType == IndirectHeap::SURFACE_STATE) { totalSize = BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE - 1;
totalSize = BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE - 1;
} else {
totalSize = Kernel::kernelBinaryAlignement - 1;
}
for (uint32_t i = 0; i < blockCount; i++) { for (uint32_t i = 0; i < blockCount; i++) {
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i); const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
if (heapType == IndirectHeap::SURFACE_STATE) { totalSize += pBlockInfo->heapInfo.pKernelHeader->SurfaceStateHeapSize;
totalSize += pBlockInfo->heapInfo.pKernelHeader->SurfaceStateHeapSize; totalSize = alignUp(totalSize, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
totalSize = alignUp(totalSize, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
maxBindingTableCount = std::max(maxBindingTableCount, pBlockInfo->patchInfo.bindingTableState->Count); maxBindingTableCount = std::max(maxBindingTableCount, pBlockInfo->patchInfo.bindingTableState->Count);
} else {
totalSize += pBlockInfo->heapInfo.pKernelHeader->KernelHeapSize;
totalSize = alignUp(totalSize, Kernel::kernelBinaryAlignement);
}
}
} }
}
if (heapType == IndirectHeap::INSTRUCTION || heapType == IndirectHeap::INDIRECT_OBJECT || heapType == IndirectHeap::SURFACE_STATE) { if (heapType == IndirectHeap::INDIRECT_OBJECT || heapType == IndirectHeap::SURFACE_STATE) {
BuiltIns &builtIns = BuiltIns::getInstance(); BuiltIns &builtIns = BuiltIns::getInstance();
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(kernel.getContext()); SchedulerKernel &scheduler = builtIns.getSchedulerKernel(kernel.getContext());
if (heapType == IndirectHeap::INSTRUCTION) { if (heapType == IndirectHeap::INDIRECT_OBJECT) {
totalSize += getSizeRequiredIH(scheduler); totalSize += getSizeRequiredIOH(scheduler);
} else if (heapType == IndirectHeap::INDIRECT_OBJECT) { } else {
totalSize += getSizeRequiredIOH(scheduler); totalSize += getSizeRequiredSSH(scheduler);
} else {
totalSize += getSizeRequiredSSH(scheduler);
totalSize += maxBindingTableCount * sizeof(BINDING_TABLE_STATE) * DeviceQueue::interfaceDescriptorEntries; totalSize += maxBindingTableCount * sizeof(BINDING_TABLE_STATE) * DeviceQueue::interfaceDescriptorEntries;
totalSize = alignUp(totalSize, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE); totalSize = alignUp(totalSize, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
}
} }
} }
return totalSize; return totalSize;

View File

@ -93,13 +93,6 @@ size_t KernelCommandsHelper<GfxFamily>::getSizeRequiredIOH(
GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE); GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE);
} }
template <typename GfxFamily>
size_t KernelCommandsHelper<GfxFamily>::getSizeRequiredIH(
const Kernel &kernel) {
typedef typename GfxFamily::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
return kernel.getKernelHeapSize() + INTERFACE_DESCRIPTOR_DATA::KERNELSTARTPOINTER_ALIGN_SIZE;
}
template <typename GfxFamily> template <typename GfxFamily>
size_t KernelCommandsHelper<GfxFamily>::getSizeRequiredSSH( size_t KernelCommandsHelper<GfxFamily>::getSizeRequiredSSH(
const Kernel &kernel) { const Kernel &kernel) {
@ -126,12 +119,6 @@ size_t KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredDSH(
return getSizeRequired(multiDispatchInfo, [](const DispatchInfo &dispatchInfo) { return getSizeRequiredDSH(*dispatchInfo.getKernel()); }); return getSizeRequired(multiDispatchInfo, [](const DispatchInfo &dispatchInfo) { return getSizeRequiredDSH(*dispatchInfo.getKernel()); });
} }
template <typename GfxFamily>
size_t KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredIH(
const MultiDispatchInfo &multiDispatchInfo) {
return getSizeRequired(multiDispatchInfo, [](const DispatchInfo &dispatchInfo) { return getSizeRequiredIH(*dispatchInfo.getKernel()); });
}
template <typename GfxFamily> template <typename GfxFamily>
size_t KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredIOH( size_t KernelCommandsHelper<GfxFamily>::getTotalSizeRequiredIOH(
const MultiDispatchInfo &multiDispatchInfo) { const MultiDispatchInfo &multiDispatchInfo) {

View File

@ -36,7 +36,6 @@
namespace OCLRT { namespace OCLRT {
KernelOperation::~KernelOperation() { KernelOperation::~KernelOperation() {
alignedFree(dsh->getCpuBase()); alignedFree(dsh->getCpuBase());
alignedFree(ish->getCpuBase());
if (doNotFreeISH) { if (doNotFreeISH) {
ioh.release(); ioh.release();
} else { } else {
@ -165,7 +164,6 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
memcpy_s(pDst, commandsSize, commandStream.getCpuBase(), commandsSize); memcpy_s(pDst, commandsSize, commandStream.getCpuBase(), commandsSize);
size_t requestedDshSize = kernelOperation->dsh->getUsed(); size_t requestedDshSize = kernelOperation->dsh->getUsed();
size_t requestedIshSize = kernelOperation->ish->getUsed() + kernelOperation->instructionHeapSizeEM;
size_t requestedIohSize = kernelOperation->ioh->getUsed(); size_t requestedIohSize = kernelOperation->ioh->getUsed();
size_t requestedSshSize = kernelOperation->ssh->getUsed() + kernelOperation->surfaceStateHeapSizeEM; size_t requestedSshSize = kernelOperation->ssh->getUsed() + kernelOperation->surfaceStateHeapSizeEM;
@ -180,10 +178,6 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
} }
} }
if (commandQueue.getIndirectHeap(IndirectHeap::INSTRUCTION, 0).getUsed() > commandQueue.getInstructionHeapReservedBlockSize()) {
commandQueue.releaseIndirectHeap(IndirectHeap::INSTRUCTION);
}
if (executionModelKernel) { if (executionModelKernel) {
dsh = devQueue->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); dsh = devQueue->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
// In ExecutionModel IOH is the same as DSH to eliminate StateBaseAddress reprogramming for scheduler kernel and blocks. // In ExecutionModel IOH is the same as DSH to eliminate StateBaseAddress reprogramming for scheduler kernel and blocks.
@ -202,12 +196,8 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
ioh->getSpace(requestedIohSize); ioh->getSpace(requestedIohSize);
} }
IndirectHeap &ish = commandQueue.getIndirectHeap(IndirectHeap::INSTRUCTION, requestedIshSize);
IndirectHeap &ssh = commandQueue.getIndirectHeap(IndirectHeap::SURFACE_STATE, requestedSshSize); IndirectHeap &ssh = commandQueue.getIndirectHeap(IndirectHeap::SURFACE_STATE, requestedSshSize);
memcpy_s(ptrOffset(ish.getCpuBase(), commandQueue.getInstructionHeapReservedBlockSize()), requestedIshSize, kernelOperation->ish->getCpuBase(), kernelOperation->ish->getUsed());
ish.getSpace(kernelOperation->ish->getUsed());
memcpy_s(ssh.getCpuBase(), requestedSshSize, kernelOperation->ssh->getCpuBase(), kernelOperation->ssh->getUsed()); memcpy_s(ssh.getCpuBase(), requestedSshSize, kernelOperation->ssh->getCpuBase(), kernelOperation->ssh->getUsed());
ssh.getSpace(kernelOperation->ssh->getUsed()); ssh.getSpace(kernelOperation->ssh->getUsed());
@ -224,7 +214,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
if (executionModelKernel) { if (executionModelKernel) {
uint32_t taskCount = commandStreamReceiver.peekTaskCount() + 1; uint32_t taskCount = commandStreamReceiver.peekTaskCount() + 1;
devQueue->setupExecutionModelDispatch(ish, ssh, kernel, kernelCount, taskCount, timestamp); devQueue->setupExecutionModelDispatch(ssh, kernel, kernelCount, taskCount, timestamp);
BuiltIns &builtIns = BuiltIns::getInstance(); BuiltIns &builtIns = BuiltIns::getInstance();
SchedulerKernel &scheduler = builtIns.getSchedulerKernel(commandQueue.getContext()); SchedulerKernel &scheduler = builtIns.getSchedulerKernel(commandQueue.getContext());

View File

@ -77,22 +77,19 @@ class CommandMapUnmap : public Command {
}; };
struct KernelOperation { struct KernelOperation {
KernelOperation(std::unique_ptr<LinearStream> commandStream, std::unique_ptr<IndirectHeap> dsh, std::unique_ptr<IndirectHeap> ish, KernelOperation(std::unique_ptr<LinearStream> commandStream, std::unique_ptr<IndirectHeap> dsh, std::unique_ptr<IndirectHeap> ioh, std::unique_ptr<IndirectHeap> ssh)
std::unique_ptr<IndirectHeap> ioh, std::unique_ptr<IndirectHeap> ssh)
: commandStream(std::move(commandStream)), dsh(std::move(dsh)), : commandStream(std::move(commandStream)), dsh(std::move(dsh)),
ish(std::move(ish)), ioh(std::move(ioh)), ssh(std::move(ssh)), ioh(std::move(ioh)), ssh(std::move(ssh)),
instructionHeapSizeEM(0), surfaceStateHeapSizeEM(0), doNotFreeISH(false) { surfaceStateHeapSizeEM(0), doNotFreeISH(false) {
} }
~KernelOperation(); ~KernelOperation();
std::unique_ptr<LinearStream> commandStream; std::unique_ptr<LinearStream> commandStream;
std::unique_ptr<IndirectHeap> dsh; std::unique_ptr<IndirectHeap> dsh;
std::unique_ptr<IndirectHeap> ish;
std::unique_ptr<IndirectHeap> ioh; std::unique_ptr<IndirectHeap> ioh;
std::unique_ptr<IndirectHeap> ssh; std::unique_ptr<IndirectHeap> ssh;
size_t instructionHeapSizeEM;
size_t surfaceStateHeapSizeEM; size_t surfaceStateHeapSizeEM;
bool doNotFreeISH; bool doNotFreeISH;
}; };

View File

@ -413,8 +413,7 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUsedHeapsWhenBloc
mockKernelWithInternals.kernelHeader.KernelHeapSize = sizeof(mockKernelWithInternals.kernelIsa); mockKernelWithInternals.kernelHeader.KernelHeapSize = sizeof(mockKernelWithInternals.kernelIsa);
auto mockKernel = mockKernelWithInternals.mockKernel; auto mockKernel = mockKernelWithInternals.mockKernel;
IndirectHeap::Type heaps[] = {IndirectHeap::INSTRUCTION, IndirectHeap::INDIRECT_OBJECT, IndirectHeap::Type heaps[] = {IndirectHeap::INDIRECT_OBJECT, IndirectHeap::DYNAMIC_STATE, IndirectHeap::SURFACE_STATE};
IndirectHeap::DYNAMIC_STATE, IndirectHeap::SURFACE_STATE};
size_t prealocatedHeapSize = 2 * 64 * KB; size_t prealocatedHeapSize = 2 * 64 * KB;
for (auto heapType : heaps) { for (auto heapType : heaps) {
@ -428,14 +427,8 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUsedHeapsWhenBloc
DebugManager.flags.DisableResourceRecycling.set(false); DebugManager.flags.DisableResourceRecycling.set(false);
std::set<void *> reusableHeaps; std::set<void *> reusableHeaps;
for (unsigned int i = 0; i < 5; ++i) { for (unsigned int i = 0; i < 4; ++i) {
auto allocSize = prealocatedHeapSize; auto allocSize = prealocatedHeapSize;
//make sure that one of those allocations is larger so ISH can be recycled.
if (i == 4) {
allocSize = optimalInstructionHeapSize;
}
void *mem = alignedMalloc(allocSize, 64); void *mem = alignedMalloc(allocSize, 64);
reusableHeaps.insert(mem); reusableHeaps.insert(mem);
memset(mem, 0, allocSize); memset(mem, 0, allocSize);
@ -452,7 +445,6 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUsedHeapsWhenBloc
userEvent.setStatus(CL_COMPLETE); userEvent.setStatus(CL_COMPLETE);
// make sure used heaps are from preallocated pool // make sure used heaps are from preallocated pool
EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, 0).getCpuBase()));
EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 0).getCpuBase())); EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 0).getCpuBase()));
EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 0).getCpuBase())); EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 0).getCpuBase()));
EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0).getCpuBase())); EXPECT_NE(reusableHeaps.end(), reusableHeaps.find(pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0).getCpuBase()));
@ -479,8 +471,6 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUsedHeapsWhenBloc
} }
// expecting blocked command to be programmed indentically to a non-blocked counterpart // expecting blocked command to be programmed indentically to a non-blocked counterpart
EXPECT_THAT(nonblockedCommandHeaps[static_cast<int>(IndirectHeap::INSTRUCTION)],
testing::ContainerEq(blockedCommandHeaps[static_cast<int>(IndirectHeap::INSTRUCTION)]));
EXPECT_THAT(nonblockedCommandHeaps[static_cast<int>(IndirectHeap::INDIRECT_OBJECT)], EXPECT_THAT(nonblockedCommandHeaps[static_cast<int>(IndirectHeap::INDIRECT_OBJECT)],
testing::ContainerEq(blockedCommandHeaps[static_cast<int>(IndirectHeap::INDIRECT_OBJECT)])); testing::ContainerEq(blockedCommandHeaps[static_cast<int>(IndirectHeap::INDIRECT_OBJECT)]));
EXPECT_THAT(nonblockedCommandHeaps[static_cast<int>(IndirectHeap::DYNAMIC_STATE)], EXPECT_THAT(nonblockedCommandHeaps[static_cast<int>(IndirectHeap::DYNAMIC_STATE)],
@ -506,12 +496,10 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUnusedHeapsWhenBl
cl_event blockedEvent = &userEvent; cl_event blockedEvent = &userEvent;
auto &ish = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, 4096u);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 4096u); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 4096u);
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 4096u); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 4096u);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 4096u); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 4096u);
auto ishBase = ish.getCpuBase();
auto iohBase = ioh.getCpuBase(); auto iohBase = ioh.getCpuBase();
auto dshBase = dsh.getCpuBase(); auto dshBase = dsh.getCpuBase();
auto sshBase = ssh.getCpuBase(); auto sshBase = ssh.getCpuBase();
@ -519,7 +507,6 @@ HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhichHasSomeUnusedHeapsWhenBl
pCmdQ->enqueueKernel(mockKernel, 1, &offset, &size, &size, 1, &blockedEvent, nullptr); pCmdQ->enqueueKernel(mockKernel, 1, &offset, &size, &size, 1, &blockedEvent, nullptr);
userEvent.setStatus(CL_COMPLETE); userEvent.setStatus(CL_COMPLETE);
EXPECT_EQ(ishBase, ish.getCpuBase());
EXPECT_EQ(iohBase, ioh.getCpuBase()); EXPECT_EQ(iohBase, ioh.getCpuBase());
EXPECT_EQ(dshBase, dsh.getCpuBase()); EXPECT_EQ(dshBase, dsh.getCpuBase());
EXPECT_EQ(sshBase, ssh.getCpuBase()); EXPECT_EQ(sshBase, ssh.getCpuBase());

View File

@ -651,7 +651,6 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerDoesntConsumeCommandStreamWhenQueueIs
EXPECT_NE(nullptr, blockedCommandsData); EXPECT_NE(nullptr, blockedCommandsData);
EXPECT_NE(nullptr, blockedCommandsData->commandStream); EXPECT_NE(nullptr, blockedCommandsData->commandStream);
EXPECT_NE(nullptr, blockedCommandsData->dsh); EXPECT_NE(nullptr, blockedCommandsData->dsh);
EXPECT_NE(nullptr, blockedCommandsData->ish);
EXPECT_NE(nullptr, blockedCommandsData->ioh); EXPECT_NE(nullptr, blockedCommandsData->ioh);
EXPECT_NE(nullptr, blockedCommandsData->ssh); EXPECT_NE(nullptr, blockedCommandsData->ssh);
@ -691,13 +690,11 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerShouldGetRequiredHeapSizesFromKernelW
auto expectedSizeCS = MemoryConstants::pageSize; //can get estimated more precisely auto expectedSizeCS = MemoryConstants::pageSize; //can get estimated more precisely
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(kernel); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(kernel);
auto expectedSizeISH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(kernel);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(kernel, Math::computeTotalElementsCount(localWorkgroupSize)); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(kernel, Math::computeTotalElementsCount(localWorkgroupSize));
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(kernel); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(kernel);
EXPECT_EQ(expectedSizeCS, blockedCommandsData->commandStream->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeCS, blockedCommandsData->commandStream->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeDSH, blockedCommandsData->dsh->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeDSH, blockedCommandsData->dsh->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeISH, blockedCommandsData->ish->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeIOH, blockedCommandsData->ioh->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeIOH, blockedCommandsData->ioh->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeSSH, blockedCommandsData->ssh->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeSSH, blockedCommandsData->ssh->getMaxAvailableSpace());
@ -728,13 +725,11 @@ HWTEST_F(DispatchWalkerTest, dispatchWalkerShouldGetRequiredHeapSizesFromMdiWhen
auto expectedSizeCS = MemoryConstants::pageSize; //can get estimated more precisely auto expectedSizeCS = MemoryConstants::pageSize; //can get estimated more precisely
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeISH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
EXPECT_EQ(expectedSizeCS, blockedCommandsData->commandStream->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeCS, blockedCommandsData->commandStream->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeDSH, blockedCommandsData->dsh->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeDSH, blockedCommandsData->dsh->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeISH, blockedCommandsData->ish->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeIOH, blockedCommandsData->ioh->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeIOH, blockedCommandsData->ioh->getMaxAvailableSpace());
EXPECT_EQ(expectedSizeSSH, blockedCommandsData->ssh->getMaxAvailableSpace()); EXPECT_EQ(expectedSizeSSH, blockedCommandsData->ssh->getMaxAvailableSpace());

View File

@ -84,11 +84,9 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueFillBuffer) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -112,13 +110,11 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueFillBuffer) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_FILL_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_FILL_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
@ -131,7 +127,6 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueFillBuffer) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -141,11 +136,9 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueCopyBuffer) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -168,13 +161,11 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueCopyBuffer) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_COPY_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_COPY_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
@ -187,7 +178,6 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueCopyBuffer) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -197,11 +187,9 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueReadBufferNonBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -225,13 +213,11 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueReadBufferNonBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
@ -244,7 +230,6 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueReadBufferNonBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -254,11 +239,9 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueReadBufferBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -283,13 +266,11 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueReadBufferBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
@ -302,7 +283,6 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueReadBufferBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -312,11 +292,9 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueWriteBufferNonBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -341,13 +319,11 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueWriteBufferNonBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
@ -357,7 +333,6 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueWriteBufferNonBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -366,11 +341,9 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueWriteBufferBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -396,13 +369,11 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueWriteBufferBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_BUFFER>::getTotalSizeRequiredCS(false, false, *pCmdQ, multiDispatchInfo);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredDSH(multiDispatchInfo);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIH(multiDispatchInfo);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredIOH(multiDispatchInfo);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getTotalSizeRequiredSSH(multiDispatchInfo);
@ -412,7 +383,6 @@ HWTEST_F(GetSizeRequiredBufferTest, enqueueWriteBufferBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }

View File

@ -75,11 +75,9 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueCopyImage) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -105,13 +103,11 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueCopyImage) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_COPY_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_COPY_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(*kernel);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel);
@ -121,7 +117,6 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueCopyImage) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -130,11 +125,9 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueCopyReadAndWriteImage) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -158,13 +151,11 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueCopyReadAndWriteImage) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_COPY_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel.get()); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_COPY_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel.get());
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel.get()); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel.get());
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(*kernel.get());
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel.get()); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel.get());
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel.get()); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel.get());
@ -176,7 +167,6 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueCopyReadAndWriteImage) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -185,11 +175,9 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueReadImageNonBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -219,13 +207,11 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueReadImageNonBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(*kernel);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel);
@ -235,7 +221,6 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueReadImageNonBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -244,11 +229,9 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueReadImageBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -278,13 +261,11 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueReadImageBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_READ_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(*kernel);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel);
@ -294,7 +275,6 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueReadImageBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -303,11 +283,9 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueWriteImageNonBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -337,13 +315,11 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueWriteImageNonBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(*kernel);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel);
@ -353,7 +329,6 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueWriteImageNonBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }
@ -362,11 +337,9 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueWriteImageBlocking) {
auto &commandStream = pCmdQ->getCS(); auto &commandStream = pCmdQ->getCS();
auto usedBeforeCS = commandStream.getUsed(); auto usedBeforeCS = commandStream.getUsed();
auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
auto &ih = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION);
auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT); auto &ioh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT);
auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE); auto &ssh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE);
auto usedBeforeDSH = dsh.getUsed(); auto usedBeforeDSH = dsh.getUsed();
auto usedBeforeIH = ih.getUsed();
auto usedBeforeIOH = ioh.getUsed(); auto usedBeforeIOH = ioh.getUsed();
auto usedBeforeSSH = ssh.getUsed(); auto usedBeforeSSH = ssh.getUsed();
@ -396,13 +369,11 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueWriteImageBlocking) {
auto usedAfterCS = commandStream.getUsed(); auto usedAfterCS = commandStream.getUsed();
auto usedAfterDSH = dsh.getUsed(); auto usedAfterDSH = dsh.getUsed();
auto usedAfterIH = ih.getUsed();
auto usedAfterIOH = ioh.getUsed(); auto usedAfterIOH = ioh.getUsed();
auto usedAfterSSH = ssh.getUsed(); auto usedAfterSSH = ssh.getUsed();
auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel); auto expectedSizeCS = EnqueueOperation<FamilyType, CL_COMMAND_WRITE_IMAGE>::getSizeRequiredCS(false, false, *pCmdQ, kernel);
auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel); auto expectedSizeDSH = KernelCommandsHelper<FamilyType>::getSizeRequiredDSH(*kernel);
auto expectedSizeIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(*kernel);
auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel); auto expectedSizeIOH = KernelCommandsHelper<FamilyType>::getSizeRequiredIOH(*kernel);
auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel); auto expectedSizeSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(*kernel);
@ -412,7 +383,6 @@ HWTEST_F(GetSizeRequiredImageTest, enqueueWriteImageBlocking) {
EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS); EXPECT_EQ(expectedSizeCS, usedAfterCS - usedBeforeCS);
EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH);
EXPECT_GE(expectedSizeIH, usedAfterIH - usedBeforeIH);
EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH);
EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH);
} }

View File

@ -528,29 +528,21 @@ HWTEST_P(DeviceQueueHwWithKernel, setupIndirectState) {
auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
ASSERT_NE(nullptr, dsh); ASSERT_NE(nullptr, dsh);
size_t instructionHeapSize = pKernel->getInstructionHeapSizeForExecutionModel();
size_t surfaceStateHeapSize = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*pKernel)); size_t surfaceStateHeapSize = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*pKernel));
auto ish = new IndirectHeap(alignedMalloc(instructionHeapSize, MemoryConstants::pageSize), instructionHeapSize);
auto ssh = new IndirectHeap(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize); auto ssh = new IndirectHeap(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize);
ASSERT_NE(nullptr, ish);
auto usedBeforeISH = ish->getUsed();
auto usedBeforeSSH = ssh->getUsed(); auto usedBeforeSSH = ssh->getUsed();
auto usedBeforeDSH = dsh->getUsed(); auto usedBeforeDSH = dsh->getUsed();
devQueueHw->setupIndirectState(*ish, *ssh, pKernel, 1); devQueueHw->setupIndirectState(*ssh, pKernel, 1);
auto usedAfterISH = ish->getUsed();
auto usedAfterSSH = ssh->getUsed(); auto usedAfterSSH = ssh->getUsed();
auto usedAfterDSH = dsh->getUsed(); auto usedAfterDSH = dsh->getUsed();
EXPECT_GE(instructionHeapSize, usedAfterISH - usedBeforeISH);
EXPECT_GE(surfaceStateHeapSize, usedAfterSSH - usedBeforeSSH); EXPECT_GE(surfaceStateHeapSize, usedAfterSSH - usedBeforeSSH);
EXPECT_EQ(0u, usedAfterDSH - usedBeforeDSH); EXPECT_EQ(0u, usedAfterDSH - usedBeforeDSH);
alignedFree(ish->getCpuBase());
alignedFree(ssh->getCpuBase()); alignedFree(ssh->getCpuBase());
delete ish;
delete ssh; delete ssh;
} }
} }
@ -566,22 +558,18 @@ HWTEST_P(DeviceQueueHwWithKernel, setupIndirectStateSetsCorrectStartBlockID) {
auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
ASSERT_NE(nullptr, dsh); ASSERT_NE(nullptr, dsh);
size_t instructionHeapSize = pKernel->getInstructionHeapSizeForExecutionModel();
size_t surfaceStateHeapSize = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*pKernel)); size_t surfaceStateHeapSize = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*pKernel));
auto ish = new IndirectHeap(alignedMalloc(instructionHeapSize, MemoryConstants::pageSize), instructionHeapSize);
auto ssh = new IndirectHeap(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize); auto ssh = new IndirectHeap(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize);
uint32_t parentCount = 4; uint32_t parentCount = 4;
devQueueHw->setupIndirectState(*ish, *ssh, pKernel, parentCount); devQueueHw->setupIndirectState(*ssh, pKernel, parentCount);
auto *igilQueue = reinterpret_cast<IGIL_CommandQueue *>(devQueueHw->getQueueBuffer()->getUnderlyingBuffer()); auto *igilQueue = reinterpret_cast<IGIL_CommandQueue *>(devQueueHw->getQueueBuffer()->getUnderlyingBuffer());
EXPECT_EQ(parentCount, igilQueue->m_controls.m_StartBlockID); EXPECT_EQ(parentCount, igilQueue->m_controls.m_StartBlockID);
alignedFree(ish->getCpuBase());
alignedFree(ssh->getCpuBase()); alignedFree(ssh->getCpuBase());
delete ish;
delete ssh; delete ssh;
} }
} }
@ -600,15 +588,13 @@ HWTEST_P(DeviceQueueHwWithKernel, setupIndirectStateSetsCorrectDSHValues) {
auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE); auto dsh = devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE);
ASSERT_NE(nullptr, dsh); ASSERT_NE(nullptr, dsh);
size_t instructionHeapSize = pKernel->getInstructionHeapSizeForExecutionModel();
size_t surfaceStateHeapSize = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*pKernel)); size_t surfaceStateHeapSize = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*pKernel));
auto ish = new IndirectHeap(alignedMalloc(instructionHeapSize, MemoryConstants::pageSize), instructionHeapSize);
auto ssh = new IndirectHeap(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize); auto ssh = new IndirectHeap(alignedMalloc(surfaceStateHeapSize, MemoryConstants::pageSize), surfaceStateHeapSize);
uint32_t parentCount = 1; uint32_t parentCount = 1;
devQueueHw->setupIndirectState(*ish, *ssh, pKernel, parentCount); devQueueHw->setupIndirectState(*ssh, pKernel, parentCount);
auto *igilQueue = reinterpret_cast<IGIL_CommandQueue *>(devQueueHw->getQueueBuffer()->getUnderlyingBuffer()); auto *igilQueue = reinterpret_cast<IGIL_CommandQueue *>(devQueueHw->getQueueBuffer()->getUnderlyingBuffer());
EXPECT_EQ(igilQueue->m_controls.m_DynamicHeapStart, devQueueHw->offsetDsh + alignUp((uint32_t)pKernel->getDynamicStateHeapSize(), GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE)); EXPECT_EQ(igilQueue->m_controls.m_DynamicHeapStart, devQueueHw->offsetDsh + alignUp((uint32_t)pKernel->getDynamicStateHeapSize(), GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE));
@ -616,9 +602,7 @@ HWTEST_P(DeviceQueueHwWithKernel, setupIndirectStateSetsCorrectDSHValues) {
EXPECT_EQ(igilQueue->m_controls.m_CurrentDSHoffset, devQueueHw->offsetDsh + alignUp((uint32_t)pKernel->getDynamicStateHeapSize(), GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE)); EXPECT_EQ(igilQueue->m_controls.m_CurrentDSHoffset, devQueueHw->offsetDsh + alignUp((uint32_t)pKernel->getDynamicStateHeapSize(), GPGPU_WALKER::INDIRECTDATASTARTADDRESS_ALIGN_SIZE));
EXPECT_EQ(igilQueue->m_controls.m_ParentDSHOffset, devQueueHw->offsetDsh); EXPECT_EQ(igilQueue->m_controls.m_ParentDSHOffset, devQueueHw->offsetDsh);
alignedFree(ish->getCpuBase());
alignedFree(ssh->getCpuBase()); alignedFree(ssh->getCpuBase());
delete ish;
delete ssh; delete ssh;
delete devQueueHw; delete devQueueHw;
} }

View File

@ -39,11 +39,9 @@ TEST(DeviceQueueSimpleTest, setupExecutionModelDispatchDoesNothing) {
memset(buffer, 1, 20); memset(buffer, 1, 20);
size_t size = 20; size_t size = 20;
IndirectHeap ih(buffer, size);
IndirectHeap ssh(buffer, size); IndirectHeap ssh(buffer, size);
devQueue.setupExecutionModelDispatch(ih, ssh, nullptr, 0, 0, 0); devQueue.setupExecutionModelDispatch(ssh, nullptr, 0, 0, 0);
EXPECT_EQ(0u, ih.getUsed());
EXPECT_EQ(0u, ssh.getUsed()); EXPECT_EQ(0u, ssh.getUsed());
for (uint32_t i = 0; i < 20; i++) { for (uint32_t i = 0; i < 20; i++) {

View File

@ -452,7 +452,6 @@ class SurfaceMock : public Surface {
TEST_F(InternalsEventTest, resizeCmdQueueHeapsWhenKernelOparationHeapsAreBigger) { TEST_F(InternalsEventTest, resizeCmdQueueHeapsWhenKernelOparationHeapsAreBigger) {
CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, 0); CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, 0);
IndirectHeap &cmdQueueDsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 4096); IndirectHeap &cmdQueueDsh = pCmdQ->getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 4096);
IndirectHeap &cmdQueueIsh = pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, 4096);
IndirectHeap &cmdQueueIoh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 4096); IndirectHeap &cmdQueueIoh = pCmdQ->getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 4096);
IndirectHeap &cmdQueueSsh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 4096); IndirectHeap &cmdQueueSsh = pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 4096);
@ -466,13 +465,12 @@ TEST_F(InternalsEventTest, resizeCmdQueueHeapsWhenKernelOparationHeapsAreBigger)
}; };
auto dsh = createFullHeap(requestedSize); auto dsh = createFullHeap(requestedSize);
auto ish = createFullHeap(requestedSize);
auto ioh = createFullHeap(requestedSize); auto ioh = createFullHeap(requestedSize);
auto ssh = createFullHeap(maxSshSize); auto ssh = createFullHeap(maxSshSize);
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
auto kernelOperation = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh), auto kernelOperation = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh),
UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh)); UniqueIH(ioh), UniqueIH(ssh));
std::vector<Surface *> v; std::vector<Surface *> v;
SurfaceMock *surface = new SurfaceMock; SurfaceMock *surface = new SurfaceMock;
v.push_back(surface); v.push_back(surface);
@ -481,14 +479,12 @@ TEST_F(InternalsEventTest, resizeCmdQueueHeapsWhenKernelOparationHeapsAreBigger)
std::unique_ptr<KernelOperation>(kernelOperation), v, false, false, false, nullptr, preemptionMode); std::unique_ptr<KernelOperation>(kernelOperation), v, false, false, false, nullptr, preemptionMode);
EXPECT_LT(cmdQueueDsh.getMaxAvailableSpace(), dsh->getMaxAvailableSpace()); EXPECT_LT(cmdQueueDsh.getMaxAvailableSpace(), dsh->getMaxAvailableSpace());
EXPECT_EQ(requestedSize, ish->getMaxAvailableSpace());
EXPECT_LT(cmdQueueIoh.getMaxAvailableSpace(), ioh->getMaxAvailableSpace()); EXPECT_LT(cmdQueueIoh.getMaxAvailableSpace(), ioh->getMaxAvailableSpace());
EXPECT_EQ(maxSshSize, ssh->getMaxAvailableSpace()); EXPECT_EQ(maxSshSize, ssh->getMaxAvailableSpace());
cmdComputeKernel->submit(0, false); cmdComputeKernel->submit(0, false);
EXPECT_GE(cmdQueueDsh.getMaxAvailableSpace(), dsh->getMaxAvailableSpace()); EXPECT_GE(cmdQueueDsh.getMaxAvailableSpace(), dsh->getMaxAvailableSpace());
EXPECT_GE(cmdQueueIsh.getMaxAvailableSpace(), ish->getMaxAvailableSpace());
EXPECT_GE(cmdQueueIoh.getMaxAvailableSpace(), ioh->getMaxAvailableSpace()); EXPECT_GE(cmdQueueIoh.getMaxAvailableSpace(), ioh->getMaxAvailableSpace());
EXPECT_GE(cmdQueueSsh.getMaxAvailableSpace(), ssh->getMaxAvailableSpace()); EXPECT_GE(cmdQueueSsh.getMaxAvailableSpace(), ssh->getMaxAvailableSpace());
@ -502,12 +498,11 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096); auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096);
auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ish = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh), auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh),
UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh)); UniqueIH(ioh), UniqueIH(ssh));
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pDevice->getCommandStreamReceiver();
std::vector<Surface *> v; std::vector<Surface *> v;
@ -540,12 +535,11 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) {
auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096); auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096);
auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ish = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh), auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh),
UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh)); UniqueIH(ioh), UniqueIH(ssh));
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pDevice->getCommandStreamReceiver();
std::vector<Surface *> v; std::vector<Surface *> v;
@ -572,12 +566,11 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096); auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096);
auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ish = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh), auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh),
UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh)); UniqueIH(ioh), UniqueIH(ssh));
SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface();
pPrintfSurface->DataParamOffset = 0; pPrintfSurface->DataParamOffset = 0;
@ -1485,12 +1478,11 @@ HWTEST_F(InternalsEventTest, givenAbortedCommandWhenSubmitCalledThenDontUpdateFl
auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096); auto cmdStream = new LinearStream(alignedMalloc(4096, 4096), 4096);
auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto dsh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ish = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ioh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096); auto ssh = new IndirectHeap(alignedMalloc(4096, 4096), 4096);
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh), auto blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(cmdStream), UniqueIH(dsh),
UniqueIH(ish), UniqueIH(ioh), UniqueIH(ssh)); UniqueIH(ioh), UniqueIH(ssh));
PreemptionMode preemptionMode = pDevice->getPreemptionMode(); PreemptionMode preemptionMode = pDevice->getPreemptionMode();
std::vector<Surface *> v; std::vector<Surface *> v;
auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false, false, false, nullptr, preemptionMode); auto cmd = new CommandComputeKernel(*pCmdQ, csr, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false, false, false, nullptr, preemptionMode);

View File

@ -67,11 +67,9 @@ HWTEST_F(ExecutionModelSchedulerFixture, dispatchScheduler) {
EXPECT_NE(nullptr, executionModelDsh); EXPECT_NE(nullptr, executionModelDsh);
size_t minRequiredSizeForSchedulerIH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
// Setup heaps in pCmdQ // Setup heaps in pCmdQ
LinearStream &commandStream = getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler); LinearStream &commandStream = getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler);
pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, minRequiredSizeForSchedulerIH);
pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH); pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH);
dispatchScheduler<FamilyType>( dispatchScheduler<FamilyType>(
@ -185,11 +183,9 @@ HWTEST_F(ExecutionModelSchedulerFixture, dispatchSchedulerDoesNotUseStandardCmdQ
DeviceQueueHw<FamilyType> *pDevQueueHw = castToObject<DeviceQueueHw<FamilyType>>(pDevQueue); DeviceQueueHw<FamilyType> *pDevQueueHw = castToObject<DeviceQueueHw<FamilyType>>(pDevQueue);
SchedulerKernel &scheduler = BuiltIns::getInstance().getSchedulerKernel(*context); SchedulerKernel &scheduler = BuiltIns::getInstance().getSchedulerKernel(*context);
size_t minRequiredSizeForSchedulerIH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
// Setup heaps in pCmdQ // Setup heaps in pCmdQ
getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler); getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler);
pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, minRequiredSizeForSchedulerIH);
pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH); pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH);
dispatchScheduler<FamilyType>( dispatchScheduler<FamilyType>(
@ -218,11 +214,9 @@ HWTEST_F(ParentKernelCommandQueueFixture, dispatchSchedulerWithEarlyReturnSetToF
SchedulerKernel &scheduler = BuiltIns::getInstance().getSchedulerKernel(*context); SchedulerKernel &scheduler = BuiltIns::getInstance().getSchedulerKernel(*context);
size_t minRequiredSizeForSchedulerIH = KernelCommandsHelper<FamilyType>::getSizeRequiredIH(scheduler);
size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(scheduler); size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::getSizeRequiredSSH(scheduler);
// Setup heaps in pCmdQ // Setup heaps in pCmdQ
LinearStream &commandStream = getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler); LinearStream &commandStream = getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler);
pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, minRequiredSizeForSchedulerIH);
pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH); pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH);
dispatchScheduler<FamilyType>( dispatchScheduler<FamilyType>(

View File

@ -65,9 +65,9 @@ class MockDeviceQueueHwWithCriticalSectionRelease : public DeviceQueueHw<GfxFami
return igilCmdQueue->m_controls.m_CriticalSection == DeviceQueueHw<GfxFamily>::ExecutionModelCriticalSection::Free; return igilCmdQueue->m_controls.m_CriticalSection == DeviceQueueHw<GfxFamily>::ExecutionModelCriticalSection::Free;
} }
void setupIndirectState(IndirectHeap &instructionHeap, IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) override { void setupIndirectState(IndirectHeap &surfaceStateHeap, Kernel *parentKernel, uint32_t parentIDCount) override {
indirectStateSetup = true; indirectStateSetup = true;
return BaseClass::setupIndirectState(instructionHeap, surfaceStateHeap, parentKernel, parentIDCount); return BaseClass::setupIndirectState(surfaceStateHeap, parentKernel, parentIDCount);
} }
void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount) override { void addExecutionModelCleanUpSection(Kernel *parentKernel, HwTimeStamps *hwTimeStamp, uint32_t taskCount) override {
cleanupSectionAdded = true; cleanupSectionAdded = true;
@ -103,16 +103,13 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenLockedEMcritcalSectionWhenParentK
IndirectHeap *dsh = new IndirectHeap(alignedMalloc(dshSize, alignement), dshSize); IndirectHeap *dsh = new IndirectHeap(alignedMalloc(dshSize, alignement), dshSize);
dsh->getSpace(mockDevQueue.getDshOffset()); dsh->getSpace(mockDevQueue.getDshOffset());
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize))); std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)));
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;
@ -166,13 +163,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize))); std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)));
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;
@ -211,13 +205,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize))); std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)));
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;
@ -251,13 +242,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenBlockedParentKernelWithProfilingW
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize))); std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)));
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;
@ -294,13 +282,10 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize))); std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)));
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;
@ -326,7 +311,6 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenUsedSSHWhenParentKernelIsSubmitte
MockCommandQueue cmdQ(context, device, properties); MockCommandQueue cmdQ(context, device, properties);
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
size_t heapSize = 20; size_t heapSize = 20;
@ -343,10 +327,8 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenUsedSSHWhenParentKernelIsSubmitte
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize))); std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)));
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;
@ -370,7 +352,6 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenNotUsedSSHWhenParentKernelIsSubmi
parentKernel->createReflectionSurface(); parentKernel->createReflectionSurface();
context->setDefaultDeviceQueue(&mockDevQueue); context->setDefaultDeviceQueue(&mockDevQueue);
size_t minSizeISHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
size_t heapSize = 20; size_t heapSize = 20;
@ -392,10 +373,8 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenNotUsedSSHWhenParentKernelIsSubmi
KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()), KernelOperation *blockedCommandData = new KernelOperation(std::unique_ptr<LinearStream>(new LinearStream()),
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)), std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(new IndirectHeap(alignedMalloc(heapSize, alignement), heapSize)),
std::unique_ptr<IndirectHeap>(ssh)); std::unique_ptr<IndirectHeap>(ssh));
blockedCommandData->instructionHeapSizeEM = minSizeISHForEM;
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
std::vector<Surface *> surfaces; std::vector<Surface *> surfaces;

View File

@ -45,12 +45,10 @@ BDWTEST_F(BdwSchedulerTest, givenCallToDispatchSchedulerWhenPipeControlWithCSSta
DeviceQueueHw<FamilyType> *pDevQueueHw = castToObject<DeviceQueueHw<FamilyType>>(pDevQueue); DeviceQueueHw<FamilyType> *pDevQueueHw = castToObject<DeviceQueueHw<FamilyType>>(pDevQueue);
SchedulerKernel &scheduler = BuiltIns::getInstance().getSchedulerKernel(*context); SchedulerKernel &scheduler = BuiltIns::getInstance().getSchedulerKernel(*context);
size_t minRequiredSizeForSchedulerIH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*parentKernel);
size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minRequiredSizeForSchedulerSSH = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
// Setup heaps in pCmdQ // Setup heaps in pCmdQ
LinearStream &commandStream = getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler); LinearStream &commandStream = getCommandStream<FamilyType, CL_COMMAND_NDRANGE_KERNEL>(*pCmdQ, false, false, &scheduler);
pCmdQ->getIndirectHeap(IndirectHeap::INSTRUCTION, minRequiredSizeForSchedulerIH);
pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH); pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, minRequiredSizeForSchedulerSSH);
dispatchScheduler<FamilyType>( dispatchScheduler<FamilyType>(

View File

@ -800,49 +800,8 @@ HWTEST_F(KernelCommandsTest, GivenKernelWithSamplersWhenIndirectStateIsProgramme
delete[] mockDsh; delete[] mockDsh;
} }
HWTEST_F(KernelCommandsTest, getSizeRequiredIHForExecutionModelReturnsZeroForNonParentKernel) {
// define kernel info
std::unique_ptr<KernelInfo> pKernelInfo = std::unique_ptr<KernelInfo>(KernelInfo::create());
// create program with valid context
MockContext context;
MockProgram program(&context, false);
// create kernel
std::unique_ptr<MockKernel> pKernel = std::unique_ptr<MockKernel>(new MockKernel(&program, *pKernelInfo.get(), *pDevice));
EXPECT_FALSE(pKernel->isParentKernel);
EXPECT_EQ(0u, KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*pKernel.get()));
}
typedef ExecutionModelKernelFixture ParentKernelCommandsFromBinaryTest; typedef ExecutionModelKernelFixture ParentKernelCommandsFromBinaryTest;
HWTEST_P(ParentKernelCommandsFromBinaryTest, getSizeRequiredForExecutionModelReturnsTotalBlockBinarySizeAndSchedulerBinarySize) {
if (std::string(pPlatform->getDevice(0)->getDeviceInfo().clVersion).find("OpenCL 2.") != std::string::npos) {
EXPECT_TRUE(pKernel->isParentKernel);
size_t totalSize = 0;
BlockKernelManager *blockManager = pKernel->getProgram()->getBlockKernelManager();
uint32_t blockCount = static_cast<uint32_t>(blockManager->getCount());
totalSize = Kernel::kernelBinaryAlignement - 1; // for initial alignment
for (uint32_t i = 0; i < blockCount; i++) {
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
totalSize += pBlockInfo->heapInfo.pKernelHeader->KernelHeapSize;
totalSize = alignUp(totalSize, Kernel::kernelBinaryAlignement);
}
BuiltIns &builtIns = BuiltIns::getInstance();
auto &scheduler = builtIns.getSchedulerKernel(*pContext);
totalSize += KernelCommandsHelper<FamilyType>::getSizeRequiredIH(scheduler);
EXPECT_EQ(totalSize, KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::INSTRUCTION>(*pKernel));
}
}
HWTEST_P(ParentKernelCommandsFromBinaryTest, getSizeRequiredForExecutionModelForSurfaceStatesReturnsSizeOfBlocksPlusMaxBindingTableSizeForAllIDTEntriesAndSchedulerSSHSize) { HWTEST_P(ParentKernelCommandsFromBinaryTest, getSizeRequiredForExecutionModelForSurfaceStatesReturnsSizeOfBlocksPlusMaxBindingTableSizeForAllIDTEntriesAndSchedulerSSHSize) {
using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE; using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE;