Allow Device creating multiple CSRs [3/n]

Add CSR from Device to CommandQueue

Change-Id: Iaccf3c73d25e357242837677777d0513e81f520e
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-11-22 13:57:10 +01:00
committed by sys_ocldev
parent fbf0d44fff
commit 3ad33bf1b8
72 changed files with 239 additions and 242 deletions

View File

@@ -1797,7 +1797,7 @@ cl_int CL_API_CALL clSetUserEventStatus(cl_event event,
return retVal; return retVal;
} }
auto commandStreamReceiverOwnership = userEvent->getContext()->getDevice(0)->getCommandStreamReceiver().obtainUniqueOwnership(); auto commandStreamReceiverOwnership = userEvent->getContext()->getDevice(0)->getEngine(0).commandStreamReceiver->obtainUniqueOwnership();
userEvent->setStatus(executionStatus); userEvent->setStatus(executionStatus);
return retVal; return retVal;
} }

View File

@@ -77,8 +77,11 @@ CommandQueue::CommandQueue(Context *context,
commandQueueProperties = getCmdQueueProperties<cl_command_queue_properties>(properties); commandQueueProperties = getCmdQueueProperties<cl_command_queue_properties>(properties);
flushStamp.reset(new FlushStampTracker(true)); flushStamp.reset(new FlushStampTracker(true));
if (device && device->getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (device) {
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(device->getMemoryManager()); engine = &device->getEngine(engineId);
if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(device->getMemoryManager());
}
} }
} }
@@ -90,7 +93,7 @@ CommandQueue::~CommandQueue() {
} }
if (device) { if (device) {
auto storageForAllocation = device->getCommandStreamReceiver().getInternalAllocationStorage(); auto storageForAllocation = getCommandStreamReceiver().getInternalAllocationStorage();
if (commandStream) { if (commandStream) {
storageForAllocation->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandStream->getGraphicsAllocation()), REUSABLE_ALLOCATION); storageForAllocation->storeAllocation(std::unique_ptr<GraphicsAllocation>(commandStream->getGraphicsAllocation()), REUSABLE_ALLOCATION);
@@ -112,13 +115,17 @@ CommandQueue::~CommandQueue() {
} }
} }
CommandStreamReceiver &CommandQueue::getCommandStreamReceiver() const {
return *engine->commandStreamReceiver;
}
uint32_t CommandQueue::getHwTag() const { uint32_t CommandQueue::getHwTag() const {
uint32_t tag = *getHwTagAddress(); uint32_t tag = *getHwTagAddress();
return tag; return tag;
} }
volatile uint32_t *CommandQueue::getHwTagAddress() const { volatile uint32_t *CommandQueue::getHwTagAddress() const {
return device->getCommandStreamReceiver().getTagAddress(); return getCommandStreamReceiver().getTagAddress();
} }
bool CommandQueue::isCompleted(uint32_t taskCount) const { bool CommandQueue::isCompleted(uint32_t taskCount) const {
@@ -135,7 +142,7 @@ void CommandQueue::waitUntilComplete(uint32_t taskCountToWait, FlushStamp flushS
bool forcePowerSavingMode = this->throttle == QueueThrottle::LOW; bool forcePowerSavingMode = this->throttle == QueueThrottle::LOW;
device->getCommandStreamReceiver().waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, *device->getOsContext(), forcePowerSavingMode); getCommandStreamReceiver().waitForTaskCountWithKmdNotifyFallback(taskCountToWait, flushStampToWait, useQuickKmdSleep, *device->getOsContext(), forcePowerSavingMode);
DEBUG_BREAK_IF(getHwTag() < taskCountToWait); DEBUG_BREAK_IF(getHwTag() < taskCountToWait);
latestTaskCountWaited = taskCountToWait; latestTaskCountWaited = taskCountToWait;
@@ -161,7 +168,7 @@ bool CommandQueue::isQueueBlocked() {
//at this point we may reset queue TaskCount, since all command previous to this were aborted //at this point we may reset queue TaskCount, since all command previous to this were aborted
taskCount = 0; taskCount = 0;
flushStamp->setStamp(0); flushStamp->setStamp(0);
taskLevel = getDevice().getCommandStreamReceiver().peekTaskLevel(); taskLevel = getCommandStreamReceiver().peekTaskLevel();
} }
DebugManager.log(DebugManager.flags.EventsDebugEnable.get(), "isQueueBlocked taskLevel change from", taskLevel, "to new from virtualEvent", this->virtualEvent, "new tasklevel", this->virtualEvent->taskLevel.load()); DebugManager.log(DebugManager.flags.EventsDebugEnable.get(), "isQueueBlocked taskLevel change from", taskLevel, "to new from virtualEvent", this->virtualEvent, "new tasklevel", this->virtualEvent->taskLevel.load());
@@ -196,9 +203,8 @@ uint32_t CommandQueue::getTaskLevelFromWaitList(uint32_t taskLevel,
LinearStream &CommandQueue::getCS(size_t minRequiredSize) { LinearStream &CommandQueue::getCS(size_t minRequiredSize) {
DEBUG_BREAK_IF(nullptr == device); DEBUG_BREAK_IF(nullptr == device);
auto &commandStreamReceiver = device->getCommandStreamReceiver(); auto storageForAllocation = getCommandStreamReceiver().getInternalAllocationStorage();
auto storageForAllocation = commandStreamReceiver.getInternalAllocationStorage(); auto memoryManager = getCommandStreamReceiver().getMemoryManager();
auto memoryManager = commandStreamReceiver.getMemoryManager();
DEBUG_BREAK_IF(nullptr == memoryManager); DEBUG_BREAK_IF(nullptr == memoryManager);
if (!commandStream) { if (!commandStream) {
@@ -503,8 +509,6 @@ void CommandQueue::enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList
MemObjOffsetArray &copyOffset, MemObjOffsetArray &copyOffset,
bool readOnly, bool readOnly,
EventBuilder &externalEventBuilder) { EventBuilder &externalEventBuilder) {
auto &commandStreamReceiver = device->getCommandStreamReceiver();
EventBuilder internalEventBuilder; EventBuilder internalEventBuilder;
EventBuilder *eventBuilder; EventBuilder *eventBuilder;
// check if event will be exposed externally // check if event will be exposed externally
@@ -518,7 +522,7 @@ void CommandQueue::enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList
} }
//store task data in event //store task data in event
auto cmd = std::unique_ptr<Command>(new CommandMapUnmap(opType, *memObj, copySize, copyOffset, readOnly, commandStreamReceiver, *this)); auto cmd = std::unique_ptr<Command>(new CommandMapUnmap(opType, *memObj, copySize, copyOffset, readOnly, getCommandStreamReceiver(), *this));
eventBuilder->getEvent()->setCommand(std::move(cmd)); eventBuilder->getEvent()->setCommand(std::move(cmd));
//bind output event with input events //bind output event with input events
@@ -534,11 +538,10 @@ void CommandQueue::enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList
} }
bool CommandQueue::setupDebugSurface(Kernel *kernel) { bool CommandQueue::setupDebugSurface(Kernel *kernel) {
auto &commandStreamReceiver = device->getCommandStreamReceiver(); auto debugSurface = getCommandStreamReceiver().getDebugSurfaceAllocation();
auto debugSurface = commandStreamReceiver.getDebugSurfaceAllocation();
if (!debugSurface) { if (!debugSurface) {
debugSurface = commandStreamReceiver.allocateDebugSurface(SipKernel::maxDbgSurfaceSize); debugSurface = getCommandStreamReceiver().allocateDebugSurface(SipKernel::maxDbgSurfaceSize);
} }
DEBUG_BREAK_IF(!kernel->requiresSshForBuffers()); DEBUG_BREAK_IF(!kernel->requiresSshForBuffers());
@@ -552,15 +555,15 @@ bool CommandQueue::setupDebugSurface(Kernel *kernel) {
} }
IndirectHeap &CommandQueue::getIndirectHeap(IndirectHeap::Type heapType, size_t minRequiredSize) { IndirectHeap &CommandQueue::getIndirectHeap(IndirectHeap::Type heapType, size_t minRequiredSize) {
return this->getDevice().getCommandStreamReceiver().getIndirectHeap(heapType, minRequiredSize); return getCommandStreamReceiver().getIndirectHeap(heapType, minRequiredSize);
} }
void CommandQueue::allocateHeapMemory(IndirectHeap::Type heapType, size_t minRequiredSize, IndirectHeap *&indirectHeap) { void CommandQueue::allocateHeapMemory(IndirectHeap::Type heapType, size_t minRequiredSize, IndirectHeap *&indirectHeap) {
this->getDevice().getCommandStreamReceiver().allocateHeapMemory(heapType, minRequiredSize, indirectHeap); getCommandStreamReceiver().allocateHeapMemory(heapType, minRequiredSize, indirectHeap);
} }
void CommandQueue::releaseIndirectHeap(IndirectHeap::Type heapType) { void CommandQueue::releaseIndirectHeap(IndirectHeap::Type heapType) {
this->getDevice().getCommandStreamReceiver().releaseIndirectHeap(heapType); getCommandStreamReceiver().releaseIndirectHeap(heapType);
} }
void CommandQueue::dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo, BuffersForAuxTranslation &buffersForAuxTranslation, void CommandQueue::dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo, BuffersForAuxTranslation &buffersForAuxTranslation,
@@ -575,7 +578,7 @@ void CommandQueue::dispatchAuxTranslation(MultiDispatchInfo &multiDispatchInfo,
} }
void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes) { void CommandQueue::obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes) {
auto preferredPoolSize = device->getCommandStreamReceiver().getPreferredTagPoolSize(); auto preferredPoolSize = getCommandStreamReceiver().getPreferredTagPoolSize();
auto allocator = device->getMemoryManager()->obtainTimestampPacketAllocator(preferredPoolSize); auto allocator = device->getMemoryManager()->obtainTimestampPacketAllocator(preferredPoolSize);

View File

@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "runtime/helpers/base_object.h" #include "runtime/helpers/base_object.h"
#include "runtime/helpers/engine_control.h"
#include "runtime/helpers/task_information.h" #include "runtime/helpers/task_information.h"
#include "instrumentation.h" #include "instrumentation.h"
#include <atomic> #include <atomic>
@@ -324,6 +325,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
cl_uint numEventsInWaitList, cl_uint numEventsInWaitList,
const cl_event *eventWaitList); const cl_event *eventWaitList);
CommandStreamReceiver &getCommandStreamReceiver() const;
Device &getDevice() { return *device; } Device &getDevice() { return *device; }
Context &getContext() { return *context; } Context &getContext() { return *context; }
Context *getContextPtr() { return context; } Context *getContextPtr() { return context; }
@@ -417,13 +419,15 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes); void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes);
Context *context; Context *context = nullptr;
Device *device; Device *device = nullptr;
EngineControl *engine = nullptr;
cl_command_queue_properties commandQueueProperties; cl_command_queue_properties commandQueueProperties;
QueuePriority priority; QueuePriority priority;
QueueThrottle throttle; QueueThrottle throttle;
size_t engineId = 0;
bool perfCountersEnabled; bool perfCountersEnabled;
cl_uint perfCountersConfig; cl_uint perfCountersConfig;

View File

@@ -50,8 +50,8 @@ class CommandQueueHw : public CommandQueue {
} }
if (getCmdQueueProperties<cl_queue_properties>(properties, CL_QUEUE_PROPERTIES) & static_cast<cl_queue_properties>(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)) { if (getCmdQueueProperties<cl_queue_properties>(properties, CL_QUEUE_PROPERTIES) & static_cast<cl_queue_properties>(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)) {
device->getCommandStreamReceiver().overrideDispatchPolicy(DispatchMode::BatchedDispatch); getCommandStreamReceiver().overrideDispatchPolicy(DispatchMode::BatchedDispatch);
device->getCommandStreamReceiver().enableNTo1SubmissionModel(); getCommandStreamReceiver().enableNTo1SubmissionModel();
} }
} }

View File

@@ -51,7 +51,7 @@ void *CommandQueue::cpuDataTransferHandler(TransferProperties &transferPropertie
*eventsRequest.outEvent = outEventObj; *eventsRequest.outEvent = outEventObj;
} }
auto commandStreamReceieverOwnership = device->getCommandStreamReceiver().obtainUniqueOwnership(); auto commandStreamReceieverOwnership = getCommandStreamReceiver().obtainUniqueOwnership();
TakeOwnershipWrapper<CommandQueue> queueOwnership(*this); TakeOwnershipWrapper<CommandQueue> queueOwnership(*this);
auto blockQueue = false; auto blockQueue = false;

View File

@@ -142,8 +142,8 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
DeviceQueueHw<GfxFamily> *devQueueHw = castToObject<DeviceQueueHw<GfxFamily>>(devQueue); DeviceQueueHw<GfxFamily> *devQueueHw = castToObject<DeviceQueueHw<GfxFamily>>(devQueue);
HwTimeStamps *hwTimeStamps = nullptr; HwTimeStamps *hwTimeStamps = nullptr;
auto &commandStreamReceiver = device->getCommandStreamReceiver();
auto commandStreamRecieverOwnership = commandStreamReceiver.obtainUniqueOwnership(); auto commandStreamRecieverOwnership = getCommandStreamReceiver().obtainUniqueOwnership();
TimeStampData queueTimeStamp; TimeStampData queueTimeStamp;
if (isProfilingEnabled() && event) { if (isProfilingEnabled() && event) {
@@ -191,7 +191,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
enqueueHandlerHook(commandType, multiDispatchInfo); enqueueHandlerHook(commandType, multiDispatchInfo);
if (DebugManager.flags.AUBDumpSubCaptureMode.get()) { if (DebugManager.flags.AUBDumpSubCaptureMode.get()) {
commandStreamReceiver.activateAubSubCapture(multiDispatchInfo); getCommandStreamReceiver().activateAubSubCapture(multiDispatchInfo);
} }
if (DebugManager.flags.MakeEachEnqueueBlocking.get()) { if (DebugManager.flags.MakeEachEnqueueBlocking.get()) {
@@ -216,12 +216,12 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
} }
} }
if (device->getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
obtainNewTimestampPacketNodes(multiDispatchInfo.size(), previousTimestampPacketNodes); obtainNewTimestampPacketNodes(multiDispatchInfo.size(), previousTimestampPacketNodes);
} }
if (eventBuilder.getEvent()) { if (eventBuilder.getEvent()) {
if (commandStreamReceiver.peekTimestampPacketWriteEnabled()) { if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
eventBuilder.getEvent()->addTimestampPacketNodes(*timestampPacketContainer); eventBuilder.getEvent()->addTimestampPacketNodes(*timestampPacketContainer);
} }
if (this->isProfilingEnabled()) { if (this->isProfilingEnabled()) {
@@ -263,17 +263,17 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) { if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
for (auto &dispatchInfo : multiDispatchInfo) { for (auto &dispatchInfo : multiDispatchInfo) {
for (auto &patchInfoData : dispatchInfo.getKernel()->getPatchInfoDataList()) { for (auto &patchInfoData : dispatchInfo.getKernel()->getPatchInfoDataList()) {
commandStreamReceiver.getFlatBatchBufferHelper().setPatchInfoData(patchInfoData); getCommandStreamReceiver().getFlatBatchBufferHelper().setPatchInfoData(patchInfoData);
} }
} }
} }
commandStreamReceiver.setRequiredScratchSize(multiDispatchInfo.getRequiredScratchSize()); getCommandStreamReceiver().setRequiredScratchSize(multiDispatchInfo.getRequiredScratchSize());
slmUsed = multiDispatchInfo.usesSlm(); slmUsed = multiDispatchInfo.usesSlm();
} else if (commandStreamReceiver.peekTimestampPacketWriteEnabled()) { } else if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
if (CL_COMMAND_BARRIER == commandType) { if (CL_COMMAND_BARRIER == commandType) {
commandStreamReceiver.requestStallingPipeControlOnNextFlush(); getCommandStreamReceiver().requestStallingPipeControlOnNextFlush();
} }
if (eventBuilder.getEvent()) { if (eventBuilder.getEvent()) {
// Event from non-kernel enqueue inherits TimestampPackets from waitlist and command queue // Event from non-kernel enqueue inherits TimestampPackets from waitlist and command queue
@@ -292,7 +292,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
if (parentKernel) { if (parentKernel) {
size_t minSizeSSHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*parentKernel)); size_t minSizeSSHForEM = KernelCommandsHelper<GfxFamily>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(const_cast<const Kernel &>(*parentKernel));
uint32_t taskCount = commandStreamReceiver.peekTaskCount() + 1; uint32_t taskCount = getCommandStreamReceiver().peekTaskCount() + 1;
devQueueHw->setupExecutionModelDispatch(getIndirectHeap(IndirectHeap::SURFACE_STATE, minSizeSSHForEM), devQueueHw->setupExecutionModelDispatch(getIndirectHeap(IndirectHeap::SURFACE_STATE, minSizeSSHForEM),
*devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE), *devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE),
parentKernel, parentKernel,
@@ -321,12 +321,12 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
&getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u), &getIndirectHeap(IndirectHeap::SURFACE_STATE, 0u),
devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE)); devQueueHw->getIndirectHeap(IndirectHeap::DYNAMIC_STATE));
scheduler.makeResident(commandStreamReceiver); scheduler.makeResident(getCommandStreamReceiver());
// Update SLM usage // Update SLM usage
slmUsed |= scheduler.slmTotalSize > 0; slmUsed |= scheduler.slmTotalSize > 0;
parentKernel->getProgram()->getBlockKernelManager()->makeInternalAllocationsResident(commandStreamReceiver); parentKernel->getProgram()->getBlockKernelManager()->makeInternalAllocationsResident(getCommandStreamReceiver());
if (parentKernel->isAuxTranslationRequired()) { if (parentKernel->isAuxTranslationRequired()) {
blocking = true; blocking = true;
} }
@@ -354,7 +354,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
} }
if (parentKernel) { if (parentKernel) {
commandStreamReceiver.overrideMediaVFEStateDirty(true); getCommandStreamReceiver().overrideMediaVFEStateDirty(true);
if (devQueueHw->getSchedulerReturnInstance() > 0) { if (devQueueHw->getSchedulerReturnInstance() > 0) {
waitUntilComplete(completionStamp.taskCount, completionStamp.flushStamp, false); waitUntilComplete(completionStamp.taskCount, completionStamp.flushStamp, false);
@@ -440,7 +440,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
if (printfHandler) { if (printfHandler) {
printfHandler->printEnqueueOutput(); printfHandler->printEnqueueOutput();
} }
commandStreamReceiver.waitForTaskCountAndCleanAllocationList(completionStamp.taskCount, TEMPORARY_ALLOCATION); getCommandStreamReceiver().waitForTaskCountAndCleanAllocationList(completionStamp.taskCount, TEMPORARY_ALLOCATION);
} }
} }
} }
@@ -506,21 +506,20 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
UNRECOVERABLE_IF(multiDispatchInfo.empty()); UNRECOVERABLE_IF(multiDispatchInfo.empty());
auto &commandStreamReceiver = device->getCommandStreamReceiver();
auto implicitFlush = false; auto implicitFlush = false;
if (printfHandler) { if (printfHandler) {
blocking = true; blocking = true;
printfHandler->makeResident(commandStreamReceiver); printfHandler->makeResident(getCommandStreamReceiver());
} }
if (timestampPacketContainer) { if (timestampPacketContainer) {
timestampPacketContainer->makeResident(device->getCommandStreamReceiver()); timestampPacketContainer->makeResident(getCommandStreamReceiver());
previousTimestampPacketNodes->makeResident(device->getCommandStreamReceiver()); previousTimestampPacketNodes->makeResident(getCommandStreamReceiver());
} }
auto requiresCoherency = false; auto requiresCoherency = false;
for (auto surface : CreateRange(surfaces, surfaceCount)) { for (auto surface : CreateRange(surfaces, surfaceCount)) {
surface->makeResident(commandStreamReceiver); surface->makeResident(getCommandStreamReceiver());
requiresCoherency |= surface->IsCoherent; requiresCoherency |= surface->IsCoherent;
} }
@@ -534,7 +533,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
} else { } else {
continue; continue;
} }
kernel->makeResident(commandStreamReceiver); kernel->makeResident(getCommandStreamReceiver());
requiresCoherency |= kernel->requiresCoherency(); requiresCoherency |= kernel->requiresCoherency();
mediaSamplerRequired |= kernel->isVmeKernel(); mediaSamplerRequired |= kernel->isVmeKernel();
auto numGrfRequiredByKernel = kernel->getKernelInfo().patchInfo.executionEnvironment->NumGRFRequired; auto numGrfRequiredByKernel = kernel->getKernelInfo().patchInfo.executionEnvironment->NumGRFRequired;
@@ -550,9 +549,9 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
if (isProfilingEnabled() && eventBuilder.getEvent()) { if (isProfilingEnabled() && eventBuilder.getEvent()) {
this->getDevice().getOSTime()->getCpuGpuTime(&submitTimeStamp); this->getDevice().getOSTime()->getCpuGpuTime(&submitTimeStamp);
eventBuilder.getEvent()->setSubmitTimeStamp(&submitTimeStamp); eventBuilder.getEvent()->setSubmitTimeStamp(&submitTimeStamp);
this->getDevice().getCommandStreamReceiver().makeResident(*eventBuilder.getEvent()->getHwTimeStampNode()->getGraphicsAllocation()); getCommandStreamReceiver().makeResident(*eventBuilder.getEvent()->getHwTimeStampNode()->getGraphicsAllocation());
if (isPerfCountersEnabled()) { if (isPerfCountersEnabled()) {
this->getDevice().getCommandStreamReceiver().makeResident(*eventBuilder.getEvent()->getHwPerfCounterNode()->getGraphicsAllocation()); getCommandStreamReceiver().makeResident(*eventBuilder.getEvent()->getHwPerfCounterNode()->getGraphicsAllocation());
} }
} }
@@ -571,11 +570,11 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
ioh = &getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 0u); ioh = &getIndirectHeap(IndirectHeap::INDIRECT_OBJECT, 0u);
} }
commandStreamReceiver.requestThreadArbitrationPolicy(multiDispatchInfo.peekMainKernel()->getThreadArbitrationPolicy<GfxFamily>()); getCommandStreamReceiver().requestThreadArbitrationPolicy(multiDispatchInfo.peekMainKernel()->getThreadArbitrationPolicy<GfxFamily>());
auto allocNeedsFlushDC = false; auto allocNeedsFlushDC = false;
if (!device->isFullRangeSvm()) { if (!device->isFullRangeSvm()) {
if (std::any_of(commandStreamReceiver.getResidencyAllocations().begin(), commandStreamReceiver.getResidencyAllocations().end(), [](const auto allocation) { return allocation->flushL3Required; })) { if (std::any_of(getCommandStreamReceiver().getResidencyAllocations().begin(), getCommandStreamReceiver().getResidencyAllocations().end(), [](const auto allocation) { return allocation->flushL3Required; })) {
allocNeedsFlushDC = true; allocNeedsFlushDC = true;
} }
} }
@@ -592,8 +591,8 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
dispatchFlags.implicitFlush = implicitFlush; dispatchFlags.implicitFlush = implicitFlush;
dispatchFlags.flushStampReference = this->flushStamp->getStampReference(); dispatchFlags.flushStampReference = this->flushStamp->getStampReference();
dispatchFlags.preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo); dispatchFlags.preemptionMode = PreemptionHelper::taskPreemptionMode(*device, multiDispatchInfo);
dispatchFlags.outOfOrderExecutionAllowed = !eventBuilder.getEvent() || commandStreamReceiver.isNTo1SubmissionModelEnabled(); dispatchFlags.outOfOrderExecutionAllowed = !eventBuilder.getEvent() || getCommandStreamReceiver().isNTo1SubmissionModelEnabled();
if (commandStreamReceiver.peekTimestampPacketWriteEnabled()) { if (getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
dispatchFlags.outOfDeviceDependencies = &eventsRequest; dispatchFlags.outOfDeviceDependencies = &eventsRequest;
} }
dispatchFlags.numGrfRequired = numGrfRequired; dispatchFlags.numGrfRequired = numGrfRequired;
@@ -604,7 +603,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
gtpinNotifyPreFlushTask(this); gtpinNotifyPreFlushTask(this);
} }
CompletionStamp completionStamp = commandStreamReceiver.flushTask( CompletionStamp completionStamp = getCommandStreamReceiver().flushTask(
commandStream, commandStream,
commandStreamStart, commandStreamStart,
*dsh, *dsh,
@@ -631,8 +630,6 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
EventBuilder &externalEventBuilder, EventBuilder &externalEventBuilder,
std::unique_ptr<PrintfHandler> printfHandler) { std::unique_ptr<PrintfHandler> printfHandler) {
auto &commandStreamReceiver = device->getCommandStreamReceiver();
TakeOwnershipWrapper<CommandQueueHw<GfxFamily>> queueOwnership(*this); TakeOwnershipWrapper<CommandQueueHw<GfxFamily>> queueOwnership(*this);
//store previous virtual event as it will add dependecies to new virtual event //store previous virtual event as it will add dependecies to new virtual event
@@ -666,7 +663,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
*this, *this,
nullptr)); nullptr));
auto cmd = std::make_unique<CommandMarker>(*this, commandStreamReceiver, commandType, cmdSize); auto cmd = std::make_unique<CommandMarker>(*this, getCommandStreamReceiver(), commandType, cmdSize);
eventBuilder->getEvent()->setCommand(std::move(cmd)); eventBuilder->getEvent()->setCommand(std::move(cmd));
} else { } else {

View File

@@ -73,7 +73,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
eventWaitList, eventWaitList,
event); event);
auto storageForAllocation = device->getCommandStreamReceiver().getInternalAllocationStorage(); auto storageForAllocation = getCommandStreamReceiver().getInternalAllocationStorage();
storageForAllocation->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(patternAllocation), TEMPORARY_ALLOCATION, taskCount); storageForAllocation->storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation>(patternAllocation), TEMPORARY_ALLOCATION, taskCount);
return CL_SUCCESS; return CL_SUCCESS;

View File

@@ -97,7 +97,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
Surface *surfaces[] = {&bufferSurf, &hostPtrSurf}; Surface *surfaces[] = {&bufferSurf, &hostPtrSurf};
if (size != 0) { if (size != 0) {
bool status = getDevice().getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), true); bool status = getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), true);
if (!status) { if (!status) {
return CL_OUT_OF_RESOURCES; return CL_OUT_OF_RESOURCES;
} }

View File

@@ -76,7 +76,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBufferRect(
if (region[0] != 0 && if (region[0] != 0 &&
region[1] != 0 && region[1] != 0 &&
region[2] != 0) { region[2] != 0) {
bool status = getDevice().getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), true); bool status = getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), true);
if (!status) { if (!status) {
return CL_OUT_OF_RESOURCES; return CL_OUT_OF_RESOURCES;
} }

View File

@@ -82,7 +82,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadImage(
if (region[0] != 0 && if (region[0] != 0 &&
region[1] != 0 && region[1] != 0 &&
region[2] != 0) { region[2] != 0) {
bool status = getDevice().getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), true); bool status = getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), true);
if (!status) { if (!status) {
return CL_OUT_OF_RESOURCES; return CL_OUT_OF_RESOURCES;
} }

View File

@@ -222,8 +222,8 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
auto memoryManager = getDevice().getMemoryManager(); auto memoryManager = getDevice().getMemoryManager();
DEBUG_BREAK_IF(nullptr == memoryManager); DEBUG_BREAK_IF(nullptr == memoryManager);
auto commandStreamReceieverOwnership = device->getCommandStreamReceiver().obtainUniqueOwnership(); auto commandStreamReceieverOwnership = getCommandStreamReceiver().obtainUniqueOwnership();
auto storageWithAllocations = device->getCommandStreamReceiver().getInternalAllocationStorage(); auto storageWithAllocations = getCommandStreamReceiver().getInternalAllocationStorage();
auto patternAllocation = storageWithAllocations->obtainReusableAllocation(patternSize, false).release(); auto patternAllocation = storageWithAllocations->obtainReusableAllocation(patternSize, false).release();
commandStreamReceieverOwnership.unlock(); commandStreamReceieverOwnership.unlock();

View File

@@ -96,7 +96,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
Surface *surfaces[] = {&bufferSurf, &hostPtrSurf}; Surface *surfaces[] = {&bufferSurf, &hostPtrSurf};
if (size != 0) { if (size != 0) {
bool status = getDevice().getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), false); bool status = getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), false);
if (!status) { if (!status) {
return CL_OUT_OF_RESOURCES; return CL_OUT_OF_RESOURCES;
} }

View File

@@ -75,7 +75,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBufferRect(
if (region[0] != 0 && if (region[0] != 0 &&
region[1] != 0 && region[1] != 0 &&
region[2] != 0) { region[2] != 0) {
bool status = getDevice().getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), false); bool status = getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), false);
if (!status) { if (!status) {
return CL_OUT_OF_RESOURCES; return CL_OUT_OF_RESOURCES;
} }

View File

@@ -76,7 +76,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteImage(
if (region[0] != 0 && if (region[0] != 0 &&
region[1] != 0 && region[1] != 0 &&
region[2] != 0) { region[2] != 0) {
bool status = getDevice().getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), false); bool status = getCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, getDevice(), false);
if (!status) { if (!status) {
return CL_OUT_OF_RESOURCES; return CL_OUT_OF_RESOURCES;
} }

View File

@@ -15,8 +15,7 @@ namespace OCLRT {
template <typename GfxFamily> template <typename GfxFamily>
cl_int CommandQueueHw<GfxFamily>::finish(bool dcFlush) { cl_int CommandQueueHw<GfxFamily>::finish(bool dcFlush) {
auto &commandStreamReceiver = device->getCommandStreamReceiver(); getCommandStreamReceiver().flushBatchedSubmissions();
commandStreamReceiver.flushBatchedSubmissions();
//as long as queue is blocked we need to stall. //as long as queue is blocked we need to stall.
while (isQueueBlocked()) while (isQueueBlocked())
@@ -28,7 +27,7 @@ cl_int CommandQueueHw<GfxFamily>::finish(bool dcFlush) {
// Stall until HW reaches CQ taskCount // Stall until HW reaches CQ taskCount
waitUntilComplete(taskCountToWaitFor, flushStampToWaitFor, false); waitUntilComplete(taskCountToWaitFor, flushStampToWaitFor, false);
commandStreamReceiver.waitForTaskCountAndCleanAllocationList(taskCountToWaitFor, TEMPORARY_ALLOCATION); getCommandStreamReceiver().waitForTaskCountAndCleanAllocationList(taskCountToWaitFor, TEMPORARY_ALLOCATION);
return CL_SUCCESS; return CL_SUCCESS;
} }

View File

@@ -1,32 +1,16 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (C) 2017-2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation */
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once #pragma once
namespace OCLRT { namespace OCLRT {
template <typename GfxFamily> template <typename GfxFamily>
cl_int CommandQueueHw<GfxFamily>::flush() { cl_int CommandQueueHw<GfxFamily>::flush() {
auto &commandStreamReceiver = device->getCommandStreamReceiver(); getCommandStreamReceiver().flushBatchedSubmissions();
commandStreamReceiver.flushBatchedSubmissions();
return CL_SUCCESS; return CL_SUCCESS;
} }
} // namespace OCLRT } // namespace OCLRT

View File

@@ -409,7 +409,7 @@ size_t EnqueueOperation<GfxFamily>::getTotalSizeRequiredCS(uint32_t eventType, c
SchedulerKernel &scheduler = commandQueue.getDevice().getExecutionEnvironment()->getBuiltIns()->getSchedulerKernel(parentKernel->getContext()); SchedulerKernel &scheduler = commandQueue.getDevice().getExecutionEnvironment()->getBuiltIns()->getSchedulerKernel(parentKernel->getContext());
expectedSizeCS += EnqueueOperation<GfxFamily>::getSizeRequiredCS(eventType, reserveProfilingCmdsSpace, reservePerfCounters, commandQueue, &scheduler); expectedSizeCS += EnqueueOperation<GfxFamily>::getSizeRequiredCS(eventType, reserveProfilingCmdsSpace, reservePerfCounters, commandQueue, &scheduler);
} }
if (commandQueue.getDevice().getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (commandQueue.getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto semaphoreSize = sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT); auto semaphoreSize = sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
auto atomicSize = sizeof(typename GfxFamily::MI_ATOMIC); auto atomicSize = sizeof(typename GfxFamily::MI_ATOMIC);

View File

@@ -69,7 +69,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
commandStream = &commandQueue.getCS(0); commandStream = &commandQueue.getCS(0);
bool dcFlush = false; bool dcFlush = false;
commandQueue.getDevice().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;
@@ -164,7 +164,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
// 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.getDevice().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 = (MI_BATCH_BUFFER_START *)commandStream->getSpace(sizeof(MI_BATCH_BUFFER_START));

View File

@@ -67,7 +67,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
using UniqueIH = std::unique_ptr<IndirectHeap>; using UniqueIH = std::unique_ptr<IndirectHeap>;
*blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(commandStream), UniqueIH(dsh), UniqueIH(ioh), *blockedCommandsData = new KernelOperation(std::unique_ptr<LinearStream>(commandStream), UniqueIH(dsh), UniqueIH(ioh),
UniqueIH(ssh), *commandQueue.getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); UniqueIH(ssh), *commandQueue.getCommandStreamReceiver().getInternalAllocationStorage());
if (parentKernel) { if (parentKernel) {
(*blockedCommandsData)->doNotFreeISH = true; (*blockedCommandsData)->doNotFreeISH = true;
} }
@@ -81,7 +81,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
ssh = &getIndirectHeap<GfxFamily, IndirectHeap::SURFACE_STATE>(commandQueue, multiDispatchInfo); ssh = &getIndirectHeap<GfxFamily, IndirectHeap::SURFACE_STATE>(commandQueue, multiDispatchInfo);
} }
if (commandQueue.getDevice().getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (commandQueue.getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
GpgpuWalkerHelper<GfxFamily>::dispatchOnDeviceWaitlistSemaphores(commandStream, commandQueue.getDevice(), GpgpuWalkerHelper<GfxFamily>::dispatchOnDeviceWaitlistSemaphores(commandStream, commandQueue.getDevice(),
numEventsInWaitList, eventWaitList); numEventsInWaitList, eventWaitList);
if (previousTimestampPacketNodes) { if (previousTimestampPacketNodes) {
@@ -183,7 +183,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
dispatchWorkarounds(commandStream, commandQueue, kernel, true); dispatchWorkarounds(commandStream, commandQueue, kernel, true);
if (currentTimestampPacketNodes && commandQueue.getDevice().getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (currentTimestampPacketNodes && commandQueue.getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacket = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex)->tag; auto timestampPacket = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex)->tag;
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(commandStream, nullptr, timestampPacket, TimestampPacket::WriteOperationType::BeforeWalker); GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(commandStream, nullptr, timestampPacket, TimestampPacket::WriteOperationType::BeforeWalker);
} }
@@ -191,7 +191,7 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
// 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 walkerCmd = allocateWalkerSpace(*commandStream, kernel); auto walkerCmd = allocateWalkerSpace(*commandStream, kernel);
if (currentTimestampPacketNodes && commandQueue.getDevice().getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (currentTimestampPacketNodes && commandQueue.getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
auto timestampPacket = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex)->tag; auto timestampPacket = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex)->tag;
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(commandStream, walkerCmd, timestampPacket, TimestampPacket::WriteOperationType::AfterWalker); GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(commandStream, walkerCmd, timestampPacket, TimestampPacket::WriteOperationType::AfterWalker);
} }

View File

@@ -168,7 +168,7 @@ bool Context::createImpl(const cl_context_properties *properties,
memoryManager->getDeferredDeleter()->addClient(); memoryManager->getDeferredDeleter()->addClient();
} }
if (this->sharingFunctions[SharingType::VA_SHARING]) { if (this->sharingFunctions[SharingType::VA_SHARING]) {
device->getCommandStreamReceiver().peekKmdNotifyHelper()->initMaxPowerSavingMode(); device->initMaxPowerSavingMode();
} }
} }

View File

@@ -250,4 +250,10 @@ GFXCORE_FAMILY Device::getRenderCoreFamily() const {
bool Device::isSourceLevelDebuggerActive() const { bool Device::isSourceLevelDebuggerActive() const {
return deviceInfo.sourceLevelDebuggerActive; return deviceInfo.sourceLevelDebuggerActive;
} }
void Device::initMaxPowerSavingMode() {
for (auto &engine : engines) {
engine.commandStreamReceiver->peekKmdNotifyHelper()->initMaxPowerSavingMode();
}
}
} // namespace OCLRT } // namespace OCLRT

View File

@@ -67,13 +67,14 @@ class Device : public BaseObject<_cl_device_id> {
return engineType; return engineType;
} }
void initMaxPowerSavingMode();
void *getSLMWindowStartAddress(); void *getSLMWindowStartAddress();
void prepareSLMWindow(); void prepareSLMWindow();
void setForce32BitAddressing(bool value) { void setForce32BitAddressing(bool value) {
deviceInfo.force32BitAddressess = value; deviceInfo.force32BitAddressess = value;
} }
CommandStreamReceiver &getCommandStreamReceiver(); EngineControl &getEngine(size_t engineId);
volatile uint32_t *getTagAddress() const; volatile uint32_t *getTagAddress() const;
@@ -176,8 +177,8 @@ inline void Device::getCap(const void *&src,
retSize = size = DeviceInfoTable::Map<Param>::size; retSize = size = DeviceInfoTable::Map<Param>::size;
} }
inline CommandStreamReceiver &Device::getCommandStreamReceiver() { inline EngineControl &Device::getEngine(size_t engineId) {
return *engines[0].commandStreamReceiver; return engines[engineId];
} }
inline volatile uint32_t *Device::getTagAddress() const { inline volatile uint32_t *Device::getTagAddress() const {

View File

@@ -63,7 +63,7 @@ Event::Event(
if ((this->ctx == nullptr) && (cmdQueue != nullptr)) { if ((this->ctx == nullptr) && (cmdQueue != nullptr)) {
this->ctx = &cmdQueue->getContext(); this->ctx = &cmdQueue->getContext();
if (cmdQueue->getDevice().getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) { if (cmdQueue->getCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(cmdQueue->getDevice().getMemoryManager()); timestampPacketContainer = std::make_unique<TimestampPacketContainer>(cmdQueue->getDevice().getMemoryManager());
} }
} }
@@ -310,7 +310,7 @@ inline bool Event::wait(bool blocking, bool useQuickKmdSleep) {
DEBUG_BREAK_IF(this->taskLevel == Event::eventNotReady && this->executionStatus >= 0); DEBUG_BREAK_IF(this->taskLevel == Event::eventNotReady && this->executionStatus >= 0);
auto *allocationStorage = cmdQueue->getDevice().getCommandStreamReceiver().getInternalAllocationStorage(); auto *allocationStorage = cmdQueue->getCommandStreamReceiver().getInternalAllocationStorage();
allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION); allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
return true; return true;
@@ -346,7 +346,7 @@ void Event::updateExecutionStatus() {
transitionExecutionStatus(CL_COMPLETE); transitionExecutionStatus(CL_COMPLETE);
executeCallbacks(CL_COMPLETE); executeCallbacks(CL_COMPLETE);
unblockEventsBlockedByThis(CL_COMPLETE); unblockEventsBlockedByThis(CL_COMPLETE);
auto *allocationStorage = cmdQueue->getDevice().getCommandStreamReceiver().getInternalAllocationStorage(); auto *allocationStorage = cmdQueue->getCommandStreamReceiver().getInternalAllocationStorage();
allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION); allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
return; return;
} }
@@ -452,7 +452,7 @@ void Event::submitCommand(bool abortTasks) {
if (cmdToProcess.get() != nullptr) { if (cmdToProcess.get() != nullptr) {
if ((this->isProfilingEnabled()) && (this->cmdQueue != nullptr)) { if ((this->isProfilingEnabled()) && (this->cmdQueue != nullptr)) {
if (timeStampNode) { if (timeStampNode) {
this->cmdQueue->getDevice().getCommandStreamReceiver().makeResident(*timeStampNode->getGraphicsAllocation()); this->cmdQueue->getCommandStreamReceiver().makeResident(*timeStampNode->getGraphicsAllocation());
cmdToProcess->timestamp = timeStampNode->tag; cmdToProcess->timestamp = timeStampNode->tag;
} }
if (profilingCpuPath) { if (profilingCpuPath) {
@@ -462,7 +462,7 @@ void Event::submitCommand(bool abortTasks) {
this->cmdQueue->getDevice().getOSTime()->getCpuGpuTime(&submitTimeStamp); this->cmdQueue->getDevice().getOSTime()->getCpuGpuTime(&submitTimeStamp);
} }
if (perfCountersEnabled && perfCounterNode) { if (perfCountersEnabled && perfCounterNode) {
this->cmdQueue->getDevice().getCommandStreamReceiver().makeResident(*perfCounterNode->getGraphicsAllocation()); this->cmdQueue->getCommandStreamReceiver().makeResident(*perfCounterNode->getGraphicsAllocation());
} }
} }
auto &complStamp = cmdToProcess->submit(taskLevel, abortTasks); auto &complStamp = cmdToProcess->submit(taskLevel, abortTasks);
@@ -479,7 +479,7 @@ void Event::submitCommand(bool abortTasks) {
if (!this->isUserEvent() && this->eventWithoutCommand) { if (!this->isUserEvent() && this->eventWithoutCommand) {
if (this->cmdQueue) { if (this->cmdQueue) {
TakeOwnershipWrapper<Device> deviceOwnerhsip(this->cmdQueue->getDevice()); TakeOwnershipWrapper<Device> deviceOwnerhsip(this->cmdQueue->getDevice());
updateTaskCount(this->cmdQueue->getDevice().getCommandStreamReceiver().peekTaskCount()); updateTaskCount(this->cmdQueue->getCommandStreamReceiver().peekTaskCount());
} }
} }
} }
@@ -637,7 +637,7 @@ void Event::tryFlushEvent() {
if (cmdQueue && updateStatusAndCheckCompletion() == false) { if (cmdQueue && updateStatusAndCheckCompletion() == false) {
//flush the command queue only if it is not blocked event //flush the command queue only if it is not blocked event
if (taskLevel != Event::eventNotReady) { if (taskLevel != Event::eventNotReady) {
cmdQueue->getDevice().getCommandStreamReceiver().flushBatchedSubmissions(); cmdQueue->getCommandStreamReceiver().flushBatchedSubmissions();
} }
} }
} }
@@ -670,7 +670,7 @@ void Event::setEndTimeStamp() {
TagNode<HwTimeStamps> *Event::getHwTimeStampNode() { TagNode<HwTimeStamps> *Event::getHwTimeStampNode() {
if (!timeStampNode) { if (!timeStampNode) {
auto &device = getCommandQueue()->getDevice(); auto &device = getCommandQueue()->getDevice();
auto preferredPoolSize = device.getCommandStreamReceiver().getPreferredTagPoolSize(); auto preferredPoolSize = cmdQueue->getCommandStreamReceiver().getPreferredTagPoolSize();
timeStampNode = device.getMemoryManager()->obtainEventTsAllocator(preferredPoolSize)->getTag(); timeStampNode = device.getMemoryManager()->obtainEventTsAllocator(preferredPoolSize)->getTag();
} }
@@ -680,7 +680,7 @@ TagNode<HwTimeStamps> *Event::getHwTimeStampNode() {
TagNode<HwPerfCounter> *Event::getHwPerfCounterNode() { TagNode<HwPerfCounter> *Event::getHwPerfCounterNode() {
if (!perfCounterNode) { if (!perfCounterNode) {
auto &device = getCommandQueue()->getDevice(); auto &device = getCommandQueue()->getDevice();
auto preferredPoolSize = device.getCommandStreamReceiver().getPreferredTagPoolSize(); auto preferredPoolSize = cmdQueue->getCommandStreamReceiver().getPreferredTagPoolSize();
perfCounterNode = device.getMemoryManager()->obtainEventPerfCountAllocator(preferredPoolSize)->getTag(); perfCounterNode = device.getMemoryManager()->obtainEventPerfCountAllocator(preferredPoolSize)->getTag();
} }

View File

@@ -35,8 +35,8 @@ uint32_t UserEvent::getTaskLevel() {
uint32_t taskLevel = 0; uint32_t taskLevel = 0;
if (ctx != nullptr) { if (ctx != nullptr) {
Device *pDevice = ctx->getDevice(0); Device *pDevice = ctx->getDevice(0);
auto &csr = pDevice->getCommandStreamReceiver(); auto csr = pDevice->getEngine(0).commandStreamReceiver;
taskLevel = csr.peekTaskLevel(); taskLevel = csr->peekTaskLevel();
} }
return taskLevel; return taskLevel;
} }
@@ -68,9 +68,8 @@ bool VirtualEvent::wait(bool blocking, bool useQuickKmdSleep) {
uint32_t VirtualEvent::getTaskLevel() { uint32_t VirtualEvent::getTaskLevel() {
uint32_t taskLevel = 0; uint32_t taskLevel = 0;
if (ctx != nullptr) { if (cmdQueue != nullptr) {
Device *pDevice = ctx->getDevice(0); auto &csr = cmdQueue->getCommandStreamReceiver();
auto &csr = pDevice->getCommandStreamReceiver();
taskLevel = csr.peekTaskLevel(); taskLevel = csr.peekTaskLevel();
} }
return taskLevel; return taskLevel;

View File

@@ -117,7 +117,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
if (terminated) { if (terminated) {
return completionStamp; return completionStamp;
} }
auto &commandStreamReceiver = commandQueue.getDevice().getCommandStreamReceiver(); auto &commandStreamReceiver = commandQueue.getCommandStreamReceiver();
bool executionModelKernel = kernel->isParentKernel; bool executionModelKernel = kernel->isParentKernel;
auto devQueue = commandQueue.getContext().getDefaultDeviceQueue(); auto devQueue = commandQueue.getContext().getDefaultDeviceQueue();

View File

@@ -166,7 +166,7 @@ bool Platform::initialize() {
} }
} }
CommandStreamReceiverType csrType = this->devices[0]->getCommandStreamReceiver().getType(); CommandStreamReceiverType csrType = this->devices[0]->getEngine(0).commandStreamReceiver->getType();
if (csrType != CommandStreamReceiverType::CSR_HW) { if (csrType != CommandStreamReceiverType::CSR_HW) {
executionEnvironment->initAubCenter(&hwInfo[0], this->devices[0]->getEnableLocalMemory()); executionEnvironment->initAubCenter(&hwInfo[0], this->devices[0]->getEnableLocalMemory());
} }

View File

@@ -29,7 +29,7 @@ bool GlArbSyncEvent::setBaseEvent(Event &ev) {
UNRECOVERABLE_IF(ev.getContext() == nullptr); UNRECOVERABLE_IF(ev.getContext() == nullptr);
UNRECOVERABLE_IF(ev.getCommandQueue() == nullptr); UNRECOVERABLE_IF(ev.getCommandQueue() == nullptr);
auto cmdQueue = ev.getCommandQueue(); auto cmdQueue = ev.getCommandQueue();
auto osInterface = cmdQueue->getDevice().getCommandStreamReceiver().getOSInterface(); auto osInterface = cmdQueue->getCommandStreamReceiver().getOSInterface();
UNRECOVERABLE_IF(osInterface == nullptr); UNRECOVERABLE_IF(osInterface == nullptr);
if (false == ctx->getSharing<OCLRT::GLSharingFunctions>()->glArbSyncObjectSetup(*osInterface, *glSyncInfo)) { if (false == ctx->getSharing<OCLRT::GLSharingFunctions>()->glArbSyncObjectSetup(*osInterface, *glSyncInfo)) {
return false; return false;

View File

@@ -53,7 +53,7 @@ void GlSyncEvent::updateExecutionStatus() {
} }
uint32_t GlSyncEvent::getTaskLevel() { uint32_t GlSyncEvent::getTaskLevel() {
auto &csr = ctx->getDevice(0)->getCommandStreamReceiver(); auto csr = ctx->getDevice(0)->getEngine(0).commandStreamReceiver;
return csr.peekTaskLevel(); return csr->peekTaskLevel();
} }
} // namespace OCLRT } // namespace OCLRT

View File

@@ -9,6 +9,7 @@
#include "runtime/context/context.h" #include "runtime/context/context.h"
#include "runtime/device/device.h" #include "runtime/device/device.h"
#include "unit_tests/libult/ult_command_stream_receiver.h" #include "unit_tests/libult/ult_command_stream_receiver.h"
#include "unit_tests/mocks/mock_device.h"
#include "test.h" #include "test.h"
using namespace OCLRT; using namespace OCLRT;
@@ -62,7 +63,8 @@ TEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenQueueIs
HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToBatchingMode) { HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToBatchingMode) {
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto &csr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> &>(pContext->getDevice(0)->getCommandStreamReceiver()); auto mockDevice = castToObject<MockDevice>(devices[0]);
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode); EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
auto cmdq = clCreateCommandQueue(pContext, devices[0], ooq, &retVal); auto cmdq = clCreateCommandQueue(pContext, devices[0], ooq, &retVal);
@@ -73,7 +75,8 @@ HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenComma
HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToNTo1SubmissionModel) { HWTEST_F(clCreateCommandQueueTest, GivenOoqParametersWhenQueueIsCreatedThenCommandStreamReceiverSwitchesToNTo1SubmissionModel) {
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;
cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; cl_queue_properties ooq = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
auto &csr = reinterpret_cast<UltCommandStreamReceiver<FamilyType> &>(pContext->getDevice(0)->getCommandStreamReceiver()); auto mockDevice = castToObject<MockDevice>(devices[0]);
auto &csr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_FALSE(csr.isNTo1SubmissionModelEnabled()); EXPECT_FALSE(csr.isNTo1SubmissionModelEnabled());
auto cmdq = clCreateCommandQueue(pContext, devices[0], ooq, &retVal); auto cmdq = clCreateCommandQueue(pContext, devices[0], ooq, &retVal);

View File

@@ -277,7 +277,7 @@ HWTEST_F(AUBSimpleArg, givenAubCommandStreamerReceiverWhenBatchBufferFlateningIs
DebugManagerStateRestore dbgRestore; DebugManagerStateRestore dbgRestore;
DebugManager.flags.FlattenBatchBufferForAUBDump.set(true); DebugManager.flags.FlattenBatchBufferForAUBDump.set(true);
pCmdQ->getDevice().getCommandStreamReceiver().overrideDispatchPolicy(DispatchMode::ImmediateDispatch); pCmdQ->getCommandStreamReceiver().overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
auto retVal = pCmdQ->enqueueKernel( auto retVal = pCmdQ->enqueueKernel(
pKernel, pKernel,

View File

@@ -174,7 +174,7 @@ SKLTEST_F(AUBRunKernelIntegrateTest, ooqExecution) {
pCmdQ2 = createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE); pCmdQ2 = createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
ASSERT_NE(nullptr, pCmdQ2); ASSERT_NE(nullptr, pCmdQ2);
auto &csr = pCmdQ2->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ2->getCommandStreamReceiver();
csr.overrideDispatchPolicy(DispatchMode::ImmediateDispatch); csr.overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
retVal = pCmdQ2->enqueueKernel( retVal = pCmdQ2->enqueueKernel(

View File

@@ -643,7 +643,7 @@ HWTEST_F(CommandQueueHwTest, GivenEventThatIsNotCompletedWhenFinishIsCalledAndIt
auto ev = new Event(this->pCmdQ, CL_COMMAND_COPY_BUFFER, 3, Event::eventNotReady + 1); auto ev = new Event(this->pCmdQ, CL_COMMAND_COPY_BUFFER, 3, Event::eventNotReady + 1);
clSetEventCallback(ev, CL_COMPLETE, ClbFuncTempStruct::ClbFuncT, &Value); clSetEventCallback(ev, CL_COMPLETE, ClbFuncTempStruct::ClbFuncT, &Value);
auto &csr = this->pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = this->pCmdQ->getCommandStreamReceiver();
EXPECT_GT(3u, csr.peekTaskCount()); EXPECT_GT(3u, csr.peekTaskCount());
*csr.getTagAddress() = Event::eventNotReady + 1; *csr.getTagAddress() = Event::eventNotReady + 1;
ret = clFinish(this->pCmdQ); ret = clFinish(this->pCmdQ);

View File

@@ -328,7 +328,7 @@ TEST_F(CommandQueueCommandStreamTest, givenCommandStreamReceiverWithReusableAllo
auto memoryManager = pDevice->getMemoryManager(); auto memoryManager = pDevice->getMemoryManager();
size_t requiredSize = alignUp(100, MemoryConstants::pageSize) + CSRequirements::csOverfetchSize; size_t requiredSize = alignUp(100, MemoryConstants::pageSize) + CSRequirements::csOverfetchSize;
auto allocation = memoryManager->allocateGraphicsMemory(requiredSize); auto allocation = memoryManager->allocateGraphicsMemory(requiredSize);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = cmdQ.getCommandStreamReceiver();
commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION); commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
EXPECT_FALSE(commandStreamReceiver.getAllocationsForReuse().peekIsEmpty()); EXPECT_FALSE(commandStreamReceiver.getAllocationsForReuse().peekIsEmpty());
@@ -425,7 +425,7 @@ TEST_P(CommandQueueIndirectHeapTest, IndirectHeapContainsAtLeast64KB) {
auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), sizeof(uint32_t)); auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), sizeof(uint32_t));
if (this->GetParam() == IndirectHeap::SURFACE_STATE) { if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
EXPECT_EQ(pDevice->getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize, indirectHeap.getAvailableSpace()); EXPECT_EQ(cmdQ.getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize, indirectHeap.getAvailableSpace());
} else { } else {
EXPECT_EQ(64 * KB, indirectHeap.getAvailableSpace()); EXPECT_EQ(64 * KB, indirectHeap.getAvailableSpace());
} }
@@ -452,7 +452,7 @@ TEST_P(CommandQueueIndirectHeapTest, getIndirectHeapCanRecycle) {
ASSERT_NE(nullptr, &indirectHeap); ASSERT_NE(nullptr, &indirectHeap);
if (this->GetParam() == IndirectHeap::SURFACE_STATE) { if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
//no matter what SSH is always capped //no matter what SSH is always capped
EXPECT_EQ(cmdQ.getDevice().getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize, EXPECT_EQ(cmdQ.getCommandStreamReceiver().defaultSshSize - MemoryConstants::pageSize,
indirectHeap.getMaxAvailableSpace()); indirectHeap.getMaxAvailableSpace());
} else { } else {
EXPECT_LE(requiredSize, indirectHeap.getMaxAvailableSpace()); EXPECT_LE(requiredSize, indirectHeap.getMaxAvailableSpace());
@@ -486,16 +486,17 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAlloc
GraphicsAllocation *allocation = nullptr; GraphicsAllocation *allocation = nullptr;
auto &commandStreamReceiver = cmdQ.getCommandStreamReceiver();
if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT) { if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT) {
allocation = memoryManager->allocate32BitGraphicsMemory(allocationSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION); allocation = memoryManager->allocate32BitGraphicsMemory(allocationSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION);
} else { } else {
allocation = memoryManager->allocateGraphicsMemory(allocationSize); allocation = memoryManager->allocateGraphicsMemory(allocationSize);
} }
if (this->GetParam() == IndirectHeap::SURFACE_STATE) { if (this->GetParam() == IndirectHeap::SURFACE_STATE) {
allocation->setSize(cmdQ.getDevice().getCommandStreamReceiver().defaultSshSize * 2); allocation->setSize(commandStreamReceiver.defaultSshSize * 2);
} }
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver();
commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION); commandStreamReceiver.getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), REUSABLE_ALLOCATION);
EXPECT_FALSE(commandStreamReceiver.getAllocationsForReuse().peekIsEmpty()); EXPECT_FALSE(commandStreamReceiver.getAllocationsForReuse().peekIsEmpty());
@@ -922,7 +923,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenDebugKernelWhenSetupDebugSurfaceIsC
kernel->setSshLocal(nullptr, sizeof(RENDER_SURFACE_STATE) + kernel->getAllocatedKernelInfo()->patchInfo.pAllocateSystemThreadSurface->Offset); kernel->setSshLocal(nullptr, sizeof(RENDER_SURFACE_STATE) + kernel->getAllocatedKernelInfo()->patchInfo.pAllocateSystemThreadSurface->Offset);
kernel->getAllocatedKernelInfo()->usesSsh = true; kernel->getAllocatedKernelInfo()->usesSsh = true;
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = cmdQ.getCommandStreamReceiver();
cmdQ.setupDebugSurface(kernel.get()); cmdQ.setupDebugSurface(kernel.get());
@@ -941,7 +942,7 @@ HWTEST_F(CommandQueueCommandStreamTest, givenCsrWithDebugSurfaceAllocatedWhenSet
kernel->setSshLocal(nullptr, sizeof(RENDER_SURFACE_STATE) + kernel->getAllocatedKernelInfo()->patchInfo.pAllocateSystemThreadSurface->Offset); kernel->setSshLocal(nullptr, sizeof(RENDER_SURFACE_STATE) + kernel->getAllocatedKernelInfo()->patchInfo.pAllocateSystemThreadSurface->Offset);
kernel->getAllocatedKernelInfo()->usesSsh = true; kernel->getAllocatedKernelInfo()->usesSsh = true;
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = cmdQ.getCommandStreamReceiver();
commandStreamReceiver.allocateDebugSurface(SipKernel::maxDbgSurfaceSize); commandStreamReceiver.allocateDebugSurface(SipKernel::maxDbgSurfaceSize);
auto debugSurface = commandStreamReceiver.getDebugSurfaceAllocation(); auto debugSurface = commandStreamReceiver.getDebugSurfaceAllocation();
ASSERT_NE(nullptr, debugSurface); ASSERT_NE(nullptr, debugSurface);

View File

@@ -190,7 +190,7 @@ HWTEST_F(EnqueueCopyBufferRectTest, 2D_LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyBufferRect2D<FamilyType>(); enqueueCopyBufferRect2D<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }
@@ -312,7 +312,7 @@ HWTEST_F(EnqueueCopyBufferRectTest, 3D_LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferRectTest, When3DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferRectTest, When3DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyBufferRect3D<FamilyType>(); enqueueCopyBufferRect3D<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -159,7 +159,7 @@ HWTEST_F(EnqueueCopyBufferTest, LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyBufferAndParse<FamilyType>(); enqueueCopyBufferAndParse<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -90,7 +90,7 @@ HWTEST_F(EnqueueCopyBufferToImageTest, loadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferToImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyBufferToImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyBufferToImage<FamilyType>(); enqueueCopyBufferToImage<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -93,7 +93,7 @@ HWTEST_F(EnqueueCopyImageTest, loadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyImage<FamilyType>(); enqueueCopyImage<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -91,7 +91,7 @@ HWTEST_F(EnqueueCopyImageToBufferTest, loadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageToBufferTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageToBufferTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyImageToBuffer<FamilyType>(); enqueueCopyImageToBuffer<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -102,7 +102,7 @@ HWTEST_F(EnqueueDebugKernelTest, givenDebugKernelWhenEnqueuedThenSSHAndBtiAreCor
auto debugSurfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(ssh.getCpuBase(), surfaceStateOffset)); auto debugSurfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(ssh.getCpuBase(), surfaceStateOffset));
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = mockCmdQ->getCommandStreamReceiver();
auto debugSurface = commandStreamReceiver.getDebugSurfaceAllocation(); auto debugSurface = commandStreamReceiver.getDebugSurfaceAllocation();
EXPECT_EQ(1u, debugSurface->getTaskCount(0u)); EXPECT_EQ(1u, debugSurface->getTaskCount(0u));

View File

@@ -206,7 +206,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueFillBufferCmdTests, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueFillBufferCmdTests, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueFillBuffer<FamilyType>(); enqueueFillBuffer<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }
@@ -366,7 +366,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, argumentTwoShouldMatchPatternPtr) {
} }
HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeCopied) { HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeCopied) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer); EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer);
ASSERT_FALSE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_FALSE(csr.getTemporaryAllocations().peekIsEmpty());
@@ -387,7 +387,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeCopied) {
} }
HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeAligned) { HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeAligned) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer); EnqueueFillBufferHelper<>::enqueueFillBuffer(pCmdQ, buffer);
ASSERT_FALSE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_FALSE(csr.getTemporaryAllocations().peekIsEmpty());
@@ -409,7 +409,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternShouldBeAligned) {
} }
HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeOneByteShouldGetPreparedForMiddleKernel) { HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeOneByteShouldGetPreparedForMiddleKernel) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
ASSERT_TRUE(csr.getAllocationsForReuse().peekIsEmpty()); ASSERT_TRUE(csr.getAllocationsForReuse().peekIsEmpty());
ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
@@ -442,7 +442,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeOneByteShouldGetPreparedForMidd
} }
HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeTwoBytesShouldGetPreparedForMiddleKernel) { HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeTwoBytesShouldGetPreparedForMiddleKernel) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
ASSERT_TRUE(csr.getAllocationsForReuse().peekIsEmpty()); ASSERT_TRUE(csr.getAllocationsForReuse().peekIsEmpty());
ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
@@ -475,7 +475,7 @@ HWTEST_F(EnqueueFillBufferCmdTests, patternOfSizeTwoBytesShouldGetPreparedForMid
} }
HWTEST_F(EnqueueFillBufferCmdTests, givenEnqueueFillBufferWhenPatternAllocationIsObtainedThenItsTypeShouldBeSetToFillPattern) { HWTEST_F(EnqueueFillBufferCmdTests, givenEnqueueFillBufferWhenPatternAllocationIsObtainedThenItsTypeShouldBeSetToFillPattern) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); ASSERT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
auto dstBuffer = std::unique_ptr<Buffer>(BufferHelper<>::create()); auto dstBuffer = std::unique_ptr<Buffer>(BufferHelper<>::create());

View File

@@ -100,7 +100,7 @@ HWTEST_F(EnqueueFillImageTest, loadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueFillImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueFillImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueFillImage<FamilyType>(); enqueueFillImage<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -537,7 +537,7 @@ HWTEST_P(EnqueueKernelPrintfTest, GivenKernelWithPrintfWhenBeingDispatchedThenL3
MockKernelWithInternals mockKernel(*pDevice); MockKernelWithInternals mockKernel(*pDevice);
mockKernel.crossThreadData[64] = 0; mockKernel.crossThreadData[64] = 0;
mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData; mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto latestSentTaskCount = csr.peekTaskCount(); auto latestSentTaskCount = csr.peekTaskCount();
enqueueKernel<FamilyType, false>(mockKernel); enqueueKernel<FamilyType, false>(mockKernel);
auto newLatestSentTaskCount = csr.peekTaskCount(); auto newLatestSentTaskCount = csr.peekTaskCount();
@@ -557,7 +557,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueKernelPrintfTest, GivenKernelWithPrintfBlocke
MockKernelWithInternals mockKernel(*pDevice); MockKernelWithInternals mockKernel(*pDevice);
mockKernel.crossThreadData[64] = 0; mockKernel.crossThreadData[64] = 0;
mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData; mockKernel.kernelInfo.patchInfo.pAllocateStatelessPrintfSurface = &patchData;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto latestSentDcFlushTaskCount = csr.peekTaskCount(); auto latestSentDcFlushTaskCount = csr.peekTaskCount();
cl_uint workDim = 1; cl_uint workDim = 1;

View File

@@ -69,7 +69,7 @@ TEST_F(EventTests, eventWaitShouldntSendPC) {
cl_event *eventWaitList = nullptr; cl_event *eventWaitList = nullptr;
cl_event event = nullptr; cl_event event = nullptr;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event); auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event);
@@ -108,7 +108,7 @@ TEST_F(EventTests, waitForArray) {
cl_event *eventWaitList = nullptr; cl_event *eventWaitList = nullptr;
cl_event event[2] = {}; cl_event event[2] = {};
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event[0]); auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event[0]);
@@ -152,7 +152,7 @@ TEST_F(EventTests, event_NDR_Wait_NDR_Finish) {
cl_event *eventWaitList = nullptr; cl_event *eventWaitList = nullptr;
cl_event event = nullptr; cl_event event = nullptr;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event); auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event);
@@ -191,7 +191,7 @@ TEST_F(EventTests, eventPassedToEnqueueMarkerHasTheSameLevelAsPreviousCommand) {
cl_uint numEventsInWaitList = 0; cl_uint numEventsInWaitList = 0;
cl_event *eventWaitList = nullptr; cl_event *eventWaitList = nullptr;
cl_event event = nullptr; cl_event event = nullptr;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event); auto retVal = callOneWorkItemNDRKernel(eventWaitList, numEventsInWaitList, &event);

View File

@@ -284,7 +284,7 @@ TEST_F(EnqueueMapBufferTest, givenNonBlockingReadOnlyMapBufferOnZeroCopyBufferWh
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, buffer); EXPECT_NE(nullptr, buffer);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
uint32_t taskCount = commandStreamReceiver.peekTaskCount(); uint32_t taskCount = commandStreamReceiver.peekTaskCount();
EXPECT_EQ(0u, taskCount); EXPECT_EQ(0u, taskCount);
@@ -374,7 +374,7 @@ TEST_F(EnqueueMapBufferTest, givenNonReadOnlyBufferWhenMappedOnGpuThenSetValidEv
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, buffer.get()); EXPECT_NE(nullptr, buffer.get());
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
EXPECT_EQ(0u, commandStreamReceiver.peekTaskCount()); EXPECT_EQ(0u, commandStreamReceiver.peekTaskCount());
auto ptrResult = clEnqueueMapBuffer(pCmdQ, buffer.get(), CL_FALSE, CL_MAP_WRITE, 0, 8, 0, auto ptrResult = clEnqueueMapBuffer(pCmdQ, buffer.get(), CL_FALSE, CL_MAP_WRITE, 0, 8, 0,
@@ -416,7 +416,7 @@ TEST_F(EnqueueMapBufferTest, givenReadOnlyBufferWhenMappedOnGpuThenSetValidEvent
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, buffer.get()); EXPECT_NE(nullptr, buffer.get());
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
EXPECT_EQ(0u, commandStreamReceiver.peekTaskCount()); EXPECT_EQ(0u, commandStreamReceiver.peekTaskCount());
auto ptrResult = clEnqueueMapBuffer(pCmdQ, buffer.get(), CL_FALSE, CL_MAP_READ, 0, 8, 0, auto ptrResult = clEnqueueMapBuffer(pCmdQ, buffer.get(), CL_FALSE, CL_MAP_READ, 0, 8, 0,
@@ -462,7 +462,7 @@ TEST_F(EnqueueMapBufferTest, givenNonBlockingMapBufferAfterL3IsAlreadyFlushedThe
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, buffer); EXPECT_NE(nullptr, buffer);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
uint32_t taskCount = commandStreamReceiver.peekTaskCount(); uint32_t taskCount = commandStreamReceiver.peekTaskCount();
EXPECT_EQ(0u, taskCount); EXPECT_EQ(0u, taskCount);
@@ -543,7 +543,7 @@ TEST_F(EnqueueMapBufferTest, GivenBufferThatIsNotZeroCopyWhenNonBlockingMapIsCal
retVal = clEnqueueNDRangeKernel(pCmdQ, kernel, 1, 0, &GWS, nullptr, 0, nullptr, nullptr); retVal = clEnqueueNDRangeKernel(pCmdQ, kernel, 1, 0, &GWS, nullptr, 0, nullptr, nullptr);
EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_EQ(retVal, CL_SUCCESS);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
uint32_t taskCount = commandStreamReceiver.peekTaskCount(); uint32_t taskCount = commandStreamReceiver.peekTaskCount();
EXPECT_EQ(1u, taskCount); EXPECT_EQ(1u, taskCount);
@@ -640,7 +640,7 @@ HWTEST_F(EnqueueMapBufferTest, MapBufferEventProperties) {
} }
TEST_F(EnqueueMapBufferTest, GivenZeroCopyBufferWhenMapBufferWithoutEventsThenCommandStreamReceiverUpdatesRequiredDCFlushCount) { TEST_F(EnqueueMapBufferTest, GivenZeroCopyBufferWhenMapBufferWithoutEventsThenCommandStreamReceiverUpdatesRequiredDCFlushCount) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
auto buffer = clCreateBuffer( auto buffer = clCreateBuffer(
BufferDefaults::context, BufferDefaults::context,

View File

@@ -288,7 +288,7 @@ TEST_F(EnqueueMapImageTest, givenNonReadOnlyMapWithOutEventWhenMappedThenSetEven
MockKernelWithInternals kernel(*pDevice); MockKernelWithInternals kernel(*pDevice);
*pTagMemory = tagHW; *pTagMemory = tagHW;
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
auto tag_address = commandStreamReceiver.getTagAddress(); auto tag_address = commandStreamReceiver.getTagAddress();
EXPECT_TRUE(pTagMemory == tag_address); EXPECT_TRUE(pTagMemory == tag_address);
@@ -367,7 +367,7 @@ TEST_F(EnqueueMapImageTest, givenReadOnlyMapWithOutEventWhenMappedThenSetEventAn
const size_t region[3] = {1, 1, 1}; const size_t region[3] = {1, 1, 1};
*pTagMemory = 5; *pTagMemory = 5;
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
EXPECT_EQ(1u, commandStreamReceiver.peekTaskCount()); EXPECT_EQ(1u, commandStreamReceiver.peekTaskCount());

View File

@@ -203,7 +203,7 @@ HWTEST_F(EnqueueReadBufferRectTest, 2D_LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueReadBufferRect2D<FamilyType>(); enqueueReadBufferRect2D<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -165,7 +165,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadBufferTypeTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadBufferTypeTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
srcBuffer->forceDisallowCPUCopy = true; srcBuffer->forceDisallowCPUCopy = true;
enqueueReadBuffer<FamilyType>(); enqueueReadBuffer<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -104,7 +104,7 @@ HWTEST_F(EnqueueReadImageTest, loadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueReadImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueReadImage<FamilyType>(); enqueueReadImage<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }
@@ -227,7 +227,7 @@ HWTEST_F(EnqueueReadImageTest, GivenImage1DarrayWhenReadImageIsCalledThenHostPtr
EnqueueReadImageHelper<>::enqueueReadImage(pCmdQ, srcImage, CL_FALSE, origin, region); EnqueueReadImageHelper<>::enqueueReadImage(pCmdQ, srcImage, CL_FALSE, origin, region);
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto temporaryAllocation = csr.getTemporaryAllocations().peekHead(); auto temporaryAllocation = csr.getTemporaryAllocations().peekHead();
ASSERT_NE(nullptr, temporaryAllocation); ASSERT_NE(nullptr, temporaryAllocation);
@@ -246,7 +246,7 @@ HWTEST_F(EnqueueReadImageTest, GivenImage2DarrayWhenReadImageIsCalledThenHostPtr
EnqueueReadImageHelper<>::enqueueReadImage(pCmdQ, srcImage, CL_FALSE, origin, region); EnqueueReadImageHelper<>::enqueueReadImage(pCmdQ, srcImage, CL_FALSE, origin, region);
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto temporaryAllocation = csr.getTemporaryAllocations().peekHead(); auto temporaryAllocation = csr.getTemporaryAllocations().peekHead();
ASSERT_NE(nullptr, temporaryAllocation); ASSERT_NE(nullptr, temporaryAllocation);

View File

@@ -425,7 +425,7 @@ TEST_F(EnqueueSvmTest, enqueueSVMMemFillDoubleToReuseAllocation_Success) {
} }
TEST_F(EnqueueSvmTest, givenEnqueueSVMMemFillWhenPatternAllocationIsObtainedThenItsTypeShouldBeSetToFillPattern) { TEST_F(EnqueueSvmTest, givenEnqueueSVMMemFillWhenPatternAllocationIsObtainedThenItsTypeShouldBeSetToFillPattern) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
ASSERT_TRUE(csr.getAllocationsForReuse().peekIsEmpty()); ASSERT_TRUE(csr.getAllocationsForReuse().peekIsEmpty());
const float pattern[1] = {1.2345f}; const float pattern[1] = {1.2345f};

View File

@@ -418,7 +418,7 @@ HWTEST_F(EnqueueThreading, finish) {
// set something to finish // set something to finish
pCmdQ->taskCount = 1; pCmdQ->taskCount = 1;
pCmdQ->taskLevel = 1; pCmdQ->taskLevel = 1;
auto csr = (CommandStreamReceiverMock<FamilyType> *)&this->pDevice->getCommandStreamReceiver(); auto csr = (CommandStreamReceiverMock<FamilyType> *)&this->pCmdQ->getCommandStreamReceiver();
csr->expectedToFreeCount = 0u; csr->expectedToFreeCount = 0u;
pCmdQ->finish(false); pCmdQ->finish(false);

View File

@@ -177,7 +177,7 @@ HWTEST_F(EnqueueWriteBufferRectTest, 2D_LoadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteBufferRectTest, When2DEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueWriteBufferRect2D<FamilyType>(); enqueueWriteBufferRect2D<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -164,7 +164,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteBufferTypeTest, WhenEnqueueIsDoneThenSta
srcBuffer->forceDisallowCPUCopy = true; srcBuffer->forceDisallowCPUCopy = true;
enqueueWriteBuffer<FamilyType>(); enqueueWriteBuffer<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }

View File

@@ -103,7 +103,7 @@ HWTEST_F(EnqueueWriteImageTest, loadRegisterImmediateL3CNTLREG) {
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) { HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueWriteImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueWriteImage<FamilyType>(); enqueueWriteImage<FamilyType>();
validateStateBaseAddress<FamilyType>(this->pDevice->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(), validateStateBaseAddress<FamilyType>(this->pCmdQ->getCommandStreamReceiver().getMemoryManager()->getInternalHeapBaseAddress(),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu); pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
} }
@@ -200,7 +200,7 @@ HWTEST_F(EnqueueWriteImageTest, GivenImage1DarrayWhenReadWriteImageIsCalledThenH
EnqueueWriteImageHelper<>::enqueueWriteImage(pCmdQ, dstImage2, CL_FALSE, origin, region); EnqueueWriteImageHelper<>::enqueueWriteImage(pCmdQ, dstImage2, CL_FALSE, origin, region);
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto temporaryAllocation1 = csr.getTemporaryAllocations().peekHead(); auto temporaryAllocation1 = csr.getTemporaryAllocations().peekHead();
ASSERT_NE(nullptr, temporaryAllocation1); ASSERT_NE(nullptr, temporaryAllocation1);
@@ -224,7 +224,7 @@ HWTEST_F(EnqueueWriteImageTest, GivenImage2DarrayWhenReadWriteImageIsCalledThenH
EnqueueWriteImageHelper<>::enqueueWriteImage(pCmdQ, dstImage2, CL_FALSE, origin, region); EnqueueWriteImageHelper<>::enqueueWriteImage(pCmdQ, dstImage2, CL_FALSE, origin, region);
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto temporaryAllocation1 = csr.getTemporaryAllocations().peekHead(); auto temporaryAllocation1 = csr.getTemporaryAllocations().peekHead();
ASSERT_NE(nullptr, temporaryAllocation1); ASSERT_NE(nullptr, temporaryAllocation1);

View File

@@ -39,7 +39,7 @@ TEST_F(IOQ, enqueueReadBuffer_increasesTaskLevel) {
} }
TEST_F(IOQ, enqueueKernel_changesTaskCount) { TEST_F(IOQ, enqueueKernel_changesTaskCount) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
auto previousTaskCount = commandStreamReceiver.peekTaskCount(); auto previousTaskCount = commandStreamReceiver.peekTaskCount();
EnqueueKernelHelper<>::enqueueKernel(pCmdQ, EnqueueKernelHelper<>::enqueueKernel(pCmdQ,
@@ -49,7 +49,7 @@ TEST_F(IOQ, enqueueKernel_changesTaskCount) {
} }
TEST_F(IOQ, enqueueFillBuffer_changesTaskCount) { TEST_F(IOQ, enqueueFillBuffer_changesTaskCount) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
auto previousTaskCount = commandStreamReceiver.peekTaskCount(); auto previousTaskCount = commandStreamReceiver.peekTaskCount();
EnqueueFillBufferHelper<>::enqueue(pCmdQ); EnqueueFillBufferHelper<>::enqueue(pCmdQ);
@@ -58,7 +58,7 @@ TEST_F(IOQ, enqueueFillBuffer_changesTaskCount) {
} }
TEST_F(IOQ, enqueueReadBuffer_changesTaskCount) { TEST_F(IOQ, enqueueReadBuffer_changesTaskCount) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
auto previousTaskCount = commandStreamReceiver.peekTaskCount(); auto previousTaskCount = commandStreamReceiver.peekTaskCount();
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create()); auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());

View File

@@ -33,7 +33,7 @@ bool isBlockingCall(unsigned int cmdType) {
} }
TYPED_TEST_P(OOQTaskTypedTests, givenNonBlockingCallWhenDoneOnOutOfOrderQueueThenTaskLevelDoesntChange) { TYPED_TEST_P(OOQTaskTypedTests, givenNonBlockingCallWhenDoneOnOutOfOrderQueueThenTaskLevelDoesntChange) {
auto &commandStreamReceiver = this->pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = this->pCmdQ->getCommandStreamReceiver();
auto tagAddress = commandStreamReceiver.getTagAddress(); auto tagAddress = commandStreamReceiver.getTagAddress();
auto blockingCall = isBlockingCall(TypeParam::Traits::cmdType); auto blockingCall = isBlockingCall(TypeParam::Traits::cmdType);
@@ -60,7 +60,7 @@ TYPED_TEST_P(OOQTaskTypedTests, givenNonBlockingCallWhenDoneOnOutOfOrderQueueThe
} }
TYPED_TEST_P(OOQTaskTypedTests, givenTaskWhenEnqueuedOnOutOfOrderQueueThenTaskCountIsUpdated) { TYPED_TEST_P(OOQTaskTypedTests, givenTaskWhenEnqueuedOnOutOfOrderQueueThenTaskCountIsUpdated) {
auto &commandStreamReceiver = this->pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = this->pCmdQ->getCommandStreamReceiver();
auto previousTaskCount = commandStreamReceiver.peekTaskCount(); auto previousTaskCount = commandStreamReceiver.peekTaskCount();
auto tagAddress = commandStreamReceiver.getTagAddress(); auto tagAddress = commandStreamReceiver.getTagAddress();
auto blockingCall = isBlockingCall(TypeParam::Traits::cmdType); auto blockingCall = isBlockingCall(TypeParam::Traits::cmdType);
@@ -104,7 +104,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(OOQ, OOQTaskTypedTests, EnqueueParams);
typedef OOQTaskTypedTests<EnqueueKernelHelper<>> OOQTaskTests; typedef OOQTaskTypedTests<EnqueueKernelHelper<>> OOQTaskTests;
TEST_F(OOQTaskTests, enqueueKernel_changesTaskCount) { TEST_F(OOQTaskTests, enqueueKernel_changesTaskCount) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pCmdQ->getCommandStreamReceiver();
auto previousTaskCount = commandStreamReceiver.peekTaskCount(); auto previousTaskCount = commandStreamReceiver.peekTaskCount();
EnqueueKernelHelper<>::enqueueKernel(this->pCmdQ, EnqueueKernelHelper<>::enqueueKernel(this->pCmdQ,

View File

@@ -64,7 +64,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenOverrideThreadArbitrationPoli
} }
HWTEST_F(CommandStreamReceiverFlushTaskTests, taskCountShouldBeUpdated) { HWTEST_F(CommandStreamReceiverFlushTaskTests, taskCountShouldBeUpdated) {
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
flushTask(commandStreamReceiver); flushTask(commandStreamReceiver);
EXPECT_EQ(1u, commandStreamReceiver.peekTaskCount()); EXPECT_EQ(1u, commandStreamReceiver.peekTaskCount());
@@ -593,7 +593,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, stateBaseAddressShouldNotBeSentIfT
HWTEST_F(CommandStreamReceiverFlushTaskTests, shouldntAddAnyCommandsToCQCSIfEmpty) { HWTEST_F(CommandStreamReceiverFlushTaskTests, shouldntAddAnyCommandsToCQCSIfEmpty) {
WhitelistedRegisters forceRegs = {0}; WhitelistedRegisters forceRegs = {0};
pDevice->setForceWhitelistedRegs(true, &forceRegs); pDevice->setForceWhitelistedRegs(true, &forceRegs);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto usedBefore = commandStream.getUsed(); auto usedBefore = commandStream.getUsed();
flushTask(commandStreamReceiver); flushTask(commandStreamReceiver);
@@ -602,7 +602,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, shouldntAddAnyCommandsToCQCSIfEmpt
HWTEST_F(CommandStreamReceiverFlushTaskTests, blockingflushTaskAddsPCToClient) { HWTEST_F(CommandStreamReceiverFlushTaskTests, blockingflushTaskAddsPCToClient) {
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto blocking = true; auto blocking = true;
flushTask(commandStreamReceiver, blocking); flushTask(commandStreamReceiver, blocking);
@@ -787,7 +787,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithBothCSCallsChainsWith
typedef Test<DeviceFixture> CommandStreamReceiverCQFlushTaskTests; typedef Test<DeviceFixture> CommandStreamReceiverCQFlushTaskTests;
HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSizeCSRTraffic) { HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSizeCSRTraffic) {
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0); CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = commandQueue.getCommandStreamReceiver();
// NOTE: This test attempts to reserve the maximum amount // NOTE: This test attempts to reserve the maximum amount
// of memory such that if a client gets everything he wants // of memory such that if a client gets everything he wants
@@ -892,7 +892,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit
CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0); CommandQueueHw<FamilyType> commandQueue(nullptr, pDevice, 0);
configureCSRtoNonDirtyState<FamilyType>(); configureCSRtoNonDirtyState<FamilyType>();
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver(); auto &commandStreamReceiver = commandQueue.getCommandStreamReceiver();
size_t pipeControlCount = static_cast<CommandStreamReceiverHw<FamilyType> &>(commandStreamReceiver).getRequiredPipeControlSize() / sizeof(PIPE_CONTROL); size_t pipeControlCount = static_cast<CommandStreamReceiverHw<FamilyType> &>(commandStreamReceiver).getRequiredPipeControlSize() / sizeof(PIPE_CONTROL);

View File

@@ -502,7 +502,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeWhenFlushTask
DispatchFlags dispatchFlags; DispatchFlags dispatchFlags;
dispatchFlags.guardCommandBufferWithPipeControl = true; dispatchFlags.guardCommandBufferWithPipeControl = true;
dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo()); dispatchFlags.preemptionMode = PreemptionHelper::getDefaultPreemptionMode(pDevice->getHardwareInfo());
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = commandQueue.getCommandStreamReceiver();
csr.flushTask(commandStream, csr.flushTask(commandStream,
0, 0,

View File

@@ -352,8 +352,8 @@ TEST(CommandStreamReceiverSimpleTest, givenCSRWhenWaitBeforeMakingNonResidentWhe
TEST(CommandStreamReceiverMultiContextTests, givenMultipleCsrsWhenSameResourcesAreUsedThenResidencyIsProperlyHandled) { TEST(CommandStreamReceiverMultiContextTests, givenMultipleCsrsWhenSameResourcesAreUsedThenResidencyIsProperlyHandled) {
auto executionEnvironment = new ExecutionEnvironment; auto executionEnvironment = new ExecutionEnvironment;
std::unique_ptr<Device> device0(Device::create<Device>(nullptr, executionEnvironment, 0u)); std::unique_ptr<MockDevice> device0(Device::create<MockDevice>(nullptr, executionEnvironment, 0u));
std::unique_ptr<Device> device1(Device::create<Device>(nullptr, executionEnvironment, 1u)); std::unique_ptr<MockDevice> device1(Device::create<MockDevice>(nullptr, executionEnvironment, 1u));
auto &commandStreamReceiver0 = device0->getCommandStreamReceiver(); auto &commandStreamReceiver0 = device0->getCommandStreamReceiver();
auto &commandStreamReceiver1 = device1->getCommandStreamReceiver(); auto &commandStreamReceiver1 = device1->getCommandStreamReceiver();
@@ -388,13 +388,13 @@ struct CreateAllocationForHostSurfaceTest : public ::testing::Test {
executionEnvironment = new ExecutionEnvironment; executionEnvironment = new ExecutionEnvironment;
gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManager>(*executionEnvironment); gmockMemoryManager = new ::testing::NiceMock<GMockMemoryManager>(*executionEnvironment);
executionEnvironment->memoryManager.reset(gmockMemoryManager); executionEnvironment->memoryManager.reset(gmockMemoryManager);
device.reset(Device::create<Device>(&hwInfo, executionEnvironment, 0u)); device.reset(MockDevice::create<MockDevice>(&hwInfo, executionEnvironment, 0u));
commandStreamReceiver = &device->getCommandStreamReceiver(); commandStreamReceiver = &device->getCommandStreamReceiver();
} }
HardwareInfo hwInfo = *platformDevices[0]; HardwareInfo hwInfo = *platformDevices[0];
ExecutionEnvironment *executionEnvironment = nullptr; ExecutionEnvironment *executionEnvironment = nullptr;
GMockMemoryManager *gmockMemoryManager = nullptr; GMockMemoryManager *gmockMemoryManager = nullptr;
std::unique_ptr<Device> device; std::unique_ptr<MockDevice> device;
CommandStreamReceiver *commandStreamReceiver = nullptr; CommandStreamReceiver *commandStreamReceiver = nullptr;
}; };

View File

@@ -187,8 +187,8 @@ TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperate
TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperateCommandStreamReceiver) { TEST(DeviceCreation, givenMultiDeviceWhenTheyAreCreatedThenEachDeviceHasSeperateCommandStreamReceiver) {
ExecutionEnvironment executionEnvironment; ExecutionEnvironment executionEnvironment;
executionEnvironment.incRefInternal(); executionEnvironment.incRefInternal();
auto device = std::unique_ptr<Device>(Device::create<Device>(nullptr, &executionEnvironment, 0u)); auto device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr, &executionEnvironment, 0u));
auto device2 = std::unique_ptr<Device>(Device::create<Device>(nullptr, &executionEnvironment, 1u)); auto device2 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr, &executionEnvironment, 1u));
EXPECT_EQ(2u, executionEnvironment.commandStreamReceivers.size()); EXPECT_EQ(2u, executionEnvironment.commandStreamReceivers.size());
EXPECT_EQ(1u, executionEnvironment.commandStreamReceivers[0].size()); EXPECT_EQ(1u, executionEnvironment.commandStreamReceivers[0].size());

View File

@@ -412,7 +412,7 @@ TEST_F(UpdateEventTest, givenEventContainingCommandQueueWhenItsStatusIsUpdatedTo
size_t size = 4096; size_t size = 4096;
auto temporary = memoryManager->allocateGraphicsMemory(size, ptr); auto temporary = memoryManager->allocateGraphicsMemory(size, ptr);
temporary->updateTaskCount(3, 0); temporary->updateTaskCount(3, 0);
device->getCommandStreamReceiver().getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(temporary), TEMPORARY_ALLOCATION); commandQueue->getCommandStreamReceiver().getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(temporary), TEMPORARY_ALLOCATION);
Event event(commandQueue.get(), CL_COMMAND_NDRANGE_KERNEL, 3, 3); Event event(commandQueue.get(), CL_COMMAND_NDRANGE_KERNEL, 3, 3);
EXPECT_EQ(1u, hostPtrManager->getFragmentCount()); EXPECT_EQ(1u, hostPtrManager->getFragmentCount());
@@ -465,12 +465,12 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
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(ioh), UniqueIH(ssh), UniqueIH(ioh), UniqueIH(ssh),
*cmdQ.getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *cmdQ.getCommandStreamReceiver().getInternalAllocationStorage());
MockKernelWithInternals mockKernelWithInternals(*pDevice); MockKernelWithInternals mockKernelWithInternals(*pDevice);
auto pKernel = mockKernelWithInternals.mockKernel; auto pKernel = mockKernelWithInternals.mockKernel;
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = cmdQ.getCommandStreamReceiver();
std::vector<Surface *> v; std::vector<Surface *> v;
SurfaceMock *surface = new SurfaceMock; SurfaceMock *surface = new SurfaceMock;
surface->graphicsAllocation = new MockGraphicsAllocation((void *)0x1234, 100u); surface->graphicsAllocation = new MockGraphicsAllocation((void *)0x1234, 100u);
@@ -504,12 +504,12 @@ TEST_F(InternalsEventTest, processBlockedCommandsAbortKernelOperation) {
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(ioh), UniqueIH(ssh), UniqueIH(ioh), UniqueIH(ssh),
*cmdQ.getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *cmdQ.getCommandStreamReceiver().getInternalAllocationStorage());
MockKernelWithInternals mockKernelWithInternals(*pDevice); MockKernelWithInternals mockKernelWithInternals(*pDevice);
auto pKernel = mockKernelWithInternals.mockKernel; auto pKernel = mockKernelWithInternals.mockKernel;
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = cmdQ.getCommandStreamReceiver();
std::vector<Surface *> v; std::vector<Surface *> v;
NullSurface *surface = new NullSurface; NullSurface *surface = new NullSurface;
v.push_back(surface); v.push_back(surface);
@@ -539,7 +539,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
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(ioh), UniqueIH(ssh), UniqueIH(ioh), UniqueIH(ssh),
*cmdQ.getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *cmdQ.getCommandStreamReceiver().getInternalAllocationStorage());
SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface(); SPatchAllocateStatelessPrintfSurface *pPrintfSurface = new SPatchAllocateStatelessPrintfSurface();
pPrintfSurface->DataParamOffset = 0; pPrintfSurface->DataParamOffset = 0;
@@ -588,7 +588,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsMapOperation) {
MockEvent<Event> event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); MockEvent<Event> event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, 0); CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, 0);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto buffer = new MockBuffer; auto buffer = new MockBuffer;
MemObjSizeArray size = {{1, 1, 1}}; MemObjSizeArray size = {{1, 1, 1}};
@@ -610,7 +610,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsMapOperationNonZeroCopyBuffer)
MockEvent<Event> event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0); MockEvent<Event> event(nullptr, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, 0); CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, 0);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto buffer = new UnalignedBuffer; auto buffer = new UnalignedBuffer;
MemObjSizeArray size = {{1, 1, 1}}; MemObjSizeArray size = {{1, 1, 1}};
@@ -697,7 +697,7 @@ TEST_F(InternalsEventTest, GIVENProfilingWHENMapOperationTHENTimesSet) {
MockEvent<Event> *event = new MockEvent<Event>(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0); MockEvent<Event> *event = new MockEvent<Event>(pCmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
UnalignedBuffer buffer; UnalignedBuffer buffer;
MemObjSizeArray size = {{1, 1, 1}}; MemObjSizeArray size = {{1, 1, 1}};
@@ -723,7 +723,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsUnMapOperation) {
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto buffer = new UnalignedBuffer; auto buffer = new UnalignedBuffer;
MemObjSizeArray size = {{1, 1, 1}}; MemObjSizeArray size = {{1, 1, 1}};
@@ -746,7 +746,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsUnMapOperationNonZeroCopyBuffer
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0}; const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props); CommandQueue *pCmdQ = new CommandQueue(mockContext, pDevice, props);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto buffer = new UnalignedBuffer; auto buffer = new UnalignedBuffer;
MemObjSizeArray size = {{1, 1, 1}}; MemObjSizeArray size = {{1, 1, 1}};
@@ -770,7 +770,7 @@ HWTEST_F(InternalsEventTest, givenCpuProfilingPathWhenEnqueuedMarkerThenDontUseT
MockEvent<Event> *event = new MockEvent<Event>(pCmdQ, CL_COMMAND_MARKER, 0, 0); MockEvent<Event> *event = new MockEvent<Event>(pCmdQ, CL_COMMAND_MARKER, 0, 0);
event->setCPUProfilingPath(true); event->setCPUProfilingPath(true);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
event->setCommand(std::unique_ptr<Command>(new CommandMarker(*pCmdQ, csr, CL_COMMAND_MARKER, 4096u))); event->setCommand(std::unique_ptr<Command>(new CommandMarker(*pCmdQ, csr, CL_COMMAND_MARKER, 4096u)));
@@ -816,7 +816,7 @@ HWTEST_F(InternalsEventWithPerfCountersTest, givenCpuProfilingPerfCountersPathWh
MockEvent<Event> *event = new MockEvent<Event>(pCmdQ, CL_COMMAND_MARKER, 0, 0); MockEvent<Event> *event = new MockEvent<Event>(pCmdQ, CL_COMMAND_MARKER, 0, 0);
event->setCPUProfilingPath(true); event->setCPUProfilingPath(true);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
event->setCommand(std::unique_ptr<Command>(new CommandMarker(*pCmdQ, csr, CL_COMMAND_MARKER, 4096u))); event->setCommand(std::unique_ptr<Command>(new CommandMarker(*pCmdQ, csr, CL_COMMAND_MARKER, 4096u)));
@@ -844,7 +844,7 @@ HWTEST_F(InternalsEventWithPerfCountersTest, givenCpuProfilingPerfCountersPathWh
ASSERT_NE(nullptr, perfCounter); ASSERT_NE(nullptr, perfCounter);
HwTimeStamps *timeStamps = event->getHwTimeStampNode()->tag; HwTimeStamps *timeStamps = event->getHwTimeStampNode()->tag;
ASSERT_NE(nullptr, timeStamps); ASSERT_NE(nullptr, timeStamps);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
event->setCommand(std::unique_ptr<Command>(new CommandMarker(*pCmdQ, csr, CL_COMMAND_MARKER, 4096u))); event->setCommand(std::unique_ptr<Command>(new CommandMarker(*pCmdQ, csr, CL_COMMAND_MARKER, 4096u)));
@@ -938,7 +938,7 @@ HWTEST_F(InternalsEventTest, GivenBufferWithoutZeroCopyOnCommandMapOrUnmapFlushe
EXPECT_EQ(1, buffer.dataTransferedStamp); EXPECT_EQ(1, buffer.dataTransferedStamp);
EXPECT_EQ(nullptr, commandUnMap->getCommandStream()); EXPECT_EQ(nullptr, commandUnMap->getCommandStream());
pDevice->getCommandStreamReceiver().setTagAllocation(nullptr); pCmdQ->getCommandStreamReceiver().setTagAllocation(nullptr);
delete pCmdQ; delete pCmdQ;
} }
@@ -1209,7 +1209,7 @@ TEST_F(EventTest, GivenCompletedEventWhenQueryingExecutionStatusAfterFlushThenCs
cl_int ret; cl_int ret;
*pDevice->getTagAddress() = 3; *pDevice->getTagAddress() = 3;
Event ev(this->pCmdQ, CL_COMMAND_COPY_BUFFER, 3, 3); Event ev(this->pCmdQ, CL_COMMAND_COPY_BUFFER, 3, 3);
auto &csr = this->pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = this->pCmdQ->getCommandStreamReceiver();
auto previousTaskLevel = csr.peekTaskLevel(); auto previousTaskLevel = csr.peekTaskLevel();
EXPECT_GT(3u, previousTaskLevel); EXPECT_GT(3u, previousTaskLevel);
ret = clFlush(this->pCmdQ); ret = clFlush(this->pCmdQ);
@@ -1456,7 +1456,7 @@ HWTEST_F(InternalsEventTest, givenAbortedCommandWhenSubmitCalledThenDontUpdateFl
pCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 4096u, ssh); pCmdQ->allocateHeapMemory(IndirectHeap::SURFACE_STATE, 4096u, ssh);
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(ioh), UniqueIH(ssh), *pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); UniqueIH(ioh), UniqueIH(ssh), *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
PreemptionMode preemptionMode = pDevice->getPreemptionMode(); PreemptionMode preemptionMode = pDevice->getPreemptionMode();
std::vector<Surface *> v; std::vector<Surface *> v;
auto cmd = new CommandComputeKernel(*pCmdQ, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false, false, false, nullptr, preemptionMode, pKernel, 1); auto cmd = new CommandComputeKernel(*pCmdQ, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false, false, false, nullptr, preemptionMode, pKernel, 1);

View File

@@ -154,7 +154,7 @@ TEST_F(EventTests, blockedUserEventPassedToEnqueueNdRangeWithoutReturnEventIsNot
cl_event userEvent = (cl_event)&uEvent; cl_event userEvent = (cl_event)&uEvent;
cl_event *eventWaitList = &userEvent; cl_event *eventWaitList = &userEvent;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto taskCount = csr.peekTaskCount(); auto taskCount = csr.peekTaskCount();
//call NDR //call NDR
@@ -187,7 +187,7 @@ TEST_F(EventTests, blockedUserEventPassedToEnqueueNdRangeWithReturnEventIsNotSub
cl_event retEvent = nullptr; cl_event retEvent = nullptr;
cl_event *eventWaitList = &userEvent; cl_event *eventWaitList = &userEvent;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto taskCount = csr.peekTaskCount(); auto taskCount = csr.peekTaskCount();
//call NDR //call NDR
@@ -432,8 +432,7 @@ HWTEST_F(EventTests, userEventObtainsProperTaskLevelAfterSignaling) {
TEST_F(EventTests, normalEventsBasingOnUserEventHasProperTaskLevel) { TEST_F(EventTests, normalEventsBasingOnUserEventHasProperTaskLevel) {
UserEvent uEvent(context); UserEvent uEvent(context);
auto &device = this->pCmdQ->getDevice(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto &csr = device.getCommandStreamReceiver();
auto taskLevel = csr.peekTaskLevel(); auto taskLevel = csr.peekTaskLevel();
cl_event retEvent = nullptr; cl_event retEvent = nullptr;
@@ -504,7 +503,7 @@ TEST_F(EventTests, enqueueWithAbortedUserEventDoesntFlushToCSR) {
int sizeOfWaitList = sizeof(eventWaitList) / sizeof(cl_event); int sizeOfWaitList = sizeof(eventWaitList) / sizeof(cl_event);
cl_event retEvent = nullptr; cl_event retEvent = nullptr;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto taskCount = csr.peekTaskCount(); auto taskCount = csr.peekTaskCount();
//call NDR //call NDR
@@ -537,7 +536,7 @@ TEST_F(EventTests, childEventDestructorDoesntProcessBlockedCommandsWhenParentEve
int sizeOfWaitList = sizeof(eventWaitList) / sizeof(cl_event); int sizeOfWaitList = sizeof(eventWaitList) / sizeof(cl_event);
cl_event retEvent = nullptr; cl_event retEvent = nullptr;
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto taskCount = csr.peekTaskCount(); auto taskCount = csr.peekTaskCount();
//call NDR //call NDR
@@ -619,7 +618,7 @@ TEST_F(EventTests, waitForEventDependingOnAbortedUserEventReturnsFailureTwoInput
TEST_F(EventTests, finishReturnsSuccessAfterQueueIsAborted) { TEST_F(EventTests, finishReturnsSuccessAfterQueueIsAborted) {
UserEvent uEvent(context); UserEvent uEvent(context);
auto &csr = pDevice->getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto taskLevel = csr.peekTaskLevel(); auto taskLevel = csr.peekTaskLevel();
cl_event eventWaitList[] = {&uEvent}; cl_event eventWaitList[] = {&uEvent};
@@ -669,7 +668,7 @@ TEST_F(EventTests, userEventDependantCommandPacketContainsValidCommandStream) {
TEST_F(EventTests, unblockingEventSendsBlockedPackets) { TEST_F(EventTests, unblockingEventSendsBlockedPackets) {
UserEvent uEvent(context); UserEvent uEvent(context);
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
cl_event eventWaitList[] = {&uEvent}; cl_event eventWaitList[] = {&uEvent};
int sizeOfWaitList = sizeof(eventWaitList) / sizeof(cl_event); int sizeOfWaitList = sizeof(eventWaitList) / sizeof(cl_event);
@@ -891,7 +890,7 @@ TEST_F(EventTests, enqueueReadImageBlockedOnUserEvent) {
} }
TEST_F(EventTests, waitForEventsDestroysTemporaryAllocations) { TEST_F(EventTests, waitForEventsDestroysTemporaryAllocations) {
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
auto memoryManager = pCmdQ->getDevice().getMemoryManager(); auto memoryManager = pCmdQ->getDevice().getMemoryManager();
EXPECT_TRUE(csr.getTemporaryAllocations().peekIsEmpty()); EXPECT_TRUE(csr.getTemporaryAllocations().peekIsEmpty());
@@ -1058,7 +1057,7 @@ TEST_F(EventTests, givenUserEventWhenSetStatusIsDoneThenDeviceMutextisAcquired)
struct mockedEvent : public UserEvent { struct mockedEvent : public UserEvent {
using UserEvent::UserEvent; using UserEvent::UserEvent;
bool setStatus(cl_int status) override { bool setStatus(cl_int status) override {
auto commandStreamReceiverOwnership = this->getContext()->getDevice(0)->getCommandStreamReceiver().obtainUniqueOwnership(); auto commandStreamReceiverOwnership = ctx->getDevice(0)->getEngine(0).commandStreamReceiver->obtainUniqueOwnership();
mutexProperlyAcquired = commandStreamReceiverOwnership.owns_lock(); mutexProperlyAcquired = commandStreamReceiverOwnership.owns_lock();
return true; return true;
} }

View File

@@ -23,7 +23,7 @@ TEST_F(EventTests, eventCreatedFromUserEventsThatIsNotSignaledDoesntFlushToCSR)
//call NDR //call NDR
auto retVal = callOneWorkItemNDRKernel(eventWaitList, sizeOfWaitList, &retEvent); auto retVal = callOneWorkItemNDRKernel(eventWaitList, sizeOfWaitList, &retEvent);
auto &csr = pCmdQ->getDevice().getCommandStreamReceiver(); auto &csr = pCmdQ->getCommandStreamReceiver();
*csr.getTagAddress() = (unsigned int)-1; *csr.getTagAddress() = (unsigned int)-1;
auto taskLevelBeforeWaitForEvents = csr.peekTaskLevel(); auto taskLevelBeforeWaitForEvents = csr.peekTaskLevel();

View File

@@ -202,11 +202,11 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
TEST(ExecutionEnvironment, givenMultipleDevicesWhenTheyAreCreatedTheyAllReuseTheSameMemoryManagerAndCommandStreamReceiver) { TEST(ExecutionEnvironment, givenMultipleDevicesWhenTheyAreCreatedTheyAllReuseTheSameMemoryManagerAndCommandStreamReceiver) {
auto executionEnvironment = new ExecutionEnvironment; auto executionEnvironment = new ExecutionEnvironment;
std::unique_ptr<Device> device(Device::create<OCLRT::Device>(nullptr, executionEnvironment, 0u)); std::unique_ptr<MockDevice> device(Device::create<OCLRT::MockDevice>(nullptr, executionEnvironment, 0u));
auto &commandStreamReceiver = device->getCommandStreamReceiver(); auto &commandStreamReceiver = device->getCommandStreamReceiver();
auto memoryManager = device->getMemoryManager(); auto memoryManager = device->getMemoryManager();
std::unique_ptr<Device> device2(Device::create<OCLRT::Device>(nullptr, executionEnvironment, 1u)); std::unique_ptr<MockDevice> device2(Device::create<OCLRT::MockDevice>(nullptr, executionEnvironment, 1u));
EXPECT_NE(&commandStreamReceiver, &device2->getCommandStreamReceiver()); EXPECT_NE(&commandStreamReceiver, &device2->getCommandStreamReceiver());
EXPECT_EQ(memoryManager, device2->getMemoryManager()); EXPECT_EQ(memoryManager, device2->getMemoryManager());
} }

View File

@@ -100,7 +100,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenLockedEMcritcalSectionWhenParentK
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
@@ -159,7 +159,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
@@ -201,7 +201,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
@@ -240,7 +240,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenBlockedParentKernelWithProfilingW
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
@@ -283,7 +283,7 @@ HWTEST_F(ParentKernelCommandQueueFixture, givenParentKernelWhenCommandIsSubmitte
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel); size_t minSizeSSHForEM = KernelCommandsHelper<FamilyType>::template getSizeRequiredForExecutionModel<IndirectHeap::SURFACE_STATE>(*parentKernel);
@@ -337,7 +337,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenUsedCommandQue
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();
@@ -386,7 +386,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ParentKernelCommandQueueFixture, givenNotUsedSSHWhen
std::unique_ptr<IndirectHeap>(dsh), std::unique_ptr<IndirectHeap>(dsh),
std::unique_ptr<IndirectHeap>(ioh), std::unique_ptr<IndirectHeap>(ioh),
std::unique_ptr<IndirectHeap>(ssh), std::unique_ptr<IndirectHeap>(ssh),
*pCmdQ->getDevice().getCommandStreamReceiver().getInternalAllocationStorage()); *pCmdQ->getCommandStreamReceiver().getInternalAllocationStorage());
blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM; blockedCommandData->surfaceStateHeapSizeEM = minSizeSSHForEM;
PreemptionMode preemptionMode = device->getPreemptionMode(); PreemptionMode preemptionMode = device->getPreemptionMode();

View File

@@ -155,21 +155,21 @@ GEN9TEST_F(MediaKernelTest, givenGen9CsrWhenEnqueueNonVmeKernelAfterVmeKernelThe
} }
GEN9TEST_F(MediaKernelTest, givenGen9CsrWhenEnqueueVmeKernelThenVmeSubslicesConfigDoesntChangeToFalse) { GEN9TEST_F(MediaKernelTest, givenGen9CsrWhenEnqueueVmeKernelThenVmeSubslicesConfigDoesntChangeToFalse) {
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pDevice->getCommandStreamReceiver()); auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pCmdQ->getCommandStreamReceiver());
csr->lastVmeSubslicesConfig = true; csr->lastVmeSubslicesConfig = true;
enqueueVmeKernel<FamilyType>(); enqueueVmeKernel<FamilyType>();
EXPECT_TRUE(csr->lastVmeSubslicesConfig); EXPECT_TRUE(csr->lastVmeSubslicesConfig);
} }
GEN9TEST_F(MediaKernelTest, givenGen9CsrWhenEnqueueVmeKernelThenVmeSubslicesConfigDoesntChangeToTrue) { GEN9TEST_F(MediaKernelTest, givenGen9CsrWhenEnqueueVmeKernelThenVmeSubslicesConfigDoesntChangeToTrue) {
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pDevice->getCommandStreamReceiver()); auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pCmdQ->getCommandStreamReceiver());
csr->lastVmeSubslicesConfig = false; csr->lastVmeSubslicesConfig = false;
enqueueVmeKernel<FamilyType>(); enqueueVmeKernel<FamilyType>();
EXPECT_FALSE(csr->lastVmeSubslicesConfig); EXPECT_FALSE(csr->lastVmeSubslicesConfig);
} }
GEN9TEST_F(MediaKernelTest, gen9CmdSizeForMediaSampler) { GEN9TEST_F(MediaKernelTest, gen9CmdSizeForMediaSampler) {
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pDevice->getCommandStreamReceiver()); auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(&pCmdQ->getCommandStreamReceiver());
csr->lastVmeSubslicesConfig = false; csr->lastVmeSubslicesConfig = false;
EXPECT_EQ(0u, csr->getCmdSizeForMediaSampler(false)); EXPECT_EQ(0u, csr->getCmdSizeForMediaSampler(false));

View File

@@ -1483,7 +1483,7 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe
gtpinNotifyKernelSubmit(pKernel1, pCmdQueue); gtpinNotifyKernelSubmit(pKernel1, pCmdQueue);
EXPECT_EQ(nullptr, kernelExecQueue[0].gtpinResource); EXPECT_EQ(nullptr, kernelExecQueue[0].gtpinResource);
CommandStreamReceiver &csr = pCmdQueue->getDevice().getCommandStreamReceiver(); CommandStreamReceiver &csr = pCmdQueue->getCommandStreamReceiver();
gtpinNotifyMakeResident(pKernel1, &csr); gtpinNotifyMakeResident(pKernel1, &csr);
EXPECT_FALSE(kernelExecQueue[0].isResourceResident); EXPECT_FALSE(kernelExecQueue[0].isResourceResident);
@@ -1667,7 +1667,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKerne
cl_mem gtpinBuffer1 = kernelExecQueue[1].gtpinResource; cl_mem gtpinBuffer1 = kernelExecQueue[1].gtpinResource;
auto pBuffer1 = castToObject<Buffer>(gtpinBuffer1); auto pBuffer1 = castToObject<Buffer>(gtpinBuffer1);
GraphicsAllocation *pGfxAlloc1 = pBuffer1->getGraphicsAllocation(); GraphicsAllocation *pGfxAlloc1 = pBuffer1->getGraphicsAllocation();
CommandStreamReceiver &csr = pCmdQueue->getDevice().getCommandStreamReceiver(); CommandStreamReceiver &csr = pCmdQueue->getCommandStreamReceiver();
EXPECT_FALSE(pGfxAlloc0->isResident(0u)); EXPECT_FALSE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u)); EXPECT_FALSE(pGfxAlloc1->isResident(0u));
gtpinNotifyMakeResident(pKernel, &csr); gtpinNotifyMakeResident(pKernel, &csr);
@@ -1837,7 +1837,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveral
cl_mem gtpinBuffer1 = kernelExecQueue[1].gtpinResource; cl_mem gtpinBuffer1 = kernelExecQueue[1].gtpinResource;
auto pBuffer1 = castToObject<Buffer>(gtpinBuffer1); auto pBuffer1 = castToObject<Buffer>(gtpinBuffer1);
GraphicsAllocation *pGfxAlloc1 = pBuffer1->getGraphicsAllocation(); GraphicsAllocation *pGfxAlloc1 = pBuffer1->getGraphicsAllocation();
CommandStreamReceiver &csr = pCmdQueue->getDevice().getCommandStreamReceiver(); CommandStreamReceiver &csr = pCmdQueue->getCommandStreamReceiver();
// Make resident resource of first submitted kernel // Make resident resource of first submitted kernel
EXPECT_FALSE(pGfxAlloc0->isResident(0u)); EXPECT_FALSE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u)); EXPECT_FALSE(pGfxAlloc1->isResident(0u));

View File

@@ -75,8 +75,7 @@ struct HardwareParse {
template <typename FamilyType> template <typename FamilyType>
void parseCommands(OCLRT::CommandQueue &commandQueue) { void parseCommands(OCLRT::CommandQueue &commandQueue) {
auto &device = commandQueue.getDevice(); auto &commandStreamReceiver = commandQueue.getCommandStreamReceiver();
auto &commandStreamReceiver = device.getCommandStreamReceiver();
auto &commandStreamCSR = commandStreamReceiver.getCS(); auto &commandStreamCSR = commandStreamReceiver.getCS();
parseCommands<FamilyType>(commandStreamCSR, startCSRCS); parseCommands<FamilyType>(commandStreamCSR, startCSRCS);

View File

@@ -27,7 +27,7 @@ struct KmdNotifyTests : public ::testing::Test {
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo)); device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
cmdQ.reset(new MockCommandQueue(&context, device.get(), nullptr)); cmdQ.reset(new MockCommandQueue(&context, device.get(), nullptr));
*device->getTagAddress() = taskCountToWait; *device->getTagAddress() = taskCountToWait;
device->getCommandStreamReceiver().waitForFlushStamp(flushStampToWait, *device->getOsContext()); cmdQ->getCommandStreamReceiver().waitForFlushStamp(flushStampToWait, *device->getOsContext());
overrideKmdNotifyParams(true, 2, true, 1, false, 0); overrideKmdNotifyParams(true, 2, true, 1, false, 0);
} }
@@ -167,7 +167,7 @@ HWTEST_F(KmdNotifyTests, givenDisabledQuickSleepWhenWaitUntilCompleteWithQuickSl
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenPollForCompletionCalledThenTimeout) { HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenPollForCompletionCalledThenTimeout) {
*device->getTagAddress() = taskCountToWait - 1; *device->getTagAddress() = taskCountToWait - 1;
auto success = device->getCommandStreamReceiver().waitForCompletionWithTimeout(true, 1, taskCountToWait); auto success = device->getUltCommandStreamReceiver<FamilyType>().waitForCompletionWithTimeout(true, 1, taskCountToWait);
EXPECT_FALSE(success); EXPECT_FALSE(success);
} }

View File

@@ -68,12 +68,14 @@ class MockDevice : public Device {
template <typename T> template <typename T>
UltCommandStreamReceiver<T> &getUltCommandStreamReceiver() { UltCommandStreamReceiver<T> &getUltCommandStreamReceiver() {
return reinterpret_cast<UltCommandStreamReceiver<T> &>(getCommandStreamReceiver()); return reinterpret_cast<UltCommandStreamReceiver<T> &>(*engines[0].commandStreamReceiver);
} }
CommandStreamReceiver &getCommandStreamReceiver() const { return *engines[0].commandStreamReceiver; }
void resetCommandStreamReceiver(CommandStreamReceiver *newCsr); void resetCommandStreamReceiver(CommandStreamReceiver *newCsr);
GraphicsAllocation *getTagAllocation() { return this->getCommandStreamReceiver().getTagAllocation(); } GraphicsAllocation *getTagAllocation() { return this->engines[0].commandStreamReceiver->getTagAllocation(); }
void setSourceLevelDebuggerActive(bool active) { void setSourceLevelDebuggerActive(bool active) {
this->deviceInfo.sourceLevelDebuggerActive = active; this->deviceInfo.sourceLevelDebuggerActive = active;

View File

@@ -175,7 +175,7 @@ TEST_F(ProgramDataTest, givenConstantAllocationThatIsInUseByGpuWhenProgramIsBein
buildAndDecodeProgramPatchList(); buildAndDecodeProgramPatchList();
auto &csr = pPlatform->getDevice(0)->getCommandStreamReceiver(); auto &csr = *pPlatform->getDevice(0)->getEngine(0).commandStreamReceiver;
auto tagAddress = csr.getTagAddress(); auto tagAddress = csr.getTagAddress();
auto constantSurface = pProgram->getConstantSurface(); auto constantSurface = pProgram->getConstantSurface();
constantSurface->updateTaskCount(*tagAddress + 1, 0); constantSurface->updateTaskCount(*tagAddress + 1, 0);
@@ -192,7 +192,7 @@ TEST_F(ProgramDataTest, givenGlobalAllocationThatIsInUseByGpuWhenProgramIsBeingD
buildAndDecodeProgramPatchList(); buildAndDecodeProgramPatchList();
auto &csr = pPlatform->getDevice(0)->getCommandStreamReceiver(); auto &csr = *pPlatform->getDevice(0)->getEngine(0).commandStreamReceiver;
auto tagAddress = csr.getTagAddress(); auto tagAddress = csr.getTagAddress();
auto globalSurface = pProgram->getGlobalSurface(); auto globalSurface = pProgram->getGlobalSurface();
globalSurface->updateTaskCount(*tagAddress + 1, 0); globalSurface->updateTaskCount(*tagAddress + 1, 0);

View File

@@ -166,7 +166,7 @@ TEST_F(GlArbSyncEventTest, whenSetBaseEventIsCalledThenProperMembersOfParentEven
EXPECT_TRUE(getBaseEvent()->peekHasChildEvents()); EXPECT_TRUE(getBaseEvent()->peekHasChildEvents());
EXPECT_EQ(getBaseEvent(), syncEv->baseEvent); EXPECT_EQ(getBaseEvent(), syncEv->baseEvent);
EXPECT_EQ(getBaseEvent()->getCommandQueue(), syncEv->getCommandQueue()); EXPECT_EQ(getBaseEvent()->getCommandQueue(), syncEv->getCommandQueue());
EXPECT_EQ(syncEv->getCommandQueue()->getDevice().getCommandStreamReceiver().getOSInterface(), syncEv->osInterface); EXPECT_EQ(syncEv->getCommandQueue()->getCommandStreamReceiver().getOSInterface(), syncEv->osInterface);
EXPECT_EQ(3, getBaseEvent()->getRefInternalCount()); EXPECT_EQ(3, getBaseEvent()->getRefInternalCount());
EXPECT_EQ(3, getBaseEvent()->getCommandQueue()->getRefInternalCount()); EXPECT_EQ(3, getBaseEvent()->getCommandQueue()->getRefInternalCount());

View File

@@ -434,7 +434,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo); ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
hwInfo->capabilityTable.instrumentationEnabled = true; hwInfo->capabilityTable.instrumentationEnabled = true;
unique_ptr<Device> device(Device::create<Device>(&hwInfo[0], executionEnvironment, 0)); unique_ptr<MockDevice> device(Device::create<MockDevice>(&hwInfo[0], executionEnvironment, 0));
ASSERT_NE(nullptr, device->getCommandStreamReceiver().getOSInterface()); ASSERT_NE(nullptr, device->getCommandStreamReceiver().getOSInterface());