Revert "fix: track registered CSR clients"

This reverts commit 53f635e392.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2023-09-24 09:39:38 +02:00
committed by Compute-Runtime-Automation
parent d515ba965c
commit ade538ce54
18 changed files with 77 additions and 127 deletions

View File

@@ -332,7 +332,9 @@ inline ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommand
svmAllocMgr->prefetchSVMAllocs(*this->device->getNEODevice(), *csr);
}
cmdQ->registerCsrClient();
if (cmdQ->getClientId() == CommandQueue::clientNotRegistered) {
cmdQ->setClientId(csr->registerClient());
}
std::unique_lock<std::mutex> lockForIndirect;
if (this->hasIndirectAllocationsAllowed()) {

View File

@@ -253,11 +253,10 @@ CommandQueue *CommandQueue::create(uint32_t productFamily, Device *device, NEO::
}
void CommandQueueImp::unregisterCsrClient() {
this->csr->unregisterClient(this);
}
void CommandQueueImp::registerCsrClient() {
this->csr->registerClient(this);
if (getClientId() != CommandQueue::clientNotRegistered) {
this->csr->unregisterClient();
setClientId(CommandQueue::clientNotRegistered);
}
}
ze_result_t CommandQueueImp::CommandBufferManager::initialize(Device *device, size_t sizeRequested) {

View File

@@ -62,15 +62,19 @@ struct CommandQueue : _ze_command_queue_handle_t {
bool peekIsCopyOnlyCommandQueue() const { return this->isCopyOnlyCommandQueue; }
uint32_t getClientId() const { return this->clientId; }
void setClientId(uint32_t value) { this->clientId = value; }
virtual void unregisterCsrClient() = 0;
virtual void registerCsrClient() = 0;
TaskCountType getTaskCount() const { return taskCount; }
void setTaskCount(TaskCountType newTaskCount) { taskCount = newTaskCount; }
static constexpr uint32_t clientNotRegistered = std::numeric_limits<uint32_t>::max();
protected:
bool frontEndTrackingEnabled() const;
uint32_t clientId = clientNotRegistered;
uint32_t partitionCount = 1;
uint32_t activeSubDevices = 1;
std::atomic<TaskCountType> taskCount = 0;

View File

@@ -69,7 +69,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
svmAllocMgr->prefetchSVMAllocs(*device->getNEODevice(), *csr);
}
registerCsrClient();
if (this->clientId == CommandQueue::clientNotRegistered) {
this->clientId = this->csr->registerClient();
}
auto neoDevice = device->getNEODevice();
auto ctx = CommandListExecutionContext{phCommandLists,

View File

@@ -98,7 +98,6 @@ struct CommandQueueImp : public CommandQueue {
void printKernelsPrintfOutput(bool hangDetected);
void checkAssert();
void unregisterCsrClient() override;
void registerCsrClient() override;
protected:
MOCKABLE_VIRTUAL NEO::SubmissionStatus submitBatchBuffer(size_t offset, NEO::ResidencyContainer &residencyContainer, void *endingCmdPtr,

View File

@@ -402,10 +402,9 @@ void Event::setLatestUsedCmdQueue(CommandQueue *newCmdQ) {
}
void Event::unsetCmdQueue() {
for (auto &csr : csrs) {
csr->unregisterClient(latestUsedCmdQueue);
if (latestUsedCmdQueue) {
latestUsedCmdQueue->unregisterCsrClient();
}
latestUsedCmdQueue = nullptr;
}

View File

@@ -1186,6 +1186,7 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingDi
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->csr);
ultCsr->recordFlusheBatchBuffer = true;
ultCsr->unregisterClient();
EXPECT_FALSE(NEO::RelaxedOrderingHelper::isRelaxedOrderingDispatchAllowed(*ultCsr, 1));
@@ -1284,9 +1285,8 @@ HWTEST2_F(CommandListCreate, whenDispatchingThenPassNumCsrClients, IsAtLeastXeHp
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->csr);
ultCsr->recordFlusheBatchBuffer = true;
int client1, client2;
ultCsr->registerClient(&client1);
ultCsr->registerClient(&client2);
ultCsr->registerClient();
ultCsr->registerClient();
auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false);
@@ -1444,9 +1444,8 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);
int client1, client2;
ultCsr->registerClient(&client1);
ultCsr->registerClient(&client2);
ultCsr->registerClient();
ultCsr->registerClient();
auto verifyFlags = [&ultCsr, useImmediateFlushTask](ze_result_t result, bool dispatchFlag, bool bbFlag) {
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -1567,9 +1566,8 @@ HWTEST2_F(CommandListCreate, givenInOrderExecutionWhenDispatchingRelaxedOrdering
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);
int client1, client2;
ultCsr->registerClient(&client1);
ultCsr->registerClient(&client2);
ultCsr->registerClient();
ultCsr->registerClient();
commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, event, 0, nullptr, launchParams, false);
@@ -1616,9 +1614,8 @@ HWTEST2_F(CommandListCreate, givenInOrderExecutionWhenDispatchingBarrierThenAllo
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);
int client1, client2;
ultCsr->registerClient(&client1);
ultCsr->registerClient(&client2);
ultCsr->registerClient();
ultCsr->registerClient();
// Initialize NP state
commandList->appendBarrier(nullptr, 1, &event, false);
@@ -1676,9 +1673,8 @@ HWTEST2_F(CommandListCreate, givenInOrderExecutionWhenDispatchingRelaxedOrdering
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);
int client1, client2;
ultCsr->registerClient(&client1);
ultCsr->registerClient(&client2);
ultCsr->registerClient();
ultCsr->registerClient();
auto cmdStream = cmdList->getCmdContainer().getCommandStream();

View File

@@ -2944,8 +2944,7 @@ HWTEST2_F(ImmediateCommandListHostSynchronize, givenCsrClientCountWhenCallingSyn
auto cmdList = createCmdList<gfxCoreFamily>(csr);
cmdList->cmdQImmediate->registerCsrClient();
cmdList->cmdQImmediate->setClientId(csr->registerClient());
auto clientCount = csr->getNumClients();
EXPECT_EQ(cmdList->hostSynchronize(0), ZE_RESULT_SUCCESS);
@@ -2956,8 +2955,7 @@ HWTEST2_F(ImmediateCommandListHostSynchronize, givenCsrClientCountWhenCallingSyn
EXPECT_EQ(clientCount - 1, csr->getNumClients());
cmdList->cmdQImmediate->registerCsrClient();
cmdList->cmdQImmediate->setClientId(csr->registerClient());
clientCount = csr->getNumClients();
csr->callBaseWaitForCompletionWithTimeout = false;

View File

@@ -715,8 +715,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC
context->allocHostMem(&hostDesc, size, alignment, &dstPtr);
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->csr);
ultCsr->recordFlusheBatchBuffer = true;
int client;
ultCsr->registerClient(&client);
ultCsr->registerClient();
auto result = commandList0->appendMemoryCopy(dstPtr, srcPtr, size, nullptr, 0, nullptr, false, false);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
@@ -779,9 +778,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC
context->allocHostMem(&hostDesc, size, alignment, &dstPtr);
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->csr);
ultCsr->recordFlusheBatchBuffer = true;
int client1, client2;
ultCsr->registerClient(&client1);
ultCsr->registerClient(&client2);
ultCsr->registerClient();
ultCsr->registerClient();
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
ultCsr->directSubmission.reset(directSubmission);