Register csr's client at first submit
Related-To: NEO-7422, NEO-7458 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
parent
2b06aa1129
commit
275bed2a31
|
@ -203,6 +203,10 @@ inline ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommand
|
|||
auto csr = static_cast<CommandQueueImp *>(cmdQ)->getCsr();
|
||||
auto lockCSR = csr->obtainUniqueOwnership();
|
||||
|
||||
if (cmdQ->getClientId() == std::numeric_limits<uint32_t>::max()) {
|
||||
cmdQ->setClientId(csr->registerClient());
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lockForIndirect;
|
||||
if (this->hasIndirectAllocationsAllowed()) {
|
||||
cmdQ->handleIndirectAllocationResidency(this->getUnifiedMemoryControls(), lockForIndirect, performMigration);
|
||||
|
|
|
@ -50,7 +50,9 @@ CommandQueueImp::CommandQueueImp(Device *device, NEO::CommandStreamReceiver *csr
|
|||
}
|
||||
|
||||
ze_result_t CommandQueueImp::destroy() {
|
||||
this->csr->unregisterClient();
|
||||
if (this->clientId != std::numeric_limits<uint32_t>::max()) {
|
||||
this->csr->unregisterClient();
|
||||
}
|
||||
|
||||
if (commandStream.getCpuBase() != nullptr) {
|
||||
commandStream.replaceGraphicsAllocation(nullptr);
|
||||
|
@ -215,7 +217,6 @@ CommandQueue *CommandQueue::create(uint32_t productFamily, Device *device, NEO::
|
|||
}
|
||||
csr->initializeResources();
|
||||
csr->initDirectSubmission();
|
||||
csr->registerClient();
|
||||
return commandQueue;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,13 @@ struct CommandQueue : _ze_command_queue_handle_t {
|
|||
|
||||
bool peekIsCopyOnlyCommandQueue() const { return this->isCopyOnlyCommandQueue; }
|
||||
|
||||
uint32_t getClientId() { return this->clientId; }
|
||||
void setClientId(uint32_t value) { this->clientId = value; }
|
||||
|
||||
protected:
|
||||
bool frontEndTrackingEnabled() const;
|
||||
|
||||
uint32_t clientId = std::numeric_limits<uint32_t>::max();
|
||||
uint32_t partitionCount = 1;
|
||||
uint32_t activeSubDevices = 1;
|
||||
bool preemptionCmdSyncProgramming = true;
|
||||
|
|
|
@ -67,6 +67,10 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
|||
|
||||
auto lockCSR = this->csr->obtainUniqueOwnership();
|
||||
|
||||
if (this->clientId == std::numeric_limits<uint32_t>::max()) {
|
||||
this->clientId = this->csr->registerClient();
|
||||
}
|
||||
|
||||
auto ctx = CommandListExecutionContext{phCommandLists,
|
||||
numCommandLists,
|
||||
csr->getPreemptionMode(),
|
||||
|
|
|
@ -1136,6 +1136,7 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh
|
|||
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
|
||||
ultCsr->directSubmission.reset(directSubmission);
|
||||
ultCsr->registerClient();
|
||||
ultCsr->registerClient();
|
||||
|
||||
auto verifyFlags = [&ultCsr](ze_result_t result, bool dispatchFlag, bool bbFlag) {
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
|
|
@ -730,7 +730,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests,
|
|||
queueDesc.ordinal = 0;
|
||||
queueDesc.index = 0;
|
||||
device->createCommandListImmediate(&queueDesc, &cmdListHandle);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(CommandList::fromHandle(cmdListHandle)->cmdQImmediate)->getCsr()->getNumClients(), 1u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(CommandList::fromHandle(cmdListHandle)->cmdQImmediate)->getCsr()->getNumClients(), 0u);
|
||||
|
||||
EXPECT_FALSE(static_cast<L0::CommandListCoreFamilyImmediate<gfxCoreFamily> *>(CommandList::fromHandle(cmdListHandle))->waitForEventsFromHost());
|
||||
|
||||
|
|
|
@ -583,6 +583,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC
|
|||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(commandList0->csr);
|
||||
ultCsr->recordFlusheBatchBuffer = true;
|
||||
ultCsr->registerClient();
|
||||
ultCsr->registerClient();
|
||||
|
||||
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
|
||||
ultCsr->directSubmission.reset(directSubmission);
|
||||
|
@ -639,12 +640,13 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenRelaxedOrderingNotAllowedWhenDispatchS
|
|||
context->allocHostMem(&hostDesc, size, alignment, &dstPtr);
|
||||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(commandList0->csr);
|
||||
ultCsr->recordFlusheBatchBuffer = true;
|
||||
EXPECT_EQ(1u, ultCsr->getNumClients());
|
||||
EXPECT_EQ(0u, ultCsr->getNumClients());
|
||||
|
||||
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
|
||||
ultCsr->directSubmission.reset(directSubmission);
|
||||
|
||||
auto result = commandList0->appendMemoryCopy(dstPtr, srcPtr, size, nullptr, 0, nullptr, false);
|
||||
EXPECT_EQ(1u, ultCsr->getNumClients());
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u);
|
||||
EXPECT_EQ(static_cast<CommandQueueImp *>(static_cast<DeviceImp *>(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u);
|
||||
|
|
|
@ -375,8 +375,8 @@ class CommandStreamReceiver {
|
|||
uint32_t getNumClients() {
|
||||
return this->numClients.load();
|
||||
}
|
||||
void registerClient() {
|
||||
this->numClients++;
|
||||
uint32_t registerClient() {
|
||||
return this->numClients.fetch_add(1u);
|
||||
}
|
||||
void unregisterClient() {
|
||||
this->numClients--;
|
||||
|
|
Loading…
Reference in New Issue