refactor: inline simple level zero queue method

Related-To: NEO-7828

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-09-19 20:09:26 +00:00
committed by Compute-Runtime-Automation
parent 381d7d7a02
commit 713511eea9
6 changed files with 17 additions and 13 deletions

View File

@@ -259,10 +259,6 @@ void CommandQueueImp::unregisterCsrClient() {
}
}
ze_command_queue_mode_t CommandQueueImp::getSynchronousMode() const {
return desc.mode;
}
ze_result_t CommandQueueImp::CommandBufferManager::initialize(Device *device, size_t sizeRequested) {
size_t alignedSize = alignUp<size_t>(sizeRequested, MemoryConstants::pageSize64k);
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, alignedSize,

View File

@@ -464,7 +464,7 @@ void CommandQueueHw<gfxCoreFamily>::programPipelineSelectIfGpgpuDisabled(NEO::Li
template <GFXCORE_FAMILY gfxCoreFamily>
bool CommandQueueHw<gfxCoreFamily>::isDispatchTaskCountPostSyncRequired(ze_fence_handle_t hFence, bool containsAnyRegularCmdList) const {
return containsAnyRegularCmdList || !csr->isUpdateTagFromWaitEnabled() || hFence != nullptr || getSynchronousMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
return containsAnyRegularCmdList || !csr->isUpdateTagFromWaitEnabled() || hFence != nullptr || isSynchronousMode();
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -1234,7 +1234,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::waitForCommandQueueCompletionAndClean
ze_result_t ret = ZE_RESULT_SUCCESS;
if (this->getSynchronousMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS) {
if (this->isSynchronousMode()) {
if (const auto syncRet = this->synchronize(std::numeric_limits<uint64_t>::max()); syncRet == ZE_RESULT_ERROR_DEVICE_LOST) {
ret = syncRet;
}

View File

@@ -83,7 +83,15 @@ struct CommandQueueImp : public CommandQueue {
NEO::CommandStreamReceiver *getCsr() { return csr; }
MOCKABLE_VIRTUAL NEO::WaitStatus reserveLinearStreamSize(size_t size);
ze_command_queue_mode_t getSynchronousMode() const;
ze_command_queue_mode_t getCommandQueueMode() const {
return desc.mode;
}
bool isSynchronousMode() const {
return getCommandQueueMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
}
virtual bool getPreemptionCmdProgramming() = 0;
void handleIndirectAllocationResidency(UnifiedMemoryControls unifiedMemoryControls, std::unique_lock<std::mutex> &lockForIndirect, bool performMigration) override;
void makeResidentAndMigrate(bool performMigration, const NEO::ResidencyContainer &residencyContainer) override;

View File

@@ -1995,7 +1995,7 @@ TEST_F(CommandQueueCreate, givenOverrideCmdQueueSyncModeToDefaultWhenCommandQueu
returnValue);
ASSERT_NE(nullptr, commandQueue);
EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS);
auto cmdQueueSynchronousMode = reinterpret_cast<L0::CommandQueueImp *>(commandQueue)->getSynchronousMode();
auto cmdQueueSynchronousMode = reinterpret_cast<L0::CommandQueueImp *>(commandQueue)->getCommandQueueMode();
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_DEFAULT, cmdQueueSynchronousMode);
commandQueue->destroy();
@@ -2018,7 +2018,7 @@ TEST_F(CommandQueueCreate, givenOverrideCmdQueueSyncModeToAsynchronousWhenComman
returnValue);
ASSERT_NE(nullptr, commandQueue);
EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS);
auto cmdQueueSynchronousMode = reinterpret_cast<L0::CommandQueueImp *>(commandQueue)->getSynchronousMode();
auto cmdQueueSynchronousMode = reinterpret_cast<L0::CommandQueueImp *>(commandQueue)->getCommandQueueMode();
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS, cmdQueueSynchronousMode);
commandQueue->destroy();
@@ -2041,7 +2041,7 @@ TEST_F(CommandQueueCreate, givenOverrideCmdQueueSyncModeToSynchronousWhenCommand
returnValue);
ASSERT_NE(nullptr, commandQueue);
EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS);
auto cmdQueueSynchronousMode = reinterpret_cast<L0::CommandQueueImp *>(commandQueue)->getSynchronousMode();
auto cmdQueueSynchronousMode = reinterpret_cast<L0::CommandQueueImp *>(commandQueue)->getCommandQueueMode();
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, cmdQueueSynchronousMode);
commandQueue->destroy();

View File

@@ -475,7 +475,7 @@ HWTEST_F(CommandQueueSynchronizeTest, givenSynchronousCommandQueueWhenTagUpdateF
returnValue));
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
ASSERT_NE(nullptr, commandQueue);
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, commandQueue->getSynchronousMode());
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, commandQueue->getCommandQueueMode());
auto commandList = std::unique_ptr<CommandList>(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)));
ASSERT_NE(nullptr, commandList);

View File

@@ -112,7 +112,7 @@ TEST(L0DeviceTest, GivenDualStorageSharedMemorySupportedWhenCreatingDeviceThenPa
ASSERT_NE(nullptr, whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate);
EXPECT_NE(nullptr, static_cast<CommandQueueImp *>(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getCsr());
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast<CommandQueueImp *>(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getSynchronousMode());
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast<CommandQueueImp *>(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getCommandQueueMode());
}
TEST(L0DeviceTest, GivenDualStorageSharedMemoryAndImplicitScalingThenPageFaultCmdListImmediateWithInitializedCmdQIsCreatedAgainstSubDeviceZero) {
@@ -134,7 +134,7 @@ TEST(L0DeviceTest, GivenDualStorageSharedMemoryAndImplicitScalingThenPageFaultCm
ASSERT_NE(nullptr, whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate);
EXPECT_NE(nullptr, static_cast<CommandQueueImp *>(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getCsr());
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast<CommandQueueImp *>(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getSynchronousMode());
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast<CommandQueueImp *>(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getCommandQueueMode());
EXPECT_EQ(whiteboxCast(deviceImp->pageFaultCommandList)->device, deviceImp->subDevices[0]);
}