Pass command stream to dispatch scheduler

instead of taking it from CommandQueue

Change-Id: I8e43c3b7ed5cb46f79edf3290a84fc6ad41f3b57
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2019-02-25 09:42:15 +01:00
committed by sys_ocldev
parent 10083d5a21
commit 0cf71414e2
12 changed files with 33 additions and 26 deletions

View File

@@ -454,6 +454,7 @@ void CommandQueueHw<GfxFamily>::processDeviceEnqueue(Kernel *parentKernel,
GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
*this,
*this->commandStream,
*devQueueHw,
preemption,
scheduler,

View File

@@ -196,6 +196,7 @@ class GpgpuWalkerHelper {
static void dispatchScheduler(
CommandQueue &commandQueue,
LinearStream &commandStream,
DeviceQueueHw<GfxFamily> &devQueueHw,
PreemptionMode preemptionMode,
SchedulerKernel &scheduler,

View File

@@ -53,6 +53,7 @@ inline size_t GpgpuWalkerHelper<GfxFamily>::setGpgpuWalkerThreadData(
template <typename GfxFamily>
void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
CommandQueue &commandQueue,
LinearStream &commandStream,
DeviceQueueHw<GfxFamily> &devQueueHw,
PreemptionMode preemptionMode,
SchedulerKernel &scheduler,
@@ -63,13 +64,8 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
using GPGPU_WALKER = typename GfxFamily::GPGPU_WALKER;
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
OCLRT::LinearStream *commandStream = nullptr;
OCLRT::IndirectHeap *ioh = nullptr;
commandStream = &commandQueue.getCS(0);
bool dcFlush = false;
commandQueue.getCommandStreamReceiver().addPipeControl(*commandStream, dcFlush);
commandQueue.getCommandStreamReceiver().addPipeControl(commandStream, dcFlush);
uint32_t interfaceDescriptorIndex = devQueueHw.schedulerIDIndex;
const size_t offsetInterfaceDescriptorTable = devQueueHw.colorCalcStateSize;
@@ -78,7 +74,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
// Program media interface descriptor load
KernelCommandsHelper<GfxFamily>::sendMediaInterfaceDescriptorLoad(
*commandStream,
commandStream,
offsetInterfaceDescriptor,
totalInterfaceDescriptorTableSize);
@@ -123,16 +119,16 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
size_t curbeOffset = devQueueHw.setSchedulerCrossThreadData(scheduler);
IndirectHeap indirectObjectHeap(dsh->getCpuBase(), dsh->getMaxAvailableSpace());
indirectObjectHeap.getSpace(curbeOffset);
ioh = &indirectObjectHeap;
IndirectHeap *ioh = &indirectObjectHeap;
// Program the walker. Invokes execution so all state should already be programmed
auto pGpGpuWalkerCmd = (GPGPU_WALKER *)commandStream->getSpace(sizeof(GPGPU_WALKER));
auto pGpGpuWalkerCmd = static_cast<GPGPU_WALKER *>(commandStream.getSpace(sizeof(GPGPU_WALKER)));
*pGpGpuWalkerCmd = GfxFamily::cmdInitGpgpuWalker;
bool localIdsGenerationByRuntime = KernelCommandsHelper<GfxFamily>::isRuntimeLocalIdsGenerationRequired(1, globalWorkSizes, localWorkSizes);
bool inlineDataProgrammingRequired = KernelCommandsHelper<GfxFamily>::inlineDataProgrammingRequired(scheduler);
KernelCommandsHelper<GfxFamily>::sendIndirectState(
*commandStream,
commandStream,
*dsh,
*ioh,
*ssh,
@@ -147,7 +143,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
localIdsGenerationByRuntime);
// Implement enabling special WA DisableLSQCROPERFforOCL if needed
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, scheduler, true);
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(&commandStream, scheduler, true);
size_t globalOffsets[3] = {0, 0, 0};
size_t workGroups[3] = {(scheduler.getGws() / scheduler.getLws()), 1, 1};
@@ -156,15 +152,15 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
*scheduler.getKernelInfo().patchInfo.threadPayload);
// Implement disabling special WA DisableLSQCROPERFforOCL if needed
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, scheduler, false);
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(&commandStream, scheduler, false);
// Do not put BB_START only when returning in first Scheduler run
if (devQueueHw.getSchedulerReturnInstance() != 1) {
commandQueue.getCommandStreamReceiver().addPipeControl(*commandStream, true);
commandQueue.getCommandStreamReceiver().addPipeControl(commandStream, true);
// Add BB Start Cmd to the SLB in the Primary Batch Buffer
auto *bbStart = (MI_BATCH_BUFFER_START *)commandStream->getSpace(sizeof(MI_BATCH_BUFFER_START));
auto *bbStart = static_cast<MI_BATCH_BUFFER_START *>(commandStream.getSpace(sizeof(MI_BATCH_BUFFER_START)));
*bbStart = GfxFamily::cmdInitBatchBufferStart;
bbStart->setSecondLevelBatchBuffer(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH);
uint64_t slbAddress = devQueueHw.getSlbBuffer()->getGpuAddress();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -160,7 +160,7 @@ void DeviceQueue::resetDeviceQueue() {
return;
}
void DeviceQueue::dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) {
void DeviceQueue::dispatchScheduler(CommandQueue &cmdQ, LinearStream &commandStream, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) {
return;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -80,7 +80,7 @@ class DeviceQueue : public BaseObject<_device_queue> {
}
virtual void resetDeviceQueue();
virtual void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh);
virtual void dispatchScheduler(CommandQueue &cmdQ, LinearStream &commandStream, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh);
virtual IndirectHeap *getIndirectHeap(IndirectHeap::Type type);
void acquireEMCriticalSection() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,6 +16,7 @@
#include "runtime/scheduler/scheduler_kernel.h"
namespace OCLRT {
template <typename GfxFamily>
class DeviceQueueHw : public DeviceQueue {
using BaseClass = DeviceQueue;
@@ -57,7 +58,7 @@ class DeviceQueueHw : public DeviceQueue {
void addExecutionModelCleanUpSection(Kernel *parentKernel, TagNode<HwTimeStamps> *hwTimeStamp, uint32_t taskCount) override;
void resetDeviceQueue() override;
void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) override;
void dispatchScheduler(CommandQueue &cmdQ, LinearStream &commandStream, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) override;
uint32_t getSchedulerReturnInstance() {
return igilQueue->m_controls.m_SchedulerEarlyReturn;

View File

@@ -368,8 +368,9 @@ size_t DeviceQueueHw<GfxFamily>::setSchedulerCrossThreadData(SchedulerKernel &sc
}
template <typename GfxFamily>
void DeviceQueueHw<GfxFamily>::dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) {
void DeviceQueueHw<GfxFamily>::dispatchScheduler(CommandQueue &cmdQ, LinearStream &commandStream, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) {
GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(cmdQ,
commandStream,
*this,
preemptionMode,
scheduler,

View File

@@ -182,6 +182,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
devQueue->dispatchScheduler(
commandQueue,
*kernelOperation->commandStream,
scheduler,
preemptionMode,
ssh,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -305,7 +305,9 @@ TEST_F(DeviceQueueTest, dispatchScheduler) {
CommandQueue cmdQ(nullptr, nullptr, 0);
KernelInfo info;
MockSchedulerKernel *kernel = new MockSchedulerKernel(&program, info, *device);
devQueue.dispatchScheduler(cmdQ, *kernel, device->getPreemptionMode(), nullptr, nullptr);
LinearStream cmdStream;
devQueue.dispatchScheduler(cmdQ, cmdStream, *kernel, device->getPreemptionMode(), nullptr, nullptr);
delete kernel;
}

View File

@@ -60,6 +60,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ExecutionModelSchedulerFixture, dispatchScheduler) {
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
*pCmdQ,
pCmdQ->getCS(0),
*pDevQueueHw,
pDevice->getPreemptionMode(),
scheduler,
@@ -178,6 +179,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ExecutionModelSchedulerFixture, dispatchSchedulerDoe
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
*pCmdQ,
pCmdQ->getCS(0),
*pDevQueueHw,
pDevice->getPreemptionMode(),
scheduler,
@@ -211,6 +213,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, dispatchSchedulerWi
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
*pCmdQ,
pCmdQ->getCS(0),
mockDevQueue,
device->getPreemptionMode(),
scheduler,

View File

@@ -62,9 +62,9 @@ class MockDeviceQueueHwWithCriticalSectionRelease : public DeviceQueueHw<GfxFami
timestampAddedInCleanupSection = hwTimeStamp ? hwTimeStamp->tagForCpuAccess : nullptr;
return BaseClass::addExecutionModelCleanUpSection(parentKernel, hwTimeStamp, taskCount);
}
void dispatchScheduler(CommandQueue &cmdQ, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) override {
void dispatchScheduler(CommandQueue &cmdQ, LinearStream &commandStream, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh) override {
schedulerDispatched = true;
return BaseClass::dispatchScheduler(cmdQ, scheduler, preemptionMode, ssh, dsh);
return BaseClass::dispatchScheduler(cmdQ, commandStream, scheduler, preemptionMode, ssh, dsh);
}
uint32_t criticalSectioncheckCounter = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2018 Intel Corporation
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -38,6 +38,7 @@ BDWTEST_F(BdwSchedulerTest, givenCallToDispatchSchedulerWhenPipeControlWithCSSta
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
*pCmdQ,
commandStream,
*pDevQueueHw,
pDevice->getPreemptionMode(),
scheduler,