Add AssignBCSAtEnqueue debug flag

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-03-01 11:24:30 +00:00
committed by Compute-Runtime-Automation
parent 05bf7a4315
commit 3c30e1b02b
5 changed files with 46 additions and 3 deletions

View File

@@ -179,8 +179,17 @@ CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelec
case TransferDirection::HostToLocal:
case TransferDirection::LocalToHost: {
preferBcs = true;
preferredBcsEngineType = EngineHelpers::getBcsEngineType(device->getHardwareInfo(), device->getDeviceBitfield(),
device->getSelectorCopyEngine(), false);
auto preferredBCSType = true;
if (DebugManager.flags.AssignBCSAtEnqueue.get() != -1) {
preferredBCSType = DebugManager.flags.AssignBCSAtEnqueue.get();
}
if (preferredBCSType) {
preferredBcsEngineType = EngineHelpers::getBcsEngineType(device->getHardwareInfo(), device->getDeviceBitfield(),
device->getSelectorCopyEngine(), false);
}
break;
}
default:
@@ -189,7 +198,16 @@ CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelec
CommandStreamReceiver *selectedCsr = nullptr;
if (preferBcs) {
selectedCsr = getBcsCommandStreamReceiver(preferredBcsEngineType);
auto assignBCS = true;
if (DebugManager.flags.AssignBCSAtEnqueue.get() != -1) {
assignBCS = DebugManager.flags.AssignBCSAtEnqueue.get();
}
if (assignBCS) {
selectedCsr = getBcsCommandStreamReceiver(preferredBcsEngineType);
}
if (selectedCsr == nullptr && !bcsEngineTypes.empty()) {
selectedCsr = getBcsCommandStreamReceiver(bcsEngineTypes[0]);
}

View File

@@ -1069,6 +1069,7 @@ template <typename GfxFamily>
template <uint32_t cmdType>
void CommandQueueHw<GfxFamily>::enqueueBlit(const MultiDispatchInfo &multiDispatchInfo, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event, bool blocking, CommandStreamReceiver &bcsCsr) {
auto commandStreamReceiverOwnership = getGpgpuCommandStreamReceiver().obtainUniqueOwnership();
auto bcsCommandStreamReceiverOwnership = bcsCsr.obtainUniqueOwnership();
EventsRequest eventsRequest(numEventsInWaitList, eventWaitList, event);
EventBuilder eventBuilder;
@@ -1154,6 +1155,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlit(const MultiDispatchInfo &multiDispat
timestampPacketDependencies.moveNodesToNewContainer(*deferredTimestampPackets);
queueOwnership.unlock();
bcsCommandStreamReceiverOwnership.unlock();
commandStreamReceiverOwnership.unlock();
if (blocking) {

View File

@@ -1780,6 +1780,27 @@ TEST_F(CsrSelectionCommandQueueWithBlitterTests, givenInvalidTransferDirectionWh
EXPECT_ANY_THROW(queue->selectCsrForBuiltinOperation(args));
}
TEST_F(CsrSelectionCommandQueueWithBlitterTests, givenBlitterAndAssignBCSAtEnqueueSetToFalseWhenSelectCsrThenDefaultBcsReturned) {
DebugManagerStateRestore restore{};
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
DebugManager.flags.AssignBCSAtEnqueue.set(0);
BuiltinOpParams builtinOpParams{};
MockGraphicsAllocation srcGraphicsAllocation{};
MockGraphicsAllocation dstGraphicsAllocation{};
MockBuffer srcMemObj{srcGraphicsAllocation};
MockBuffer dstMemObj{dstGraphicsAllocation};
builtinOpParams.srcMemObj = &srcMemObj;
builtinOpParams.dstMemObj = &dstMemObj;
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
args.direction = TransferDirection::LocalToHost;
auto &csr = queue->selectCsrForBuiltinOperation(args);
EXPECT_EQ(&csr, queue->getBcsCommandStreamReceiver(queue->bcsEngineTypes[0]));
}
TEST_F(CsrSelectionCommandQueueWithQueueFamiliesBlitterTests, givenBlitterSelectedWithQueueFamiliesWhenSelectingBlitterThenSelectBlitter) {
DebugManagerStateRestore restore{};

View File

@@ -376,6 +376,7 @@ ForceExtendedBufferSize = -1
ForceExtendedUSMBufferSize = -1
MakeIndirectAllocationsResidentAsPack = -1
MakeEachAllocationResident = -1
AssignBCSAtEnqueue = -1
ReuseKernelBinaries = -1
EnableChipsetUniqueUUID = -1
ForceSimdMessageSizeInWalker = -1