mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
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:
committed by
sys_ocldev
parent
10083d5a21
commit
0cf71414e2
@@ -454,6 +454,7 @@ void CommandQueueHw<GfxFamily>::processDeviceEnqueue(Kernel *parentKernel,
|
|||||||
|
|
||||||
GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
||||||
*this,
|
*this,
|
||||||
|
*this->commandStream,
|
||||||
*devQueueHw,
|
*devQueueHw,
|
||||||
preemption,
|
preemption,
|
||||||
scheduler,
|
scheduler,
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ class GpgpuWalkerHelper {
|
|||||||
|
|
||||||
static void dispatchScheduler(
|
static void dispatchScheduler(
|
||||||
CommandQueue &commandQueue,
|
CommandQueue &commandQueue,
|
||||||
|
LinearStream &commandStream,
|
||||||
DeviceQueueHw<GfxFamily> &devQueueHw,
|
DeviceQueueHw<GfxFamily> &devQueueHw,
|
||||||
PreemptionMode preemptionMode,
|
PreemptionMode preemptionMode,
|
||||||
SchedulerKernel &scheduler,
|
SchedulerKernel &scheduler,
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ inline size_t GpgpuWalkerHelper<GfxFamily>::setGpgpuWalkerThreadData(
|
|||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
||||||
CommandQueue &commandQueue,
|
CommandQueue &commandQueue,
|
||||||
|
LinearStream &commandStream,
|
||||||
DeviceQueueHw<GfxFamily> &devQueueHw,
|
DeviceQueueHw<GfxFamily> &devQueueHw,
|
||||||
PreemptionMode preemptionMode,
|
PreemptionMode preemptionMode,
|
||||||
SchedulerKernel &scheduler,
|
SchedulerKernel &scheduler,
|
||||||
@@ -63,13 +64,8 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
|||||||
using GPGPU_WALKER = typename GfxFamily::GPGPU_WALKER;
|
using GPGPU_WALKER = typename GfxFamily::GPGPU_WALKER;
|
||||||
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::IndirectHeap *ioh = nullptr;
|
|
||||||
|
|
||||||
commandStream = &commandQueue.getCS(0);
|
|
||||||
|
|
||||||
bool dcFlush = false;
|
bool dcFlush = false;
|
||||||
commandQueue.getCommandStreamReceiver().addPipeControl(*commandStream, dcFlush);
|
commandQueue.getCommandStreamReceiver().addPipeControl(commandStream, dcFlush);
|
||||||
|
|
||||||
uint32_t interfaceDescriptorIndex = devQueueHw.schedulerIDIndex;
|
uint32_t interfaceDescriptorIndex = devQueueHw.schedulerIDIndex;
|
||||||
const size_t offsetInterfaceDescriptorTable = devQueueHw.colorCalcStateSize;
|
const size_t offsetInterfaceDescriptorTable = devQueueHw.colorCalcStateSize;
|
||||||
@@ -78,7 +74,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
|||||||
|
|
||||||
// Program media interface descriptor load
|
// Program media interface descriptor load
|
||||||
KernelCommandsHelper<GfxFamily>::sendMediaInterfaceDescriptorLoad(
|
KernelCommandsHelper<GfxFamily>::sendMediaInterfaceDescriptorLoad(
|
||||||
*commandStream,
|
commandStream,
|
||||||
offsetInterfaceDescriptor,
|
offsetInterfaceDescriptor,
|
||||||
totalInterfaceDescriptorTableSize);
|
totalInterfaceDescriptorTableSize);
|
||||||
|
|
||||||
@@ -123,16 +119,16 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
|||||||
size_t curbeOffset = devQueueHw.setSchedulerCrossThreadData(scheduler);
|
size_t curbeOffset = devQueueHw.setSchedulerCrossThreadData(scheduler);
|
||||||
IndirectHeap indirectObjectHeap(dsh->getCpuBase(), dsh->getMaxAvailableSpace());
|
IndirectHeap indirectObjectHeap(dsh->getCpuBase(), dsh->getMaxAvailableSpace());
|
||||||
indirectObjectHeap.getSpace(curbeOffset);
|
indirectObjectHeap.getSpace(curbeOffset);
|
||||||
ioh = &indirectObjectHeap;
|
IndirectHeap *ioh = &indirectObjectHeap;
|
||||||
|
|
||||||
// Program the walker. Invokes execution so all state should already be programmed
|
// 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;
|
*pGpGpuWalkerCmd = GfxFamily::cmdInitGpgpuWalker;
|
||||||
|
|
||||||
bool localIdsGenerationByRuntime = KernelCommandsHelper<GfxFamily>::isRuntimeLocalIdsGenerationRequired(1, globalWorkSizes, localWorkSizes);
|
bool localIdsGenerationByRuntime = KernelCommandsHelper<GfxFamily>::isRuntimeLocalIdsGenerationRequired(1, globalWorkSizes, localWorkSizes);
|
||||||
bool inlineDataProgrammingRequired = KernelCommandsHelper<GfxFamily>::inlineDataProgrammingRequired(scheduler);
|
bool inlineDataProgrammingRequired = KernelCommandsHelper<GfxFamily>::inlineDataProgrammingRequired(scheduler);
|
||||||
KernelCommandsHelper<GfxFamily>::sendIndirectState(
|
KernelCommandsHelper<GfxFamily>::sendIndirectState(
|
||||||
*commandStream,
|
commandStream,
|
||||||
*dsh,
|
*dsh,
|
||||||
*ioh,
|
*ioh,
|
||||||
*ssh,
|
*ssh,
|
||||||
@@ -147,7 +143,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
|||||||
localIdsGenerationByRuntime);
|
localIdsGenerationByRuntime);
|
||||||
|
|
||||||
// Implement enabling special WA DisableLSQCROPERFforOCL if needed
|
// 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 globalOffsets[3] = {0, 0, 0};
|
||||||
size_t workGroups[3] = {(scheduler.getGws() / scheduler.getLws()), 1, 1};
|
size_t workGroups[3] = {(scheduler.getGws() / scheduler.getLws()), 1, 1};
|
||||||
@@ -156,15 +152,15 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
|||||||
*scheduler.getKernelInfo().patchInfo.threadPayload);
|
*scheduler.getKernelInfo().patchInfo.threadPayload);
|
||||||
|
|
||||||
// Implement disabling special WA DisableLSQCROPERFforOCL if needed
|
// 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
|
// Do not put BB_START only when returning in first Scheduler run
|
||||||
if (devQueueHw.getSchedulerReturnInstance() != 1) {
|
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
|
// 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 = GfxFamily::cmdInitBatchBufferStart;
|
||||||
bbStart->setSecondLevelBatchBuffer(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH);
|
bbStart->setSecondLevelBatchBuffer(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH);
|
||||||
uint64_t slbAddress = devQueueHw.getSlbBuffer()->getGpuAddress();
|
uint64_t slbAddress = devQueueHw.getSlbBuffer()->getGpuAddress();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017-2018 Intel Corporation
|
* Copyright (C) 2017-2019 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -160,7 +160,7 @@ void DeviceQueue::resetDeviceQueue() {
|
|||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017-2018 Intel Corporation
|
* Copyright (C) 2017-2019 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -80,7 +80,7 @@ class DeviceQueue : public BaseObject<_device_queue> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void resetDeviceQueue();
|
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);
|
virtual IndirectHeap *getIndirectHeap(IndirectHeap::Type type);
|
||||||
|
|
||||||
void acquireEMCriticalSection() {
|
void acquireEMCriticalSection() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017-2018 Intel Corporation
|
* Copyright (C) 2017-2019 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "runtime/scheduler/scheduler_kernel.h"
|
#include "runtime/scheduler/scheduler_kernel.h"
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
class DeviceQueueHw : public DeviceQueue {
|
class DeviceQueueHw : public DeviceQueue {
|
||||||
using BaseClass = DeviceQueue;
|
using BaseClass = DeviceQueue;
|
||||||
@@ -57,7 +58,7 @@ class DeviceQueueHw : public DeviceQueue {
|
|||||||
|
|
||||||
void addExecutionModelCleanUpSection(Kernel *parentKernel, TagNode<HwTimeStamps> *hwTimeStamp, uint32_t taskCount) override;
|
void addExecutionModelCleanUpSection(Kernel *parentKernel, TagNode<HwTimeStamps> *hwTimeStamp, uint32_t taskCount) override;
|
||||||
void resetDeviceQueue() 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() {
|
uint32_t getSchedulerReturnInstance() {
|
||||||
return igilQueue->m_controls.m_SchedulerEarlyReturn;
|
return igilQueue->m_controls.m_SchedulerEarlyReturn;
|
||||||
|
|||||||
@@ -368,8 +368,9 @@ size_t DeviceQueueHw<GfxFamily>::setSchedulerCrossThreadData(SchedulerKernel &sc
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
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,
|
GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(cmdQ,
|
||||||
|
commandStream,
|
||||||
*this,
|
*this,
|
||||||
preemptionMode,
|
preemptionMode,
|
||||||
scheduler,
|
scheduler,
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
|
|||||||
|
|
||||||
devQueue->dispatchScheduler(
|
devQueue->dispatchScheduler(
|
||||||
commandQueue,
|
commandQueue,
|
||||||
|
*kernelOperation->commandStream,
|
||||||
scheduler,
|
scheduler,
|
||||||
preemptionMode,
|
preemptionMode,
|
||||||
ssh,
|
ssh,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017-2018 Intel Corporation
|
* Copyright (C) 2017-2019 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -305,7 +305,9 @@ TEST_F(DeviceQueueTest, dispatchScheduler) {
|
|||||||
CommandQueue cmdQ(nullptr, nullptr, 0);
|
CommandQueue cmdQ(nullptr, nullptr, 0);
|
||||||
KernelInfo info;
|
KernelInfo info;
|
||||||
MockSchedulerKernel *kernel = new MockSchedulerKernel(&program, info, *device);
|
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;
|
delete kernel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ExecutionModelSchedulerFixture, dispatchScheduler) {
|
|||||||
|
|
||||||
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
||||||
*pCmdQ,
|
*pCmdQ,
|
||||||
|
pCmdQ->getCS(0),
|
||||||
*pDevQueueHw,
|
*pDevQueueHw,
|
||||||
pDevice->getPreemptionMode(),
|
pDevice->getPreemptionMode(),
|
||||||
scheduler,
|
scheduler,
|
||||||
@@ -178,6 +179,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ExecutionModelSchedulerFixture, dispatchSchedulerDoe
|
|||||||
|
|
||||||
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
||||||
*pCmdQ,
|
*pCmdQ,
|
||||||
|
pCmdQ->getCS(0),
|
||||||
*pDevQueueHw,
|
*pDevQueueHw,
|
||||||
pDevice->getPreemptionMode(),
|
pDevice->getPreemptionMode(),
|
||||||
scheduler,
|
scheduler,
|
||||||
@@ -211,6 +213,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, dispatchSchedulerWi
|
|||||||
|
|
||||||
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
||||||
*pCmdQ,
|
*pCmdQ,
|
||||||
|
pCmdQ->getCS(0),
|
||||||
mockDevQueue,
|
mockDevQueue,
|
||||||
device->getPreemptionMode(),
|
device->getPreemptionMode(),
|
||||||
scheduler,
|
scheduler,
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ class MockDeviceQueueHwWithCriticalSectionRelease : public DeviceQueueHw<GfxFami
|
|||||||
timestampAddedInCleanupSection = hwTimeStamp ? hwTimeStamp->tagForCpuAccess : nullptr;
|
timestampAddedInCleanupSection = hwTimeStamp ? hwTimeStamp->tagForCpuAccess : nullptr;
|
||||||
return BaseClass::addExecutionModelCleanUpSection(parentKernel, hwTimeStamp, taskCount);
|
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;
|
schedulerDispatched = true;
|
||||||
return BaseClass::dispatchScheduler(cmdQ, scheduler, preemptionMode, ssh, dsh);
|
return BaseClass::dispatchScheduler(cmdQ, commandStream, scheduler, preemptionMode, ssh, dsh);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t criticalSectioncheckCounter = 0;
|
uint32_t criticalSectioncheckCounter = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017-2018 Intel Corporation
|
* Copyright (C) 2017-2019 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -38,6 +38,7 @@ BDWTEST_F(BdwSchedulerTest, givenCallToDispatchSchedulerWhenPipeControlWithCSSta
|
|||||||
|
|
||||||
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
GpgpuWalkerHelper<FamilyType>::dispatchScheduler(
|
||||||
*pCmdQ,
|
*pCmdQ,
|
||||||
|
commandStream,
|
||||||
*pDevQueueHw,
|
*pDevQueueHw,
|
||||||
pDevice->getPreemptionMode(),
|
pDevice->getPreemptionMode(),
|
||||||
scheduler,
|
scheduler,
|
||||||
|
|||||||
Reference in New Issue
Block a user