diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index 4262d78a8f..189c43d234 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -10,6 +10,7 @@ #include "shared/source/command_container/cmdcontainer.h" #include "shared/source/command_stream/preemption_mode.h" #include "shared/source/command_stream/stream_properties.h" +#include "shared/source/helpers/cache_policy.h" #include "shared/source/helpers/heap_base_address_model.h" #include "shared/source/memory_manager/prefetch_manager.h" #include "shared/source/unified_memory/unified_memory.h" @@ -258,7 +259,7 @@ struct CommandList : _ze_command_list_handle_t { virtual ze_result_t executeCommandListImmediate(bool performMigration) = 0; virtual ze_result_t initialize(Device *device, NEO::EngineGroupType engineGroupType, ze_command_list_flags_t flags) = 0; virtual ~CommandList(); - NEO::CommandContainer commandContainer; + bool getContainsStatelessUncachedResource() { return containsStatelessUncachedResource; } std::map &getHostPtrMap() { return hostPtrMap; @@ -296,24 +297,41 @@ struct CommandList : _ze_command_list_handle_t { return this->isTbxMode && !this->isSyncModeQueue; } - ze_context_handle_t hContext = nullptr; - std::vector printfKernelContainer; - CommandQueue *cmdQImmediate = nullptr; - NEO::CommandStreamReceiver *csr = nullptr; - Device *device = nullptr; - NEO::PreemptionMode commandListPreemptionMode = NEO::PreemptionMode::Initial; - unsigned long numThreads = 1u; - uint32_t cmdListType = CommandListType::TYPE_REGULAR; - uint32_t commandListPerThreadScratchSize = 0u; - uint32_t commandListPerThreadPrivateScratchSize = 0u; - uint32_t partitionCount = 1; - bool isFlushTaskSubmissionEnabled = false; - bool isSyncModeQueue = false; - bool isTbxMode = false; - bool commandListSLMEnabled = false; - bool requiresQueueUncachedMocs = false; - bool isBcsSplitNeeded = false; - bool immediateCmdListHeapSharing = false; + void setCmdListContext(ze_context_handle_t contextHandle) { + this->hContext = contextHandle; + } + + ze_context_handle_t getCmdListContext() const { + return this->hContext; + } + + uint32_t getPartitionCount() const { + return this->partitionCount; + } + + uint32_t getCmdListType() const { + return this->cmdListType; + } + + bool isRequiredQueueUncachedMocs() const { + return requiresQueueUncachedMocs; + } + + bool flushTaskSubmissionEnabled() const { + return isFlushTaskSubmissionEnabled; + } + + Device *getDevice() const { + return this->device; + } + + NEO::CommandContainer &getCmdContainer() { + return this->commandContainer; + } + + void setCsr(NEO::CommandStreamReceiver *newCsr) { + this->csr = newCsr; + } protected: NEO::GraphicsAllocation *getAllocationFromHostPtrMap(const void *buffer, uint64_t bufferSize); @@ -328,18 +346,50 @@ struct CommandList : _ze_command_list_handle_t { std::map hostPtrMap; std::vector ownedPrivateAllocations; std::vector patternAllocations; - CmdListReturnPoints returnPoints; + std::vector printfKernelContainer; + NEO::CommandContainer commandContainer; + + CmdListReturnPoints returnPoints; NEO::StreamProperties requiredStreamState{}; NEO::StreamProperties finalStreamState{}; CommandsToPatch commandsToPatch{}; UnifiedMemoryControls unifiedMemoryControls; NEO::PrefetchContext prefetchContext; + NEO::L1CachePolicy l1CachePolicyData{}; + + int64_t currentSurfaceStateBaseAddress = NEO::StreamProperty64::initValue; + int64_t currentDynamicStateBaseAddress = NEO::StreamProperty64::initValue; + int64_t currentIndirectObjectBaseAddress = NEO::StreamProperty64::initValue; + int64_t currentBindingTablePoolBaseAddress = NEO::StreamProperty64::initValue; + + ze_context_handle_t hContext = nullptr; + CommandQueue *cmdQImmediate = nullptr; + NEO::CommandStreamReceiver *csr = nullptr; + Device *device = nullptr; + + size_t cmdListCurrentStartOffset = 0; + + unsigned long numThreads = 1u; ze_command_list_flags_t flags = 0u; + NEO::PreemptionMode commandListPreemptionMode = NEO::PreemptionMode::Initial; NEO::EngineGroupType engineGroupType; NEO::HeapAddressModel cmdListHeapAddressModel = NEO::HeapAddressModel::PrivateHeaps; + uint32_t cmdListType = CommandListType::TYPE_REGULAR; + uint32_t commandListPerThreadScratchSize = 0u; + uint32_t commandListPerThreadPrivateScratchSize = 0u; + uint32_t partitionCount = 1; + uint32_t defaultMocsIndex = 0; + + bool isFlushTaskSubmissionEnabled = false; + bool isSyncModeQueue = false; + bool isTbxMode = false; + bool commandListSLMEnabled = false; + bool requiresQueueUncachedMocs = false; + bool isBcsSplitNeeded = false; + bool immediateCmdListHeapSharing = false; bool indirectAllocationsAllowed = false; bool internalUsage = false; bool containsCooperativeKernelsFlag = false; @@ -353,6 +403,10 @@ struct CommandList : _ze_command_list_handle_t { bool signalAllEventPackets = false; bool stateBaseAddressTracking = false; bool doubleSbaWa = false; + bool containsAnyKernel = false; + bool pipeControlMultiKernelEventSync = false; + bool compactL3FlushEventPacket = false; + bool dynamicHeapRequired = false; }; using CommandListAllocatorFn = CommandList *(*)(uint32_t); diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.h b/level_zero/core/source/cmdlist/cmdlist_hw.h index 0ed1f47264..d80192cb2e 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.h +++ b/level_zero/core/source/cmdlist/cmdlist_hw.h @@ -8,7 +8,6 @@ #pragma once #include "shared/source/command_stream/transfer_direction.h" -#include "shared/source/helpers/cache_policy.h" #include "shared/source/helpers/hw_mapper.h" #include "shared/source/helpers/pipe_control_args.h" #include "shared/source/helpers/vec.h" @@ -327,28 +326,6 @@ struct CommandListCoreFamily : CommandListImp { static constexpr bool cmdListDefaultPipelineSelectModeSelected = true; static constexpr bool cmdListDefaultMediaSamplerClockGate = false; static constexpr bool cmdListDefaultGlobalAtomics = false; - - NEO::L1CachePolicy l1CachePolicyData{}; - - int64_t currentSurfaceStateBaseAddress = NEO::StreamProperty64::initValue; - int64_t currentDynamicStateBaseAddress = NEO::StreamProperty64::initValue; - int64_t currentIndirectObjectBaseAddress = NEO::StreamProperty64::initValue; - int64_t currentBindingTablePoolBaseAddress = NEO::StreamProperty64::initValue; - - size_t currentSurfaceStateSize = NEO::StreamPropertySizeT::initValue; - size_t currentDynamicStateSize = NEO::StreamPropertySizeT::initValue; - size_t currentIndirectObjectSize = NEO::StreamPropertySizeT::initValue; - size_t currentBindingTablePoolSize = NEO::StreamPropertySizeT::initValue; - - size_t cmdListCurrentStartOffset = 0; - - int32_t currentMocsState = NEO::StreamProperty::initValue; - uint32_t defaultMocsIndex = 0; - - bool containsAnyKernel = false; - bool pipeControlMultiKernelEventSync = false; - bool compactL3FlushEventPacket = false; - bool dynamicHeapRequired = false; }; template diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index af9b586004..c43d344162 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -106,11 +106,6 @@ void CommandListCoreFamily::postInitComputeSetup() { currentDynamicStateBaseAddress = NEO::StreamProperty64::initValue; currentIndirectObjectBaseAddress = NEO::StreamProperty64::initValue; currentBindingTablePoolBaseAddress = NEO::StreamProperty64::initValue; - - currentSurfaceStateSize = NEO::StreamPropertySizeT::initValue; - currentDynamicStateSize = NEO::StreamPropertySizeT::initValue; - currentIndirectObjectSize = NEO::StreamPropertySizeT::initValue; - currentBindingTablePoolSize = NEO::StreamPropertySizeT::initValue; } template @@ -2441,12 +2436,17 @@ template void CommandListCoreFamily::updateStreamPropertiesForRegularCommandLists(Kernel &kernel, bool isCooperative, const ze_group_count_t *threadGroupDimensions, bool isIndirect) { using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE; + size_t currentSurfaceStateSize = NEO::StreamPropertySizeT::initValue; + size_t currentDynamicStateSize = NEO::StreamPropertySizeT::initValue; + size_t currentIndirectObjectSize = NEO::StreamPropertySizeT::initValue; + size_t currentBindingTablePoolSize = NEO::StreamPropertySizeT::initValue; + auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); auto &kernelAttributes = kernel.getKernelDescriptor().kernelAttributes; KernelImp &kernelImp = static_cast(kernel); - currentMocsState = static_cast(device->getMOCS(!kernelImp.getKernelRequiresUncachedMocs(), false) >> 1); + int32_t currentMocsState = static_cast(device->getMOCS(!kernelImp.getKernelRequiresUncachedMocs(), false) >> 1); bool checkSsh = false; if (currentSurfaceStateBaseAddress == NEO::StreamProperty64::initValue || commandContainer.isHeapDirty(NEO::IndirectHeap::Type::SURFACE_STATE)) { auto ssh = commandContainer.getIndirectHeap(NEO::IndirectHeap::Type::SURFACE_STATE); diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 578892f851..60252a5aad 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -271,7 +271,7 @@ ze_result_t CommandQueueHw::validateCommandListsParams( return ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE; } - if (this->activeSubDevices < commandList->partitionCount) { + if (this->activeSubDevices < commandList->getPartitionCount()) { return ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE; } } @@ -443,7 +443,7 @@ CommandQueueHw::CommandListExecutionContext::CommandListExecution } // If the Command List has commands that require uncached MOCS, then any changes to the commands in the queue requires the uncached MOCS - if (commandList->requiresQueueUncachedMocs && this->cachedMOCSAllowed == true) { + if (commandList->isRequiredQueueUncachedMocs() && this->cachedMOCSAllowed == true) { this->cachedMOCSAllowed = false; } @@ -530,26 +530,27 @@ void CommandQueueHw::setupCmdListsAndContextParams( for (auto i = 0u; i < numCommandLists; i++) { auto commandList = CommandList::fromHandle(phCommandLists[i]); + commandList->setCsr(this->csr); - commandList->csr = this->csr; + auto &commandContainer = commandList->getCmdContainer(); - ctx.containsAnyRegularCmdList |= commandList->cmdListType == CommandList::CommandListType::TYPE_REGULAR; + ctx.containsAnyRegularCmdList |= commandList->getCmdListType() == CommandList::CommandListType::TYPE_REGULAR; if (!isCopyOnlyCommandQueue) { ctx.perThreadScratchSpaceSize = std::max(ctx.perThreadScratchSpaceSize, commandList->getCommandListPerThreadScratchSize()); ctx.perThreadPrivateScratchSize = std::max(ctx.perThreadPrivateScratchSize, commandList->getCommandListPerThreadPrivateScratchSize()); if (commandList->getCommandListPerThreadScratchSize() != 0 || commandList->getCommandListPerThreadPrivateScratchSize() != 0) { - if (commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE) != nullptr) { - heapContainer.push_back(commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getGraphicsAllocation()); + if (commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE) != nullptr) { + heapContainer.push_back(commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getGraphicsAllocation()); } - for (auto element : commandList->commandContainer.sshAllocations) { + for (auto element : commandContainer.sshAllocations) { heapContainer.push_back(element); } } } - this->partitionCount = std::max(this->partitionCount, commandList->partitionCount); - makeResidentAndMigrate(ctx.isMigrationRequested, commandList->commandContainer.getResidencyContainer()); + this->partitionCount = std::max(this->partitionCount, commandList->getPartitionCount()); + makeResidentAndMigrate(ctx.isMigrationRequested, commandContainer.getResidencyContainer()); } ctx.isDispatchTaskCountPostSyncRequired = isDispatchTaskCountPostSyncRequired(hFence, ctx.containsAnyRegularCmdList); @@ -568,7 +569,7 @@ size_t CommandQueueHw::estimateLinearStreamSizeInitial( for (auto i = 0u; i < numCommandLists; i++) { auto commandList = CommandList::fromHandle(phCommandLists[i]); - linearStreamSizeEstimate += commandList->commandContainer.getCmdBufferAllocations().size(); + linearStreamSizeEstimate += commandList->getCmdContainer().getCmdBufferAllocations().size(); } linearStreamSizeEstimate *= NEO::EncodeBatchBufferStartOrEnd::getBatchBufferStartSize(); linearStreamSizeEstimate += this->csr->getCmdsSizeForHardwareContext(); @@ -746,7 +747,7 @@ void CommandQueueHw::programStateBaseAddressWithGsbaIfDirty( if (!ctx.gsbaStateDirty) { return; } - auto indirectHeap = CommandList::fromHandle(hCommandList)->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); + auto indirectHeap = CommandList::fromHandle(hCommandList)->getCmdContainer().getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); auto scratchSpaceController = this->csr->getScratchSpaceController(); programStateBaseAddress(scratchSpaceController->calculateNewGSH(), indirectHeap->getGraphicsAllocation()->isAllocatedInLocalMemoryPool(), @@ -873,9 +874,11 @@ void CommandQueueHw::programOneCmdListBatchBufferStart(CommandLis template void CommandQueueHw::programOneCmdListBatchBufferStart(CommandList *commandList, NEO::LinearStream &cmdStream, CommandListExecutionContext &ctx) { - auto &cmdBufferAllocations = commandList->commandContainer.getCmdBufferAllocations(); + auto &commandContainer = commandList->getCmdContainer(); + + auto &cmdBufferAllocations = commandContainer.getCmdBufferAllocations(); auto cmdBufferCount = cmdBufferAllocations.size(); - bool isCommandListImmediate = (commandList->cmdListType == CommandList::CommandListType::TYPE_IMMEDIATE) ? true : false; + bool isCommandListImmediate = (commandList->getCmdListType() == CommandList::CommandListType::TYPE_IMMEDIATE) ? true : false; auto &returnPoints = commandList->getReturnPoints(); uint32_t returnPointsSize = commandList->getReturnPointsSize(); @@ -885,7 +888,7 @@ void CommandQueueHw::programOneCmdListBatchBufferStart(CommandLis auto allocation = cmdBufferAllocations[iter]; uint64_t startOffset = allocation->getGpuAddress(); if (isCommandListImmediate && (iter == (cmdBufferCount - 1))) { - startOffset = ptrOffset(allocation->getGpuAddress(), commandList->commandContainer.currentLinearStreamStartOffset); + startOffset = ptrOffset(allocation->getGpuAddress(), commandContainer.currentLinearStreamStartOffset); } NEO::EncodeBatchBufferStartOrEnd::programBatchBufferStart(&cmdStream, startOffset, true, false, false); if (returnPointsSize > 0) { @@ -916,7 +919,7 @@ void CommandQueueHw::programOneCmdListBatchBufferStart(CommandLis template void CommandQueueHw::mergeOneCmdListPipelinedState(CommandList *commandList) { - bool isCommandListImmediate = (commandList->cmdListType == CommandList::CommandListType::TYPE_IMMEDIATE) ? true : false; + bool isCommandListImmediate = (commandList->getCmdListType() == CommandList::CommandListType::TYPE_IMMEDIATE) ? true : false; auto commandListImp = static_cast(commandList); if (!isCommandListImmediate && commandListImp->getLogicalStateHelper()) { this->csr->getLogicalStateHelper()->mergePipelinedState(*commandListImp->getLogicalStateHelper()); @@ -952,8 +955,8 @@ void CommandQueueHw::prefetchMemoryToDeviceAssociatedWithCmdList( auto prefetchManager = this->device->getDriverHandle()->getMemoryManager()->getPrefetchManager(); prefetchManager->migrateAllocationsToGpu(commandList->getPrefetchContext(), *this->device->getDriverHandle()->getSvmAllocsManager(), - *commandList->device->getNEODevice(), - *commandList->csr); + *this->device->getNEODevice(), + *this->csr); } } @@ -1229,7 +1232,7 @@ void CommandQueueHw::programRequiredStateBaseAddressForCommandLis csrState.stateBaseAddress.setProperties(cmdListRequired.stateBaseAddress); if (ctx.gsbaStateDirty || csrState.stateBaseAddress.isDirty()) { - auto indirectHeap = commandList->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); + auto indirectHeap = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); auto scratchSpaceController = this->csr->getScratchSpaceController(); programStateBaseAddress(scratchSpaceController->calculateNewGSH(), indirectHeap->getGraphicsAllocation()->isAllocatedInLocalMemoryPool(), @@ -1246,17 +1249,18 @@ void CommandQueueHw::programRequiredStateBaseAddressForCommandLis template void CommandQueueHw::updateBaseAddressState(CommandList *lastCommandList) { auto csrHw = static_cast *>(csr); - auto dsh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); + auto &commandContainer = lastCommandList->getCmdContainer(); + auto dsh = commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); if (dsh != nullptr) { csrHw->getDshState().updateAndCheck(dsh); } - auto ssh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE); + auto ssh = commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE); if (ssh != nullptr) { csrHw->getSshState().updateAndCheck(ssh); } - auto ioh = lastCommandList->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); + auto ioh = commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); csrHw->getIohState().updateAndCheck(ioh); } diff --git a/level_zero/core/source/context/context_imp.cpp b/level_zero/core/source/context/context_imp.cpp index 79a98d2455..527f2b7bf2 100644 --- a/level_zero/core/source/context/context_imp.cpp +++ b/level_zero/core/source/context/context_imp.cpp @@ -751,7 +751,7 @@ ze_result_t ContextImp::createCommandList(ze_device_handle_t hDevice, ze_command_list_handle_t *commandList) { auto ret = L0::Device::fromHandle(hDevice)->createCommandList(desc, commandList); if (*commandList) { - L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle(); + L0::CommandList::fromHandle(*commandList)->setCmdListContext(this->toHandle()); } return ret; } @@ -761,7 +761,7 @@ ze_result_t ContextImp::createCommandListImmediate(ze_device_handle_t hDevice, ze_command_list_handle_t *commandList) { auto ret = L0::Device::fromHandle(hDevice)->createCommandListImmediate(desc, commandList); if (*commandList) { - L0::CommandList::fromHandle(*commandList)->hContext = this->toHandle(); + L0::CommandList::fromHandle(*commandList)->setCmdListContext(this->toHandle()); } return ret; } diff --git a/level_zero/core/source/device/bcs_split.h b/level_zero/core/source/device/bcs_split.h index 22e542e3f0..f2d75fb111 100644 --- a/level_zero/core/source/device/bcs_split.h +++ b/level_zero/core/source/device/bcs_split.h @@ -76,7 +76,7 @@ struct BcsSplit { std::function appendCall) { ze_result_t result = ZE_RESULT_SUCCESS; - auto markerEventIndex = this->events.obtainForSplit(Context::fromHandle(cmdList->hContext), MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate::GfxFamily::TimestampPacketType)); + auto markerEventIndex = this->events.obtainForSplit(Context::fromHandle(cmdList->getCmdListContext()), MemoryConstants::pageSize64k / sizeof(typename CommandListCoreFamilyImmediate::GfxFamily::TimestampPacketType)); auto barrierRequired = cmdList->isBarrierRequired(); if (barrierRequired) { @@ -108,7 +108,7 @@ struct BcsSplit { auto eventHandle = this->events.subcopy[subcopyEventIndex + i]->toHandle(); result = appendCall(localDstPtr, localSrcPtr, localSize, eventHandle); - if (cmdList->isFlushTaskSubmissionEnabled) { + if (cmdList->flushTaskSubmissionEnabled()) { cmdList->executeCommandListImmediateWithFlushTaskImpl(performMigration, false, hasRelaxedOrderingDependencies, cmdQsForSplit[i]); } else { cmdList->executeCommandListImmediateImpl(performMigration, cmdQsForSplit[i]); diff --git a/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp index e4c96ba1f5..6098fda23c 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_cmdlist_gen12lp.cpp @@ -27,6 +27,7 @@ template struct CommandListAdjustStateComputeMode : public WhiteBox<::L0::CommandListProductFamily> { CommandListAdjustStateComputeMode() : WhiteBox<::L0::CommandListProductFamily>(1) {} using ::L0::CommandListProductFamily::applyMemoryRangesBarrier; + using ::L0::CommandListProductFamily::commandContainer; }; HWTEST2_F(CommandListCreate, givenAllocationsWhenApplyRangesBarrierThenCheckWhetherL3ControlIsProgrammed, IsGen12LP) { diff --git a/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_launch_kernel_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_launch_kernel_gen9.cpp index be01d5b8d9..64a4b8f042 100644 --- a/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_launch_kernel_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_launch_kernel_gen9.cpp @@ -31,11 +31,11 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelWithSLMThenL3IsProgrammedWit auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); bool foundL3 = false; for (auto it = cmdList.begin(); it != cmdList.end(); it++) { @@ -43,7 +43,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelWithSLMThenL3IsProgrammedWit if (lri) { if (lri->getRegisterOffset() == NEO::L3CNTLRegisterOffset::registerOffset) { auto value = lri->getDataDword(); - auto dataSlm = NEO::PreambleHelper::getL3Config(commandList->commandContainer.getDevice()->getHardwareInfo(), true); + auto dataSlm = NEO::PreambleHelper::getL3Config(commandList->getCmdContainer().getDevice()->getHardwareInfo(), true); EXPECT_EQ(dataSlm, value); foundL3 = true; break; diff --git a/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_range_barrier_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_range_barrier_gen9.cpp index feb15c22b9..4b268dfe10 100644 --- a/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_range_barrier_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_cmdlist_append_range_barrier_gen9.cpp @@ -42,18 +42,18 @@ HWTEST2_F(CommandListAppendGen9, WhenAppendingMemoryRangesBarrierThenPipeControl bool ret = commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); ASSERT_FALSE(ret); auto usedSpaceBefore = - commandList->commandContainer.getCommandStream()->getUsed(); + commandList->getCmdContainer().getCommandStream()->getUsed(); commandList->appendMemoryRangesBarrier(numRanges, &pRangeSizes, pRanges, nullptr, 0, nullptr); auto usedSpaceAfter = - commandList->commandContainer.getCommandStream()->getUsed(); + commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, ptrOffset( - commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; @@ -96,16 +96,16 @@ HWTEST2_F(CommandListAppendGen9, givenSignalEventWhenAppendingMemoryRangesBarrie EXPECT_EQ(ZE_RESULT_SUCCESS, result); auto event = whiteboxCast(Event::create(eventPool, &eventDesc, device)); auto usedSpaceBefore = - commandList->commandContainer.getCommandStream()->getUsed(); + commandList->getCmdContainer().getCommandStream()->getUsed(); commandList->appendMemoryRangesBarrier(numRanges, &pRangeSizes, pRanges, event->toHandle(), 0, nullptr); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); // Ensure we have two pipe controls: one for barrier, one for signal GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; auto itor = findAll(cmdList.begin(), cmdList.end()); ASSERT_FALSE(itor.empty()); diff --git a/level_zero/core/test/unit_tests/gen9/test_cmdlist_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_cmdlist_gen9.cpp index ad0a2dbb1a..743a2b3b42 100644 --- a/level_zero/core/test/unit_tests/gen9/test_cmdlist_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_cmdlist_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -35,7 +35,7 @@ HWTEST2_F(CommandListProgramL3, givenAllocationsWhenProgramL3ThenMmioIsAppended, commandList->programL3(false); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); bool found = false; auto miLoadImm = findAll(cmdList.begin(), cmdList.end()); for (auto itor : miLoadImm) { @@ -64,7 +64,7 @@ HWTEST2_F(CommandListProgramL3, givenAllocationsWhenProgramL3WithSlmThenMmioIsAp commandList->programL3(true); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); bool found = false; auto miLoadImm = findAll(cmdList.begin(), cmdList.end()); for (auto itor : miLoadImm) { @@ -94,7 +94,7 @@ HWTEST2_F(CommandListProgramL3, givenAllocationsWhenProgramL3WithoutSlmThenMmioI commandList->programL3(false); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); bool found = false; auto miLoadImm = findAll(cmdList.begin(), cmdList.end()); for (auto itor : miLoadImm) { diff --git a/level_zero/core/test/unit_tests/gen9/test_cmdqueue_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_cmdqueue_gen9.cpp index abdec9447b..acbb7892d0 100644 --- a/level_zero/core/test/unit_tests/gen9/test_cmdqueue_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_cmdqueue_gen9.cpp @@ -19,6 +19,7 @@ #include "level_zero/core/source/driver/driver_imp.h" #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/mocks/mock_built_ins.h" +#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" namespace L0 { @@ -210,8 +211,9 @@ HWTEST2_F(CommandQueueGroupMultiDevice, false, NEO::EngineGroupType::RenderCompute, returnValue)); + auto whiteBoxCmdList = static_cast(commandList0.get()); - L0::CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + L0::CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); auto &nearestSubDevice = *device->getNEODevice()->getNearestGenericSubDevice(0); const auto rcsIndex = nearestSubDevice.getEngineGroupIndexFromEngineGroupType(NEO::EngineGroupType::RenderCompute); auto expectedCSR = nearestSubDevice.getRegularEngineGroups()[rcsIndex].engines[queueGroupIndex].commandStreamReceiver; diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp index 199614570c..046a0390e4 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,11 +10,11 @@ namespace L0 { namespace ult { -WhiteBox<::L0::CommandList>::WhiteBox(Device *device) : BaseClass(BaseClass::defaultNumIddsPerBlock) {} +WhiteBox<::L0::CommandList>::WhiteBox() : BaseClass(BaseClass::defaultNumIddsPerBlock) {} WhiteBox<::L0::CommandList>::~WhiteBox() {} -MockCommandList::MockCommandList(Device *device) : WhiteBox<::L0::CommandList>(device) { +MockCommandList::MockCommandList(Device *device) : WhiteBox<::L0::CommandList>() { this->device = device; size_t batchBufferSize = 65536u; batchBuffer = new uint8_t[batchBufferSize]; diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h index 9cdf03c626..ebb6ee85c7 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -44,6 +44,7 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::applyMemoryRangesBarrier; using BaseClass::clearCommandsToPatch; using BaseClass::cmdListHeapAddressModel; + using BaseClass::cmdListType; using BaseClass::cmdQImmediate; using BaseClass::commandContainer; using BaseClass::commandListPerThreadScratchSize; @@ -53,6 +54,7 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::containsAnyKernel; using BaseClass::containsCooperativeKernelsFlag; using BaseClass::csr; + using BaseClass::device; using BaseClass::doubleSbaWa; using BaseClass::engineGroupType; using BaseClass::estimateBufferSizeMultiTileBarrier; @@ -67,12 +69,16 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::immediateCmdListHeapSharing; using BaseClass::indirectAllocationsAllowed; using BaseClass::initialize; + using BaseClass::isFlushTaskSubmissionEnabled; + using BaseClass::isSyncModeQueue; + using BaseClass::isTbxMode; using BaseClass::isTimestampEventForMultiTile; using BaseClass::partitionCount; using BaseClass::patternAllocations; using BaseClass::pipeControlMultiKernelEventSync; using BaseClass::pipelineSelectStateTracking; using BaseClass::requiredStreamState; + using BaseClass::requiresQueueUncachedMocs; using BaseClass::setupTimestampEventForMultiTile; using BaseClass::signalAllEventPackets; using BaseClass::stateBaseAddressTracking; @@ -136,10 +142,13 @@ struct WhiteBox> using BaseClass = L0::CommandListCoreFamilyImmediate; using BaseClass::clearCommandsToPatch; using BaseClass::cmdListHeapAddressModel; + using BaseClass::cmdListType; using BaseClass::cmdQImmediate; + using BaseClass::commandContainer; using BaseClass::commandsToPatch; using BaseClass::compactL3FlushEventPacket; using BaseClass::csr; + using BaseClass::device; using BaseClass::doubleSbaWa; using BaseClass::finalStreamState; using BaseClass::frontEndStateTracking; @@ -148,10 +157,13 @@ struct WhiteBox> using BaseClass::immediateCmdListHeapSharing; using BaseClass::isFlushTaskSubmissionEnabled; using BaseClass::isRelaxedOrderingDispatchAllowed; + using BaseClass::isSyncModeQueue; + using BaseClass::isTbxMode; using BaseClass::partitionCount; using BaseClass::pipeControlMultiKernelEventSync; using BaseClass::pipelineSelectStateTracking; using BaseClass::requiredStreamState; + using BaseClass::requiresQueueUncachedMocs; using BaseClass::signalAllEventPackets; using BaseClass::stateBaseAddressTracking; using BaseClass::stateComputeModeTracking; @@ -162,11 +174,18 @@ struct WhiteBox> template struct MockCommandListImmediate : public CommandListCoreFamilyImmediate { using BaseClass = CommandListCoreFamilyImmediate; + using BaseClass::cmdQImmediate; + using BaseClass::commandContainer; using BaseClass::compactL3FlushEventPacket; using BaseClass::containsAnyKernel; + using BaseClass::csr; + using BaseClass::device; using BaseClass::finalStreamState; using BaseClass::immediateCmdListHeapSharing; using BaseClass::indirectAllocationsAllowed; + using BaseClass::isFlushTaskSubmissionEnabled; + using BaseClass::isSyncModeQueue; + using BaseClass::isTbxMode; using BaseClass::pipeControlMultiKernelEventSync; using BaseClass::requiredStreamState; }; @@ -176,10 +195,12 @@ struct WhiteBox<::L0::CommandList> : public ::L0::CommandListImp { using BaseClass = ::L0::CommandListImp; using BaseClass::BaseClass; using BaseClass::cmdListHeapAddressModel; + using BaseClass::cmdListType; using BaseClass::cmdQImmediate; using BaseClass::commandContainer; using BaseClass::commandListPreemptionMode; using BaseClass::csr; + using BaseClass::device; using BaseClass::doubleSbaWa; using BaseClass::finalStreamState; using BaseClass::frontEndStateTracking; @@ -187,15 +208,18 @@ struct WhiteBox<::L0::CommandList> : public ::L0::CommandListImp { using BaseClass::immediateCmdListHeapSharing; using BaseClass::initialize; using BaseClass::isFlushTaskSubmissionEnabled; + using BaseClass::isSyncModeQueue; + using BaseClass::isTbxMode; using BaseClass::nonImmediateLogicalStateHelper; using BaseClass::partitionCount; using BaseClass::pipelineSelectStateTracking; using BaseClass::requiredStreamState; + using BaseClass::requiresQueueUncachedMocs; using BaseClass::signalAllEventPackets; using BaseClass::stateBaseAddressTracking; using BaseClass::stateComputeModeTracking; - WhiteBox(Device *device); + WhiteBox(); ~WhiteBox() override; }; @@ -445,7 +469,9 @@ template class MockAppendMemoryCopy : public CommandListCoreFamily { public: using BaseClass = CommandListCoreFamily; + using BaseClass::commandContainer; using BaseClass::dcFlushSupport; + using BaseClass::device; ADDMETHOD(appendMemoryCopyKernelWithGA, ze_result_t, false, ZE_RESULT_SUCCESS, (void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc, @@ -520,6 +546,7 @@ class MockCommandListImmediateHw : public WhiteBox<::L0::CommandListCoreFamilyIm using BaseClass = WhiteBox<::L0::CommandListCoreFamilyImmediate>; MockCommandListImmediateHw() : BaseClass() {} using BaseClass::applyMemoryRangesBarrier; + using BaseClass::cmdListType; using BaseClass::dcFlushSupport; using BaseClass::dependenciesPresent; using BaseClass::eventWaitlistSyncRequired; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index 41a7ee2b41..9099c0b687 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -39,7 +39,7 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListFromContextThenSuccessIs ze_result_t result = context->createCommandList(device, &desc, &hCommandList); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context); + EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->getCmdListContext()), context); L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList); commandList->destroy(); @@ -61,7 +61,7 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListImmediateFromContextThen ze_result_t result = context->createCommandListImmediate(device, &desc, &hCommandList); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->hContext), context); + EXPECT_EQ(Context::fromHandle(CommandList::fromHandle(hCommandList)->getCmdListContext()), context); L0::CommandList *commandList = L0::CommandList::fromHandle(hCommandList); commandList->destroy(); @@ -86,7 +86,7 @@ HWTEST2_F(ContextCommandListCreate, givenImmediateCmdListWhenGettingLogicalState auto commandList = static_cast *>(L0::CommandList::fromHandle(hCommandList)); - EXPECT_EQ(commandList->csr->getLogicalStateHelper(), commandList->getLogicalStateHelper()); + EXPECT_EQ(whiteboxCast(commandList)->csr->getLogicalStateHelper(), commandList->getLogicalStateHelper()); commandList->destroy(); } @@ -119,30 +119,30 @@ TEST_F(CommandListCreate, whenCommandListIsCreatedThenItIsInitialized) { std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - ASSERT_GT(commandList->commandContainer.getCmdBufferAllocations().size(), 0u); + EXPECT_EQ(device, commandList->getDevice()); + ASSERT_GT(commandList->getCmdContainer().getCmdBufferAllocations().size(), 0u); auto numAllocations = 0u; - auto allocation = whiteboxCast(commandList->commandContainer.getCmdBufferAllocations()[0]); + auto allocation = whiteboxCast(commandList->getCmdContainer().getCmdBufferAllocations()[0]); ASSERT_NE(allocation, nullptr); ++numAllocations; - ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); + ASSERT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); for (uint32_t i = 0; i < NEO::HeapType::NUM_TYPES; i++) { auto heapType = static_cast(i); if (NEO::HeapType::DYNAMIC_STATE == heapType && !device->getHwInfo().capabilityTable.supportsImages) { - ASSERT_EQ(commandList->commandContainer.getIndirectHeap(heapType), nullptr); + ASSERT_EQ(commandList->getCmdContainer().getIndirectHeap(heapType), nullptr); } else { - ASSERT_NE(commandList->commandContainer.getIndirectHeap(heapType), nullptr); + ASSERT_NE(commandList->getCmdContainer().getIndirectHeap(heapType), nullptr); ++numAllocations; - ASSERT_NE(commandList->commandContainer.getIndirectHeapAllocation(heapType), nullptr); + ASSERT_NE(commandList->getCmdContainer().getIndirectHeapAllocation(heapType), nullptr); } } - EXPECT_LT(0u, commandList->commandContainer.getCommandStream()->getAvailableSpace()); - ASSERT_EQ(commandList->commandContainer.getResidencyContainer().size(), numAllocations); - EXPECT_EQ(commandList->commandContainer.getResidencyContainer().front(), allocation); + EXPECT_LT(0u, commandList->getCmdContainer().getCommandStream()->getAvailableSpace()); + ASSERT_EQ(commandList->getCmdContainer().getResidencyContainer().size(), numAllocations); + EXPECT_EQ(commandList->getCmdContainer().getResidencyContainer().front(), allocation); } TEST_F(CommandListCreate, givenRegularCommandListThenDefaultNumIddPerBlockIsUsed) { @@ -151,7 +151,7 @@ TEST_F(CommandListCreate, givenRegularCommandListThenDefaultNumIddPerBlockIsUsed ASSERT_NE(nullptr, commandList); const uint32_t defaultNumIdds = CommandList::defaultNumIddsPerBlock; - EXPECT_EQ(defaultNumIdds, commandList->commandContainer.getNumIddPerBlock()); + EXPECT_EQ(defaultNumIdds, commandList->getCmdContainer().getNumIddPerBlock()); } TEST_F(CommandListCreate, givenNonExistingPtrThenAppendMemAdviseReturnsError) { @@ -806,7 +806,7 @@ TEST_F(CommandListCreate, givenImmediateCommandListThenInternalEngineIsUsedIfReq returnValue)); ASSERT_NE(nullptr, commandList0); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(static_cast(commandList0.get())->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); internalEngine = false; @@ -819,7 +819,7 @@ TEST_F(CommandListCreate, givenImmediateCommandListThenInternalEngineIsUsedIfReq returnValue)); ASSERT_NE(nullptr, commandList1); - cmdQueue = reinterpret_cast(commandList1->cmdQImmediate); + cmdQueue = reinterpret_cast(static_cast(commandList1.get())->cmdQImmediate); EXPECT_NE(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); } @@ -859,7 +859,7 @@ TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed) ASSERT_NE(nullptr, commandList); const uint32_t cmdListImmediateIdds = CommandList::commandListimmediateIddsPerBlock; - EXPECT_EQ(cmdListImmediateIdds, commandList->commandContainer.getNumIddPerBlock()); + EXPECT_EQ(cmdListImmediateIdds, commandList->getCmdContainer().getNumIddPerBlock()); } TEST_F(CommandListCreate, whenCreatingImmediateCommandListThenItHasImmediateCommandQueueCreated) { @@ -868,9 +868,9 @@ TEST_F(CommandListCreate, whenCreatingImmediateCommandListThenItHasImmediateComm std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, static_cast(commandList.get())->cmdQImmediate); } TEST_F(CommandListCreate, whenCreatingImmediateCommandListWithSyncModeThenItHasImmediateCommandQueueCreated) { @@ -880,9 +880,9 @@ TEST_F(CommandListCreate, whenCreatingImmediateCommandListWithSyncModeThenItHasI std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, static_cast(commandList.get())->cmdQImmediate); } TEST_F(CommandListCreate, whenCreatingImmediateCommandListWithASyncModeThenItHasImmediateCommandQueueCreated) { @@ -892,9 +892,9 @@ TEST_F(CommandListCreate, whenCreatingImmediateCommandListWithASyncModeThenItHas std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, static_cast(commandList.get())->cmdQImmediate); } TEST_F(CommandListCreate, whenCreatingImmCmdListWithSyncModeAndAppendSignalEventThenUpdateTaskCountNeededFlagIsDisabled) { @@ -904,9 +904,9 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithSyncModeAndAppendSignalEvent std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, static_cast(commandList.get())->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -944,9 +944,9 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithSyncModeAndAppendBarrierThen std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, static_cast(commandList.get())->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -985,6 +985,7 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1011,7 +1012,7 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh driverHandle->importExternalPointer(dstPtr, MemoryConstants::pageSize); - auto ultCsr = static_cast *>(commandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); ultCsr->recordFlusheBatchBuffer = true; auto verifyFlags = [&ultCsr](ze_result_t result, bool dispatchFlag, bool bbFlag) { @@ -1078,12 +1079,13 @@ HWTEST2_F(CommandListCreate, whenDispatchingThenPassNumCsrClients, IsAtLeastXeHp ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); Mock<::L0::Kernel> kernel; ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; - auto ultCsr = static_cast *>(commandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); ultCsr->recordFlusheBatchBuffer = true; ultCsr->registerClient(); @@ -1104,6 +1106,7 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1130,7 +1133,7 @@ HWTEST2_F(CommandListCreate, givenDirectSubmissionAndImmCmdListWhenDispatchingTh driverHandle->importExternalPointer(dstPtr, MemoryConstants::pageSize); - auto ultCsr = static_cast *>(commandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); ultCsr->recordFlusheBatchBuffer = true; auto directSubmission = new MockDirectSubmissionHw>(*ultCsr); @@ -1224,26 +1227,27 @@ TEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmCmdListWithSyncModeAndAppen ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); + auto whiteBoxCmdList = static_cast(commandList.get()); ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); mockCommandStreamReceiver.waitForCompletionWithTimeoutReturnValue = WaitStatus::GpuHang; - const auto oldCsr = commandList->csr; - commandList->csr = &mockCommandStreamReceiver; - static_cast *>(commandList->cmdQImmediate)->csr = &mockCommandStreamReceiver; + const auto oldCsr = whiteBoxCmdList->csr; + whiteBoxCmdList->csr = &mockCommandStreamReceiver; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = &mockCommandStreamReceiver; const auto appendBarrierResult = commandList->appendBarrier(nullptr, 0, nullptr); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, appendBarrierResult); - commandList->csr = oldCsr; - static_cast *>(commandList->cmdQImmediate)->csr = oldCsr; + whiteBoxCmdList->csr = oldCsr; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = oldCsr; } HWTEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmediateCommandListAndAppendingSignalEventsThenDeviceLostIsReturned) { @@ -1258,10 +1262,11 @@ HWTEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmediateCommandListAndAppen ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1293,15 +1298,15 @@ HWTEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmediateCommandListAndAppen MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); mockCommandStreamReceiver.waitForCompletionWithTimeoutReturnValue = WaitStatus::GpuHang; - const auto oldCsr = commandList->csr; - commandList->csr = &mockCommandStreamReceiver; - static_cast *>(commandList->cmdQImmediate)->csr = &mockCommandStreamReceiver; + const auto oldCsr = whiteBoxCmdList->csr; + whiteBoxCmdList->csr = &mockCommandStreamReceiver; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = &mockCommandStreamReceiver; returnValue = commandList->appendSignalEvent(event); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->csr = oldCsr; - static_cast *>(commandList->cmdQImmediate)->csr = oldCsr; + whiteBoxCmdList->csr = oldCsr; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = oldCsr; } HWTEST2_F(CommandListCreate, GivenGpuHangOnExecutingCommandListsWhenCreatingImmediateCommandListAndWaitingOnEventsThenDeviceLostIsReturned, IsSKL) { @@ -1313,10 +1318,11 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnExecutingCommandListsWhenCreatingImme ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1342,15 +1348,15 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnExecutingCommandListsWhenCreatingImme MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); mockCommandStreamReceiver.waitForCompletionWithTimeoutReturnValue = WaitStatus::GpuHang; - const auto oldCsr = commandList->csr; - commandList->csr = &mockCommandStreamReceiver; - static_cast *>(commandList->cmdQImmediate)->csr = &mockCommandStreamReceiver; + const auto oldCsr = whiteBoxCmdList->csr; + whiteBoxCmdList->csr = &mockCommandStreamReceiver; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = &mockCommandStreamReceiver; returnValue = commandList->appendWaitOnEvents(1, &event, false, true); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->csr = oldCsr; - static_cast *>(commandList->cmdQImmediate)->csr = oldCsr; + whiteBoxCmdList->csr = oldCsr; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = oldCsr; } TEST_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceForImmediateCommandThenNextCommandBufferIsUsed) { @@ -1359,24 +1365,25 @@ TEST_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceForIm ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - commandList->isFlushTaskSubmissionEnabled = true; + whiteBoxCmdList->isFlushTaskSubmissionEnabled = true; - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); // reduce available cmd buffer size, so next command can't fit in 1st and we need to use 2nd cmd buffer - size_t useSize = commandList->commandContainer.getCommandStream()->getMaxAvailableSpace() - maxImmediateCommandSize + 1; - commandList->commandContainer.getCommandStream()->getSpace(useSize); - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); + size_t useSize = commandList->getCmdContainer().getCommandStream()->getMaxAvailableSpace() - maxImmediateCommandSize + 1; + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 8, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); } HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCommandListAndWaitingOnEventsThenDeviceLostIsReturned, IsSKL) { @@ -1390,10 +1397,11 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCom ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1418,14 +1426,14 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCom MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); mockCommandStreamReceiver.waitForCompletionWithTimeoutReturnValue = WaitStatus::GpuHang; - const auto oldCsr = commandList->csr; - commandList->csr = &mockCommandStreamReceiver; - static_cast *>(commandList->cmdQImmediate)->csr = &mockCommandStreamReceiver; + const auto oldCsr = whiteBoxCmdList->csr; + whiteBoxCmdList->csr = &mockCommandStreamReceiver; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = &mockCommandStreamReceiver; returnValue = commandList->appendWaitOnEvents(1, &event, false, true); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->csr = oldCsr; - static_cast *>(commandList->cmdQImmediate)->csr = oldCsr; + whiteBoxCmdList->csr = oldCsr; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = oldCsr; } HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCommandListWithoutFlushTaskAndWaitingOnEventsThenDeviceLostIsReturnedFromExecute, IsSKL) { @@ -1440,10 +1448,11 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCom ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1469,12 +1478,12 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCom MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); Mock mockCommandQueue(device, &mockCommandStreamReceiver, &desc); mockCommandQueue.executeCommandListsResult = ZE_RESULT_ERROR_DEVICE_LOST; - auto oldCommandQueue = commandList->cmdQImmediate; - commandList->cmdQImmediate = &mockCommandQueue; + auto oldCommandQueue = whiteBoxCmdList->cmdQImmediate; + whiteBoxCmdList->cmdQImmediate = &mockCommandQueue; returnValue = commandList->appendWaitOnEvents(1, &event, false, true); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->cmdQImmediate = oldCommandQueue; + whiteBoxCmdList->cmdQImmediate = oldCommandQueue; } HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCommandListWithoutFlushTaskAndWaitingOnEventsThenDeviceLostIsReturnedFromSynchronize, IsSKL) { @@ -1489,10 +1498,11 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCom ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1518,12 +1528,12 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCom MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); Mock mockCommandQueue(device, &mockCommandStreamReceiver, &desc); mockCommandQueue.synchronizeResult = ZE_RESULT_ERROR_DEVICE_LOST; - auto oldCommandQueue = commandList->cmdQImmediate; - commandList->cmdQImmediate = &mockCommandQueue; + auto oldCommandQueue = whiteBoxCmdList->cmdQImmediate; + whiteBoxCmdList->cmdQImmediate = &mockCommandQueue; returnValue = commandList->appendWaitOnEvents(1, &event, false, true); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->cmdQImmediate = oldCommandQueue; + whiteBoxCmdList->cmdQImmediate = oldCommandQueue; } HWTEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmediateCommandListAndAppendingEventResetThenDeviceLostIsReturned) { @@ -1538,10 +1548,11 @@ HWTEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmediateCommandListAndAppen ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1580,15 +1591,15 @@ HWTEST_F(CommandListCreate, GivenGpuHangWhenCreatingImmediateCommandListAndAppen MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); mockCommandStreamReceiver.waitForCompletionWithTimeoutReturnValue = WaitStatus::GpuHang; - const auto oldCsr = commandList->csr; - commandList->csr = &mockCommandStreamReceiver; - static_cast *>(commandList->cmdQImmediate)->csr = &mockCommandStreamReceiver; + const auto oldCsr = whiteBoxCmdList->csr; + whiteBoxCmdList->csr = &mockCommandStreamReceiver; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = &mockCommandStreamReceiver; returnValue = commandList->appendEventReset(event); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->csr = oldCsr; - static_cast *>(commandList->cmdQImmediate)->csr = oldCsr; + whiteBoxCmdList->csr = oldCsr; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = oldCsr; } HWTEST_F(CommandListCreate, GivenImmediateCommandListWithFlushTaskCreatedThenNumIddPerBlockIsOne) { @@ -1603,12 +1614,13 @@ HWTEST_F(CommandListCreate, GivenImmediateCommandListWithFlushTaskCreatedThenNum ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); EXPECT_EQ(1u, commandContainer.getNumIddPerBlock()); } @@ -1624,10 +1636,11 @@ HWTEST_F(CommandListCreate, GivenGpuHangAndEnabledFlushTaskSubmissionFlagWhenCre std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1653,15 +1666,15 @@ HWTEST_F(CommandListCreate, GivenGpuHangAndEnabledFlushTaskSubmissionFlagWhenCre MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); mockCommandStreamReceiver.waitForCompletionWithTimeoutReturnValue = WaitStatus::GpuHang; - const auto oldCsr = commandList->csr; - commandList->csr = &mockCommandStreamReceiver; - static_cast *>(commandList->cmdQImmediate)->csr = &mockCommandStreamReceiver; + const auto oldCsr = whiteBoxCmdList->csr; + whiteBoxCmdList->csr = &mockCommandStreamReceiver; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = &mockCommandStreamReceiver; returnValue = commandList->appendWaitOnEvents(1, &event, false, true); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, returnValue); - commandList->csr = oldCsr; - static_cast *>(commandList->cmdQImmediate)->csr = oldCsr; + whiteBoxCmdList->csr = oldCsr; + static_cast *>(whiteBoxCmdList->cmdQImmediate)->csr = oldCsr; } TEST_F(CommandListCreate, whenCreatingImmCmdListWithSyncModeAndAppendResetEventThenUpdateTaskCountNeededFlagIsDisabled) { @@ -1670,10 +1683,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithSyncModeAndAppendResetEventT ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1710,10 +1724,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendSignalEven ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1750,10 +1765,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendBarrierThe ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1793,10 +1809,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndCopyEngineAndApp ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1835,10 +1852,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendEventReset ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1875,10 +1893,11 @@ TEST_F(CommandListCreate, whenInvokingAppendMemoryCopyFromContextForImmediateCom ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); @@ -1918,8 +1937,8 @@ TEST_F(ContextCommandListCreate, givenDeferredEngineCreationWhenImmediateCommand ze_result_t result = context->createCommandListImmediate(device, &desc, &cmdListHandle); L0::CommandList *cmdList = L0::CommandList::fromHandle(cmdListHandle); - EXPECT_EQ(device, cmdList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, cmdList->cmdListType); + EXPECT_EQ(device, cmdList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, cmdList->getCmdListType()); EXPECT_NE(nullptr, cmdList); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_TRUE(expectedCsr->getOsContext().isInitialized()); @@ -1934,10 +1953,11 @@ TEST_F(CommandListCreate, whenInvokingAppendMemoryCopyFromContextForImmediateCom ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); @@ -1950,10 +1970,11 @@ TEST_F(CommandListCreate, whenInvokingAppendMemoryCopyFromContextForImmediateCom ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); @@ -1971,10 +1992,11 @@ TEST_F(CommandListCreate, givenQueueDescriptionwhenCreatingImmediateCommandListF ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); } } } @@ -1993,7 +2015,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListCreate, whenCommandListIsCreatedThenPCAnd ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto gmmHelper = commandContainer.getDevice()->getGmmHelper(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); @@ -2049,7 +2071,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListCreate, whenBindlessModeEnabledWhenComman ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); @@ -2078,7 +2100,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListCreate, whenBindlessModeEnabledWhenComman desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); @@ -2102,7 +2124,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenCreatedThenStateBase ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( @@ -2112,8 +2134,8 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenCreatedThenStateBase EXPECT_EQ(cmdList.end(), itor); for (uint32_t i = 0; i < NEO::HeapType::NUM_TYPES; i++) { - ASSERT_EQ(commandList->commandContainer.getIndirectHeap(static_cast(i)), nullptr); - ASSERT_EQ(commandList->commandContainer.getIndirectHeapAllocation(static_cast(i)), nullptr); + ASSERT_EQ(commandContainer.getIndirectHeap(static_cast(i)), nullptr); + ASSERT_EQ(commandContainer.getIndirectHeapAllocation(static_cast(i)), nullptr); } } @@ -2121,7 +2143,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenSetBarrierThenMiFlus using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandList->appendBarrier(nullptr, 0, nullptr); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( @@ -2138,12 +2160,13 @@ HWTEST_F(CommandListCreate, givenImmediateCommandListWithCopyOnlyWhenSetBarrierT ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandList->appendBarrier(nullptr, 0, nullptr); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( @@ -2180,11 +2203,11 @@ HWTEST_F(CommandListCreate, givenBindlessModeEnabledWhenCommandListsResetThenSba returnValue)); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); returnValue = commandList->reset(); - auto usedAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedAfter)); auto itor = find(cmdList.begin(), cmdList.end()); ASSERT_EQ(cmdList.end(), itor); @@ -2201,11 +2224,11 @@ HWTEST_F(CommandListCreate, givenBindlessModeDisabledWhenCommandListsResetThenSb returnValue)); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); returnValue = commandList->reset(); - auto usedAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedAfter)); auto itor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itor); @@ -2216,7 +2239,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenResetThenStateBaseAd ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandList->reset(); GenCmdList cmdList; @@ -2231,7 +2254,7 @@ HWTEST_F(CommandListCreate, givenCommandListWhenSetBarrierThenPipeControlIsProgr using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandList->appendBarrier(nullptr, 0, nullptr); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( @@ -2245,7 +2268,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenAppendingBarrierThenPipeControl using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); size_t usedBefore = commandContainer.getCommandStream()->getUsed(); returnValue = commandList->appendBarrier(nullptr, 0, nullptr); EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); @@ -2265,7 +2288,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenAppendingBarrierThenPipeControl using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); size_t usedBefore = commandContainer.getCommandStream()->getUsed(); returnValue = commandList->appendBarrier(nullptr, 0, nullptr); EXPECT_EQ(returnValue, ZE_RESULT_SUCCESS); @@ -2315,7 +2338,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingBeforeCommandForCo GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); auto cmd = genCmdCast(*itor); @@ -2350,7 +2373,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingAfterCommandForCop auto baseAddr = event->getGpuAddress(device); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); auto cmd = genCmdCast(*itor); @@ -2368,11 +2391,11 @@ HWTEST2_F(CommandListCreate, givenNullEventWhenAppendEventAfterWalkerThenNothing auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::Copy, 0u); - auto usedBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); commandList->appendSignalEventPostWalker(nullptr); - EXPECT_EQ(commandList->commandContainer.getCommandStream()->getUsed(), usedBefore); + EXPECT_EQ(commandList->getCmdContainer().getCommandStream()->getUsed(), usedBefore); } TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDefaultValuseIsHwSupported) { @@ -2402,7 +2425,7 @@ TEST_F(CommandListCreate, givenCreatedCommandListWhenGettingTrackingFlagsThenDef auto expectedHeapAddressModel = l0GfxCoreHelper.getPlatformHeapAddressModel(); EXPECT_EQ(expectedHeapAddressModel, commandList->cmdListHeapAddressModel); - EXPECT_EQ(expectedHeapAddressModel, commandList->commandContainer.getHeapAddressModel()); + EXPECT_EQ(expectedHeapAddressModel, commandList->getCmdContainer().getHeapAddressModel()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index 57a583db29..4c2170a4bf 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -592,7 +592,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyWithSignalEventsThenS ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); @@ -642,7 +642,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyWithSignalEventScopeS ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); @@ -684,7 +684,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyWithSignalEventScopeS ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); @@ -1123,7 +1123,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyRegionWithinMaxBlitSize GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); itor++; @@ -1171,7 +1171,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyRegionWithinMaxBlitSize GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); auto cmd = genCmdCast(*itor); EXPECT_EQ(cmd->getDestinationX2CoordinateRight(), static_cast(copySize.x) / bytesPerPixel); @@ -1216,7 +1216,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyRegionGreaterThanMaxBli GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); itor++; @@ -1315,11 +1315,11 @@ HWTEST2_F(CommandListAppendMemoryCopyBlit, whenAppendMemoryCopyBlitIsAppendedAnd ze_result_t res = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, res)); - auto firstBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto firstBatchBufferAllocation = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); - auto useSize = commandList->commandContainer.getCommandStream()->getAvailableSpace(); + auto useSize = commandList->getCmdContainer().getCommandStream()->getAvailableSpace(); useSize -= sizeof(MI_BATCH_BUFFER_END); - commandList->commandContainer.getCommandStream()->getSpace(useSize); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); auto ptr = reinterpret_cast(0x1234); auto gmmHelper = device->getNEODevice()->getGmmHelper(); @@ -1349,7 +1349,7 @@ HWTEST2_F(CommandListAppendMemoryCopyBlit, whenAppendMemoryCopyBlitIsAppendedAnd nullptr, 0, nullptr, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto secondBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto secondBatchBufferAllocation = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); EXPECT_NE(firstBatchBufferAllocation, secondBatchBufferAllocation); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp index 497bf24e03..7ba856301c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp @@ -287,7 +287,7 @@ HWTEST2_F(CommandListCreate, ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *srcBuffer = reinterpret_cast(0x1234); @@ -344,7 +344,7 @@ HWTEST2_F(CommandListCreate, ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *srcBuffer = nullptr; @@ -408,7 +408,7 @@ HWTEST2_F(CommandListCreate, ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *dstBuffer = nullptr; @@ -464,7 +464,7 @@ HWTEST2_F(CommandListCreate, ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *dstBuffer = nullptr; @@ -521,7 +521,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryFillHavingHostMemoryWithS ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *dstBuffer = nullptr; @@ -576,7 +576,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryFillHavingEventsWithDevic ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *dstBuffer = nullptr; @@ -635,7 +635,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryFillHavingEventsWithDevic ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); commandContainer.slmSize = 0; void *dstBuffer = nullptr; @@ -795,8 +795,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSi NEO::EngineGroupType::RenderCompute, result)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); void *srcBuffer = reinterpret_cast(0x1234); @@ -838,8 +839,9 @@ TEST_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSigna NEO::EngineGroupType::RenderCompute, ret)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); void *srcBuffer = reinterpret_cast(0x1234); @@ -884,8 +886,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSi NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { @@ -939,8 +942,9 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenCopyRegionFromI NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { @@ -984,8 +988,9 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenCopyRegionFromI NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { @@ -1030,8 +1035,9 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenCopyFromImageTo NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { @@ -1074,8 +1080,9 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenMemoryCopyRegio NEO::EngineGroupType::Copy, result)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { @@ -1115,10 +1122,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendSignalEven ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1155,10 +1163,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendBarrierThe ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1197,10 +1206,11 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendEventReset ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -1242,10 +1252,11 @@ TEST_F(CommandListCreateWithBcs, givenQueueDescriptionwhenCreatingImmediateComma ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 3; @@ -1287,8 +1298,9 @@ HWTEST2_F(CommandListCreateWithBcs, NEO::EngineGroupType::LinkedCopy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); auto internalCopyEngine = neoDevice->getInternalCopyEngine(); EXPECT_NE(nullptr, internalCopyEngine); EXPECT_EQ(cmdQueue->getCsr(), internalCopyEngine->commandStreamReceiver); @@ -1312,7 +1324,7 @@ HWTEST2_F(CommandListCreateWithBcs, givenForceFlushTaskEnabledWhenCreatingComman ASSERT_NE(nullptr, commandList); EXPECT_TRUE(commandList->isCopyOnly()); - EXPECT_TRUE(commandList->isFlushTaskSubmissionEnabled); + EXPECT_TRUE(commandList->flushTaskSubmissionEnabled()); } HWTEST2_F(CommandListCreate, whenGettingCommandsToPatchThenCorrectValuesAreReturned, IsAtLeastSkl) { diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp index ec284b67ef..a83368a520 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp @@ -32,7 +32,7 @@ HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppendWriteGlobalTimest ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); uint64_t timestampAddress = 0xfffffffffff0L; uint64_t *dstptr = reinterpret_cast(timestampAddress); @@ -65,7 +65,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenAppendWriteGlobalTimestampCalle using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); uint64_t timestampAddress = 0x123456785500; uint64_t *dstptr = reinterpret_cast(timestampAddress); @@ -101,7 +101,7 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenAppendWriteGlobalTimestampCalle uint64_t *dstptr = reinterpret_cast(timestampAddress); commandList->appendWriteGlobalTimestamp(dstptr, nullptr, 0, nullptr); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto &residencyContainer = commandContainer.getResidencyContainer(); const bool addressIsInContainer = std::any_of(residencyContainer.begin(), residencyContainer.end(), [timestampAddress](NEO::GraphicsAllocation *alloc) { return alloc->getGpuAddress() == timestampAddress; @@ -121,8 +121,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendWriteGlobalTimes NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); uint64_t timestampAddress = 0x123456785500; @@ -258,7 +259,7 @@ HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenImmediateCommandListIsI ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue)); - EXPECT_EQ(true, commandList->isFlushTaskSubmissionEnabled); + EXPECT_EQ(true, commandList->flushTaskSubmissionEnabled()); } HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenFlushTaskSubmissionDisabledWhenCommandListIsInititalizedThenFlushTaskIsSetToFalse) { @@ -268,7 +269,7 @@ HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenFlushTaskSubmissionDisa ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue)); - EXPECT_EQ(false, commandList->isFlushTaskSubmissionEnabled); + EXPECT_EQ(false, commandList->flushTaskSubmissionEnabled()); } HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendLaunchKernelThenSuccessIsReturned) { @@ -710,15 +711,17 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendBarrierThenI ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)); - EXPECT_EQ(commandList->csr->getNextBarrierCount(), 0u); + auto whiteBoxCmdList = static_cast(commandList.get()); + + EXPECT_EQ(whiteBoxCmdList->csr->getNextBarrierCount(), 0u); auto result = commandList->appendBarrier(nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(commandList->csr->getNextBarrierCount(), 2u); + EXPECT_EQ(whiteBoxCmdList->csr->getNextBarrierCount(), 2u); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); if (EncodeMiFlushDW::getMiFlushDwWaSize()) { itor++; @@ -726,7 +729,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendBarrierThenI EXPECT_NE(cmdList.end(), itor); auto cmd = genCmdCast(*itor); EXPECT_EQ(cmd->getPostSyncOperation(), MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD); - EXPECT_EQ(cmd->getDestinationAddress(), commandList->csr->getBarrierCountGpuAddress()); + EXPECT_EQ(cmd->getDestinationAddress(), whiteBoxCmdList->csr->getBarrierCountGpuAddress()); EXPECT_EQ(cmd->getImmediateData(), 2u); } @@ -736,7 +739,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendWaitOnEvents ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)); - EXPECT_EQ(commandList->csr->getNextBarrierCount(), 0u); + auto whiteBoxCmdList = static_cast(commandList.get()); + + EXPECT_EQ(whiteBoxCmdList->csr->getNextBarrierCount(), 0u); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -753,11 +758,11 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendWaitOnEvents result = commandList->appendWaitOnEvents(1u, &eventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(commandList->csr->getNextBarrierCount(), 2u); + EXPECT_EQ(whiteBoxCmdList->csr->getNextBarrierCount(), 2u); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); if (EncodeMiFlushDW::getMiFlushDwWaSize()) { itor++; @@ -765,7 +770,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendWaitOnEvents EXPECT_NE(cmdList.end(), itor); auto cmd = genCmdCast(*itor); EXPECT_EQ(cmd->getPostSyncOperation(), MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD); - EXPECT_EQ(cmd->getDestinationAddress(), commandList->csr->getBarrierCountGpuAddress()); + EXPECT_EQ(cmd->getDestinationAddress(), whiteBoxCmdList->csr->getBarrierCountGpuAddress()); EXPECT_EQ(cmd->getImmediateData(), 2u); } @@ -775,7 +780,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendWaitOnEvents ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue)); - EXPECT_EQ(commandList->csr->getNextBarrierCount(), 0u); + auto whiteBoxCmdList = static_cast(commandList.get()); + + EXPECT_EQ(whiteBoxCmdList->csr->getNextBarrierCount(), 0u); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -792,7 +799,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendWaitOnEvents result = commandList->appendWaitOnEvents(1u, &eventHandle, false, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(commandList->csr->getNextBarrierCount(), 1u); + EXPECT_EQ(whiteBoxCmdList->csr->getNextBarrierCount(), 1u); } HWTEST_F(CommandListCreate, GivenCommandListWhenUnalignedPtrThenLeftMiddleAndRightCopyAdded) { @@ -801,7 +808,7 @@ HWTEST_F(CommandListCreate, GivenCommandListWhenUnalignedPtrThenLeftMiddleAndRig std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device, commandList->device); + EXPECT_EQ(device, commandList->getDevice()); void *srcPtr = reinterpret_cast(0x4321); void *dstPtr = reinterpret_cast(0x2345); @@ -810,7 +817,7 @@ HWTEST_F(CommandListCreate, GivenCommandListWhenUnalignedPtrThenLeftMiddleAndRig GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -942,7 +949,7 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenCommandListWhenMemoryFillWithS ze_result_t result = ZE_RESULT_SUCCESS; auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize); EXPECT_EQ(ZE_RESULT_SUCCESS, ret); @@ -992,7 +999,7 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenCommandListWhenMemoryFillWithS ze_result_t result = ZE_RESULT_SUCCESS; auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize); EXPECT_EQ(ZE_RESULT_SUCCESS, ret); @@ -1069,7 +1076,7 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenCommandListWhenMemoryFillWithS ze_result_t result = ZE_RESULT_SUCCESS; auto commandList = std::make_unique>>(); commandList->initialize(device, NEO::EngineGroupType::Copy, 0u); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize); EXPECT_EQ(ZE_RESULT_SUCCESS, ret); @@ -1118,8 +1125,9 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenImmediateCommandListWhenMemory NEO::EngineGroupType::RenderCompute, ret)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); ret = hostDriverHandle->importExternalPointer(heapPointer, MemoryConstants::pageSize); @@ -1162,8 +1170,9 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenImmediateCommandListWhenMemory NEO::EngineGroupType::Copy, ret)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { @@ -1212,8 +1221,9 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenImmediateCommandListWhenMemory NEO::EngineGroupType::Copy, ret)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); if (neoDevice->getInternalCopyEngine()) { EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver); } else { diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp index f8642ce08c..16154f99bf 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp @@ -550,7 +550,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendSignalEventThe using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -567,7 +567,7 @@ HWTEST_F(CommandListCreate, givenCommandListWhenAppendSignalEventWithScopeThenPi using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -606,7 +606,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendWaitEventsWith using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event; event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -630,7 +630,7 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushThen ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event; event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -659,7 +659,7 @@ HWTEST_F(CommandListCreate, givenCommandListWhenAppendWaitEventsWithDcFlushThenP using SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event, event2; event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -699,10 +699,11 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendW ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); size_t expectedUsed = 2 * NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_END); if (NEO::MemorySynchronizationCommands::getDcFlushEnable(true, device->getNEODevice()->getRootDeviceEnvironment())) { @@ -710,7 +711,7 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendW } expectedUsed = alignUp(expectedUsed, 64); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event, event2; event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -748,15 +749,16 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendW ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); size_t expectedUsed = 2 * NEO::EncodeSempahore::getSizeMiSemaphoreWait() + sizeof(MI_BATCH_BUFFER_END); expectedUsed = alignUp(expectedUsed, 64); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event, event2; event.signalScope = 0; event.waitScope = 0; @@ -791,12 +793,13 @@ HWTEST_F(CommandListCreate, givenFlushTaskFlagEnabledAndAsyncCmdQueueAndCopyOnly ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event, event2; event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; @@ -832,9 +835,9 @@ HWTEST_F(CommandListCreate, givenImmediateCopyOnlySingleTileDirectSubmissionComm ASSERT_NE(nullptr, commandList); auto localMemSupported = device->getHwInfo().featureTable.flags.ftrLocalMemory; - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get() != nullptr, localMemSupported); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get() != nullptr, localMemSupported); if (localMemSupported) { - EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList->getGraphicsAllocation()->getMemoryPool())); + EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList->getGraphicsAllocation()->getMemoryPool())); } } @@ -852,7 +855,7 @@ HWTEST_F(CommandListCreate, givenMetricsImmediateCopyOnlySingleTileDirectSubmiss std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); } HWTEST2_F(CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListWhenCheckAvailableSpaceThenSwapCommandStreams, IsAtLeastSkl) { @@ -871,16 +874,16 @@ HWTEST2_F(CommandListCreate, givenSecondaryCommandStreamForImmediateCmdListWhenC reinterpret_cast *>(csr)->directSubmissionAvailable = true; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_NE(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); - EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList->getGraphicsAllocation()->getMemoryPool())); + EXPECT_NE(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList->getGraphicsAllocation()->getMemoryPool())); auto immediateCmdList = static_cast *>(commandList.get()); - auto secondaryCmdStream = reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(); + auto secondaryCmdStream = reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(); immediateCmdList->checkAvailableSpace(0u, false); - EXPECT_EQ(commandList->commandContainer.getCommandStream(), secondaryCmdStream); - EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(commandList->commandContainer.getCommandStream()->getGraphicsAllocation()->getMemoryPool())); + EXPECT_EQ(commandList->getCmdContainer().getCommandStream(), secondaryCmdStream); + EXPECT_TRUE(MemoryPoolHelper::isSystemMemoryPool(commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->getMemoryPool())); } HWTEST2_F(CommandListCreate, givenNoSecondaryCommandStreamForImmediateCmdListWhenCheckAvailableSpaceThenNotSwapCommandStreams, IsAtLeastSkl) { @@ -896,15 +899,15 @@ HWTEST2_F(CommandListCreate, givenNoSecondaryCommandStreamForImmediateCmdListWhe ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); auto immediateCmdList = static_cast *>(commandList.get()); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); immediateCmdList->checkAvailableSpace(0u, false); - EXPECT_EQ(commandList->commandContainer.getCommandStream(), cmdStream); - EXPECT_FALSE(MemoryPoolHelper::isSystemMemoryPool(commandList->commandContainer.getCommandStream()->getGraphicsAllocation()->getMemoryPool())); + EXPECT_EQ(commandList->getCmdContainer().getCommandStream(), cmdStream); + EXPECT_FALSE(MemoryPoolHelper::isSystemMemoryPool(commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->getMemoryPool())); } HWTEST_F(CommandListCreate, givenDirectSubmissionFlatRingBufferFlagDisabledImmediateCopyOnlySingleTileDirectSubmissionCommandListWhenInitializeThenNotCreateSecondaryCmdBufferInSystemMemory) { @@ -920,7 +923,7 @@ HWTEST_F(CommandListCreate, givenDirectSubmissionFlatRingBufferFlagDisabledImmed std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); } HWTEST_F(CommandListCreate, givenImmediateCopyOnlySingleTileCommandListWhenInitializeThenNotCreateSecondaryCmdBufferInSystemMemory) { @@ -932,7 +935,7 @@ HWTEST_F(CommandListCreate, givenImmediateCopyOnlySingleTileCommandListWhenIniti std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); } using CommandListCreateImplicitScaling = Test>; @@ -948,7 +951,7 @@ HWTEST_F(CommandListCreateImplicitScaling, givenImmediateCopyOnlyDirectSubmissio std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); } HWTEST_F(CommandListCreate, givenCopyOnlySingleTileDirectSubmissionCommandListWhenInitializeThenNotCreateSecondaryCmdBufferInSystemMemory) { @@ -961,7 +964,7 @@ HWTEST_F(CommandListCreate, givenCopyOnlySingleTileDirectSubmissionCommandListWh std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(reinterpret_cast(&commandList->commandContainer)->secondaryCommandStreamForImmediateCmdList.get(), nullptr); + EXPECT_EQ(reinterpret_cast(&commandList->getCmdContainer())->secondaryCommandStreamForImmediateCmdList.get(), nullptr); } HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndCopyOnlyImmediateCommandListWhenAppendWaitEventsWithSubdeviceScopeThenMiFlushAndSemWaitAreAdded) { @@ -972,12 +975,13 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndCopyOnlyImmediateCommandListWhe ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); MockEvent event, event2; event.signalScope = 0; event.waitScope = 0; @@ -1004,12 +1008,13 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndTbxCsrWithCopyOnlyImmediateComm ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); - commandList->isTbxMode = true; + whiteBoxCmdList->isTbxMode = true; MockEvent event, event2; event.signalScope = 0; @@ -1031,7 +1036,7 @@ HWTEST_F(CommandListCreate, givenFlushTaskFlagEnabledAndAsyncCmdQueueWithCopyOnl std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_TRUE(commandList->isFlushTaskSubmissionEnabled); + EXPECT_TRUE(commandList->flushTaskSubmissionEnabled()); } HWTEST2_F(CommandListCreate, givenAllValuesTbxAndSyncModeFlagsWhenCheckingWaitlistEventSyncRequiredThenExpectTrueOnlyForTbxTrueAndAsyncMode, IsAtLeastSkl) { @@ -1067,7 +1072,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, EXPECT_TRUE(commandList->stateBaseAddressTracking); - auto &container = commandList->commandContainer; + auto &container = commandList->getCmdContainer(); auto &cmdListStream = *container.getCommandStream(); ze_group_count_t groupCount{1, 1, 1}; @@ -1234,7 +1239,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, EXPECT_TRUE(commandList->stateBaseAddressTracking); - auto &container = commandList->commandContainer; + auto &container = commandList->getCmdContainer(); auto &cmdListStream = *container.getCommandStream(); ze_group_count_t groupCount{1, 1, 1}; @@ -1426,7 +1431,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, EXPECT_TRUE(commandListImmediate->stateBaseAddressTracking); - auto &container = commandListImmediate->commandContainer; + auto &container = commandListImmediate->getCmdContainer(); auto &cmdListImmediateStream = *container.getCommandStream(); auto &csrImmediate = neoDevice->getUltCommandStreamReceiver(); @@ -1585,7 +1590,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, EXPECT_TRUE(commandList->stateBaseAddressTracking); - auto &container = commandList->commandContainer; + auto &container = commandList->getCmdContainer(); auto &cmdListStream = *container.getCommandStream(); ze_group_count_t groupCount{1, 1, 1}; @@ -1713,7 +1718,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, bool iohDirty = csrIohStateCopy.updateAndCheck(container.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT)); EXPECT_FALSE(iohDirty); - auto &containerImmediate = commandListImmediate->commandContainer; + auto &containerImmediate = commandListImmediate->getCmdContainer(); auto &csrStream = csrImmediate.commandStream; @@ -1800,7 +1805,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, EXPECT_TRUE(commandList->stateBaseAddressTracking); - auto &containerImmediate = commandListImmediate->commandContainer; + auto &containerImmediate = commandListImmediate->getCmdContainer(); auto &csrImmediate = neoDevice->getUltCommandStreamReceiver(); auto &csrStream = csrImmediate.commandStream; @@ -1870,7 +1875,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, EXPECT_TRUE(sbaCmd->getSurfaceStateBaseAddressModifyEnable()); EXPECT_EQ(ssBaseAddressImmediate, sbaCmd->getSurfaceStateBaseAddress()); - auto &container = commandList->commandContainer; + auto &container = commandList->getCmdContainer(); result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -1991,7 +1996,7 @@ HWTEST2_F(CommandListStateBaseAddressTest, kernel->kernelRequiresUncachedMocsCount++; - auto &cmdStream = *commandList->commandContainer.getCommandStream(); + auto &cmdStream = *commandList->getCmdContainer().getCommandStream(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index 12462c49a3..2807789156 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -776,12 +776,12 @@ HWTEST2_F(CommandListTest, givenCmdListWithIndirectAccessWhenExecutingCommandLis MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); MockCommandQueueIndirectAccess mockCommandQueue(device, &mockCommandStreamReceiver, &desc); - auto oldCommandQueue = commandList->cmdQImmediate; - commandList->cmdQImmediate = &mockCommandQueue; + auto oldCommandQueue = commandListImmediate.cmdQImmediate; + commandListImmediate.cmdQImmediate = &mockCommandQueue; commandListImmediate.indirectAllocationsAllowed = true; commandListImmediate.executeCommandListImmediateWithFlushTask(false, false, false); EXPECT_EQ(mockCommandQueue.handleIndirectAllocationResidencyCalledTimes, 1u); - commandList->cmdQImmediate = oldCommandQueue; + commandListImmediate.cmdQImmediate = oldCommandQueue; } HWTEST2_F(CommandListTest, givenCmdListWithNoIndirectAccessWhenExecutingCommandListImmediateWithFlushTaskThenHandleIndirectAccessNotCalled, IsAtLeastSkl) { @@ -795,12 +795,12 @@ HWTEST2_F(CommandListTest, givenCmdListWithNoIndirectAccessWhenExecutingCommandL MockCommandStreamReceiver mockCommandStreamReceiver(*neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); MockCommandQueueIndirectAccess mockCommandQueue(device, &mockCommandStreamReceiver, &desc); - auto oldCommandQueue = commandList->cmdQImmediate; - commandList->cmdQImmediate = &mockCommandQueue; + auto oldCommandQueue = commandListImmediate.cmdQImmediate; + commandListImmediate.cmdQImmediate = &mockCommandQueue; commandListImmediate.indirectAllocationsAllowed = false; commandListImmediate.executeCommandListImmediateWithFlushTask(false, false, false); EXPECT_EQ(mockCommandQueue.handleIndirectAllocationResidencyCalledTimes, 0u); - commandList->cmdQImmediate = oldCommandQueue; + commandListImmediate.cmdQImmediate = oldCommandQueue; } using ImmediateCmdListSharedHeapsTest = Test; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp index 938b490000..753606c286 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_7.cpp @@ -83,11 +83,11 @@ HWTEST_F(CommandListCreate, GivenSingleTileDeviceWhenCommandListIsResetThenParti 0u, returnValue)); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - EXPECT_EQ(1u, commandList->partitionCount); + EXPECT_EQ(1u, commandList->getPartitionCount()); returnValue = commandList->reset(); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - EXPECT_EQ(1u, commandList->partitionCount); + EXPECT_EQ(1u, commandList->getPartitionCount()); } HWTEST_F(CommandListCreate, WhenReservingSpaceThenCommandsAddedToBatchBuffer) { @@ -95,8 +95,8 @@ HWTEST_F(CommandListCreate, WhenReservingSpaceThenCommandsAddedToBatchBuffer) { std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); - ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); - auto commandStream = commandList->commandContainer.getCommandStream(); + ASSERT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); + auto commandStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = commandStream->getUsed(); @@ -217,7 +217,7 @@ HWTEST2_F(CommandListCreate, givenSingleTileOnlyPlatformsWhenProgrammingMultiTil EXPECT_EQ(0u, commandList->estimateBufferSizeMultiTileBarrier(neoDevice->getRootDeviceEnvironment())); - auto cmdListStream = commandList->commandContainer.getCommandStream(); + auto cmdListStream = commandList->getCmdContainer().getCommandStream(); size_t usedBefore = cmdListStream->getUsed(); commandList->appendMultiTileBarrier(*neoDevice); size_t usedAfter = cmdListStream->getUsed(); @@ -504,8 +504,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendingMemoryCopyThe NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); void *srcPtr = reinterpret_cast(0x1234); @@ -527,8 +528,9 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendingMemoryCopyWit NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); void *srcPtr = reinterpret_cast(0x1234); @@ -550,7 +552,7 @@ HWTEST2_F(CommandListCreate, givenCommandListAndHostPointersWhenMemoryCopyCalled result = commandList0->appendMemoryCopy(dstPtr, srcPtr, 8, nullptr, 0, nullptr, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto &commandContainer = commandList0->commandContainer; + auto &commandContainer = commandList0->getCmdContainer(); GenCmdList genCmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed())); @@ -730,7 +732,9 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, queueDesc.ordinal = 0; queueDesc.index = 0; device->createCommandListImmediate(&queueDesc, &cmdListHandle); - EXPECT_EQ(static_cast(CommandList::fromHandle(cmdListHandle)->cmdQImmediate)->getCsr()->getNumClients(), 0u); + auto whiteBoxCmdList = static_cast(CommandList::fromHandle(cmdListHandle)); + + EXPECT_EQ(static_cast(whiteBoxCmdList->cmdQImmediate)->getCsr()->getNumClients(), 0u); EXPECT_FALSE(static_cast *>(CommandList::fromHandle(cmdListHandle))->waitForEventsFromHost()); @@ -789,7 +793,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS; MockCommandQueueHw mockCommandQueue(device, device->getNEODevice()->getDefaultEngine().commandStreamReceiver, &desc); commandList->cmdQImmediate = &mockCommandQueue; - commandList->commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver); + commandList->getCmdContainer().setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver); ze_group_count_t groupCount = {3, 2, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -815,8 +819,8 @@ HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyDis EXPECT_TRUE(commandList->frontEndStateTracking); - auto &cmdStream = *commandList->commandContainer.getCommandStream(); - auto &cmdBuffers = commandList->commandContainer.getCmdBufferAllocations(); + auto &cmdStream = *commandList->getCmdContainer().getCommandStream(); + auto &cmdBuffers = commandList->getCmdContainer().getCmdBufferAllocations(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -984,8 +988,8 @@ HWTEST2_F(MultiReturnCommandListTest, givenFrontEndTrackingIsUsedWhenPropertyCom NEO::DebugManager.flags.AllowMixingRegularAndCooperativeKernels.set(1); - auto &cmdStream = *commandList->commandContainer.getCommandStream(); - auto &cmdBuffers = commandList->commandContainer.getCmdBufferAllocations(); + auto &cmdStream = *commandList->getCmdContainer().getCommandStream(); + auto &cmdBuffers = commandList->getCmdContainer().getCmdBufferAllocations(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -1149,8 +1153,8 @@ HWTEST2_F(MultiReturnCommandListTest, EXPECT_TRUE(commandList->frontEndStateTracking); EXPECT_TRUE(commandQueue->frontEndStateTracking); - auto &cmdListStream = *commandList->commandContainer.getCommandStream(); - auto &cmdListBuffers = commandList->commandContainer.getCmdBufferAllocations(); + auto &cmdListStream = *commandList->getCmdContainer().getCommandStream(); + auto &cmdListBuffers = commandList->getCmdContainer().getCmdBufferAllocations(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -1401,8 +1405,8 @@ HWTEST2_F(MultiReturnCommandListTest, EXPECT_TRUE(commandList->frontEndStateTracking); EXPECT_TRUE(commandQueue->frontEndStateTracking); - auto &cmdListStream = *commandList->commandContainer.getCommandStream(); - auto &cmdListBuffers = commandList->commandContainer.getCmdBufferAllocations(); + auto &cmdListStream = *commandList->getCmdContainer().getCommandStream(); + auto &cmdListBuffers = commandList->getCmdContainer().getCmdBufferAllocations(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -1646,7 +1650,7 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr EXPECT_TRUE(commandList->frontEndStateTracking); EXPECT_TRUE(commandListImmediate->frontEndStateTracking); - auto ®ularCmdListStream = *commandList->commandContainer.getCommandStream(); + auto ®ularCmdListStream = *commandList->getCmdContainer().getCommandStream(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -1711,7 +1715,7 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr EXPECT_FALSE(NEO::UnitTestHelper::getDisableFusionStateFromFrontEndCommand(feState)); } - auto &immediateCmdListStream = *commandListImmediate->commandContainer.getCommandStream(); + auto &immediateCmdListStream = *commandListImmediate->getCmdContainer().getCommandStream(); auto &ultCsr = neoDevice->getUltCommandStreamReceiver(); auto &csrStream = ultCsr.commandStream; @@ -1779,7 +1783,7 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr CmdListKernelLaunchParams launchParams = {}; mockKernelImmData->kernelDescriptor->kernelAttributes.flags.requiresDisabledEUFusion = 1; - auto &immediateCmdListStream = *commandListImmediate->commandContainer.getCommandStream(); + auto &immediateCmdListStream = *commandListImmediate->getCmdContainer().getCommandStream(); auto &ultCsr = neoDevice->getUltCommandStreamReceiver(); auto &csrStream = ultCsr.commandStream; @@ -1828,7 +1832,7 @@ HWTEST2_F(MultiReturnCommandListTest, givenCmdQueueAndImmediateCmdListUseSameCsr EXPECT_FALSE(NEO::UnitTestHelper::getDisableFusionStateFromFrontEndCommand(feState)); } - auto ®ularCmdListStream = *commandList->commandContainer.getCommandStream(); + auto ®ularCmdListStream = *commandList->getCmdContainer().getCommandStream(); usedBefore = regularCmdListStream.getUsed(); result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); @@ -1888,20 +1892,21 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceFo ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - size_t useSize = commandList->commandContainer.getCommandStream()->getMaxAvailableSpace() - maxImmediateCommandSize + 1; - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); + size_t useSize = commandList->getCmdContainer().getCommandStream()->getMaxAvailableSpace() - maxImmediateCommandSize + 1; + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); - commandList->commandContainer.getCommandStream()->getGraphicsAllocation()->updateTaskCount(0u, 0u); - commandList->commandContainer.getCommandStream()->getSpace(useSize); + commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->updateTaskCount(0u, 0u); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); reinterpret_cast *>(commandList.get())->checkAvailableSpace(0, false); - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); - commandList->commandContainer.getCommandStream()->getSpace(useSize); - auto latestFlushedTaskCount = commandList->csr->peekLatestFlushedTaskCount(); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); + auto latestFlushedTaskCount = whiteBoxCmdList->csr->peekLatestFlushedTaskCount(); reinterpret_cast *>(commandList.get())->checkAvailableSpace(0, false); - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); - EXPECT_EQ(latestFlushedTaskCount + 1, commandList->csr->peekLatestFlushedTaskCount()); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); + EXPECT_EQ(latestFlushedTaskCount + 1, whiteBoxCmdList->csr->peekLatestFlushedTaskCount()); } HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceForWaitOnEventsAndImmediateCommandAndAllocationListNotEmptyThenReuseCommandBuffer, IsAtLeastSkl) { @@ -1910,24 +1915,25 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceFo ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); constexpr uint32_t numEvents = 100; constexpr size_t eventWaitSize = numEvents * NEO::EncodeSempahore::getSizeMiSemaphoreWait(); - size_t useSize = commandList->commandContainer.getCommandStream()->getMaxAvailableSpace() - (maxImmediateCommandSize + eventWaitSize) + 1; + size_t useSize = commandList->getCmdContainer().getCommandStream()->getMaxAvailableSpace() - (maxImmediateCommandSize + eventWaitSize) + 1; - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); - commandList->commandContainer.getCommandStream()->getGraphicsAllocation()->updateTaskCount(0u, 0u); - commandList->commandContainer.getCommandStream()->getSpace(useSize); + commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->updateTaskCount(0u, 0u); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); reinterpret_cast *>(commandList.get())->checkAvailableSpace(numEvents, false); - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); - commandList->commandContainer.getCommandStream()->getSpace(useSize); - auto latestFlushedTaskCount = commandList->csr->peekLatestFlushedTaskCount(); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); + auto latestFlushedTaskCount = whiteBoxCmdList->csr->peekLatestFlushedTaskCount(); reinterpret_cast *>(commandList.get())->checkAvailableSpace(numEvents, false); - EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size()); - EXPECT_EQ(latestFlushedTaskCount + 1, commandList->csr->peekLatestFlushedTaskCount()); + EXPECT_EQ(1U, commandList->getCmdContainer().getCmdBufferAllocations().size()); + EXPECT_EQ(latestFlushedTaskCount + 1, whiteBoxCmdList->csr->peekLatestFlushedTaskCount()); } HWTEST_F(CommandListCreate, givenCommandListWhenRemoveDeallocationContainerDataThenHeapNotErased) { @@ -1937,7 +1943,7 @@ HWTEST_F(CommandListCreate, givenCommandListWhenRemoveDeallocationContainerDataT NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &cmdContainer = commandList->commandContainer; + auto &cmdContainer = commandList->getCmdContainer(); auto heapAlloc = cmdContainer.getIndirectHeapAllocation(HeapType::INDIRECT_OBJECT); cmdContainer.getDeallocationContainer().push_back(heapAlloc); EXPECT_EQ(cmdContainer.getDeallocationContainer().size(), 1u); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp index 17e16e7600..7ccf049d9a 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_barrier.cpp @@ -22,17 +22,17 @@ using CommandListAppendBarrier = Test; HWTEST_F(CommandListAppendBarrier, WhenAppendingBarrierThenPipeControlIsGenerated) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); auto result = commandList->appendBarrier(nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceBefore), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceBefore), usedSpaceAfter - usedSpaceBefore)); // Find a PC w/ CS stall @@ -45,32 +45,32 @@ HWTEST_F(CommandListAppendBarrier, WhenAppendingBarrierThenPipeControlIsGenerate HWTEST_F(CommandListAppendBarrier, GivenEventVsNoEventWhenAppendingBarrierThenCorrectPipeControlsIsAddedToCommandStream) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); commandList->reset(); auto result = commandList->appendBarrier(event->toHandle(), 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList1, cmdList2; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList1, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor1 = findAll(cmdList1.begin(), cmdList1.end()); ASSERT_FALSE(itor1.empty()); commandList->reset(); - usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); result = commandList->appendBarrier(nullptr, 0, nullptr); - usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_EQ(ZE_RESULT_SUCCESS, result); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList2, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor2 = findAll(cmdList2.begin(), cmdList2.end()); ASSERT_FALSE(itor2.empty()); @@ -216,8 +216,8 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, WhenAppendingBarrierThenPipeControl sizeof(MI_STORE_DATA_IMM) + sizeof(MI_ATOMIC) + NEO::EncodeSempahore::getSizeMiSemaphoreWait(); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - auto gpuBaseAddress = commandList->commandContainer.getCommandStream()->getGraphicsAllocation()->getGpuAddress() + + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); + auto gpuBaseAddress = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation()->getGpuAddress() + usedSpaceBefore; auto gpuCrossTileSyncAddress = gpuBaseAddress + @@ -232,12 +232,12 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, WhenAppendingBarrierThenPipeControl auto result = commandList->appendBarrier(nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); size_t usedBuffer = usedSpaceAfter - usedSpaceBefore; EXPECT_EQ(expectedUseBuffer, usedBuffer); - void *cmdBuffer = ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceBefore); + void *cmdBuffer = ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceBefore); size_t parsedOffset = 0; validateMultiTileBarrier(cmdBuffer, parsedOffset, gpuFinalSyncAddress, gpuCrossTileSyncAddress, gpuStartAddress, true, true); @@ -257,7 +257,7 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, EXPECT_EQ(2u, device->getNEODevice()->getDeviceBitfield().count()); EXPECT_EQ(2u, commandList->partitionCount); - LinearStream *cmdListStream = commandList->commandContainer.getCommandStream(); + LinearStream *cmdListStream = commandList->getCmdContainer().getCommandStream(); size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + @@ -323,7 +323,7 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, EXPECT_EQ(2u, device->getNEODevice()->getDeviceBitfield().count()); EXPECT_EQ(2u, commandList->partitionCount); - LinearStream *cmdListStream = commandList->commandContainer.getCommandStream(); + LinearStream *cmdListStream = commandList->getCmdContainer().getCommandStream(); size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + @@ -429,7 +429,7 @@ HWTEST2_F(MultiTileCommandListAppendBarrier, EXPECT_EQ(2u, device->getNEODevice()->getDeviceBitfield().count()); EXPECT_EQ(2u, commandList->partitionCount); - LinearStream *cmdListStream = commandList->commandContainer.getCommandStream(); + LinearStream *cmdListStream = commandList->getCmdContainer().getCommandStream(); size_t beforeControlSectionOffset = sizeof(MI_STORE_DATA_IMM) + sizeof(PIPE_CONTROL) + @@ -523,7 +523,7 @@ HWTEST2_F(MultiTileImmediateCommandListAppendBarrier, EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); EXPECT_EQ(2u, immediateCommandList->partitionCount); - auto cmdStream = immediateCommandList->commandContainer.getCommandStream(); + auto cmdStream = immediateCommandList->getCmdContainer().getCommandStream(); constexpr size_t sizeBarrierCommands = sizeof(PIPE_CONTROL) + sizeof(MI_ATOMIC) + @@ -618,7 +618,7 @@ HWTEST2_F(MultiTileImmediateCommandListAppendBarrier, EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); EXPECT_EQ(2u, immediateCommandList->partitionCount); - auto cmdStream = immediateCommandList->commandContainer.getCommandStream(); + auto cmdStream = immediateCommandList->getCmdContainer().getCommandStream(); size_t usedBeforeSize = cmdStream->getUsed(); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp index c7133b5a39..6a25fc0926 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp @@ -30,17 +30,17 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenResetEventAppendedThenStor using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); auto result = commandList->appendEventReset(event->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto gpuAddress = event->getCompletionFieldGpuAddress(device); @@ -71,17 +71,17 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenResetEventWithTimeStampIsA auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result)); EXPECT_EQ(ZE_RESULT_SUCCESS, result); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); result = commandList->appendEventReset(event->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorPC = findAll(cmdList.begin(), cmdList.end()); @@ -130,16 +130,16 @@ HWTEST_F(CommandListAppendEventReset, whenResetEventIsAppendedAndNoSpaceIsAvaila using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; - auto firstBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto firstBatchBufferAllocation = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); - auto useSize = commandList->commandContainer.getCommandStream()->getAvailableSpace(); + auto useSize = commandList->getCmdContainer().getCommandStream()->getAvailableSpace(); useSize -= sizeof(MI_BATCH_BUFFER_END); - commandList->commandContainer.getCommandStream()->getSpace(useSize); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); auto result = commandList->appendEventReset(event->toHandle()); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto secondBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto secondBatchBufferAllocation = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); EXPECT_NE(firstBatchBufferAllocation, secondBatchBufferAllocation); } @@ -149,17 +149,17 @@ HWTEST_F(CommandListAppendEventReset, givenCopyOnlyCmdlistWhenResetEventAppended ze_result_t returnValue; commandList.reset(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue))); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); auto result = commandList->appendEventReset(event->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorPC = findAll(cmdList.begin(), cmdList.end()); @@ -183,7 +183,7 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenAppendingEventResetThenEve auto result = commandList->appendEventReset(event->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto &residencyContainer = commandList->commandContainer.getResidencyContainer(); + auto &residencyContainer = commandList->getCmdContainer().getResidencyContainer(); auto eventPoolAlloc = &eventPool->getAllocation(); for (auto alloc : eventPoolAlloc->getGraphicsAllocations()) { auto itor = @@ -268,7 +268,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, givenTimestampEventUsedInReset using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto &hwInfo = device->getHwInfo(); auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); @@ -323,7 +323,7 @@ HWTEST2_F(CommandListAppendEventReset, givenEventWithHostScopeUsedInResetThenPip using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -375,7 +375,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); size_t useSize = cmdStream->getAvailableSpace(); useSize -= sizeof(MI_BATCH_BUFFER_END); @@ -450,7 +450,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Copy, 0u); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); constexpr uint32_t packets = 2u; event->setPacketsInUse(packets); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index 8ee8c88f97..2f767447af 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -137,7 +137,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA ze_result_t returnValue; std::unique_ptr commandList(whiteboxCast(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); const auto stream = commandContainer.getCommandStream(); const auto streamCpu = stream->getCpuBase(); @@ -222,12 +222,15 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfUsedWhenAppendedToC } HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfWhenAppendedToSynchronousImmCommandListThenPrintfBufferIsPrinted) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.EnableFlushTaskSubmission.set(1); + ze_result_t returnValue; ze_command_queue_desc_t queueDesc = {}; queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue)); - commandList->isFlushTaskSubmissionEnabled = true; + Mock kernel; kernel.descriptor.kernelAttributes.flags.usesPrintf = true; @@ -247,12 +250,15 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfWhenAppendedToSynch } HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfWhenAppendedToAsynchronousImmCommandListThenPrintfBufferIsPrinted) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.EnableFlushTaskSubmission.set(1); + ze_result_t returnValue; ze_command_queue_desc_t queueDesc = {}; queueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue)); - commandList->isFlushTaskSubmissionEnabled = true; + Mock kernel; kernel.descriptor.kernelAttributes.flags.usesPrintf = true; @@ -272,6 +278,9 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfWhenAppendedToAsync } HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfWhenAppendToSynchronousImmCommandListHangsThenPrintfBufferIsPrinted) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.EnableFlushTaskSubmission.set(1); + ze_result_t returnValue; ze_command_queue_desc_t queueDesc = {}; queueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS; @@ -282,7 +291,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfWhenAppendToSynchro csr.returnWaitForCompletionWithTimeout = WaitStatus::GpuHang; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue)); - commandList->isFlushTaskSubmissionEnabled = true; + Mock kernel; kernel.descriptor.kernelAttributes.flags.usesPrintf = true; @@ -312,7 +321,7 @@ HWTEST_F(CommandListAppendLaunchKernel, WhenAppendingMultipleTimesThenSshIsNotDe ze_group_count_t groupCount{1, 1, 1}; auto kernelSshSize = kernel->getSurfaceStateHeapDataSize(); - auto ssh = commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE); + auto ssh = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::SURFACE_STATE); auto sshHeapSize = ssh->getMaxAvailableSpace(); auto initialAllocation = ssh->getGraphicsAllocation(); EXPECT_NE(nullptr, initialAllocation); @@ -338,7 +347,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel Mock<::L0::Kernel> kernel; ze_result_t returnValue; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; @@ -357,12 +366,12 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itor); @@ -414,10 +423,10 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel ASSERT_EQ(0u, numPCs.size()); { - auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()), - std::end(commandList->commandContainer.getResidencyContainer()), + auto itorEvent = std::find(std::begin(commandList->getCmdContainer().getResidencyContainer()), + std::end(commandList->getCmdContainer().getResidencyContainer()), &event->getAllocation(device)); - EXPECT_NE(itorEvent, std::end(commandList->commandContainer.getResidencyContainer())); + EXPECT_NE(itorEvent, std::end(commandList->getCmdContainer().getResidencyContainer())); } } @@ -430,7 +439,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelLaunchWithTSEventAndScopeFla Mock<::L0::Kernel> kernel; ze_result_t returnValue; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; @@ -452,12 +461,12 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelLaunchWithTSEventAndScopeFla kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorPC = findAll(cmdList.begin(), cmdList.end()); ASSERT_NE(0u, itorPC.size()); @@ -474,19 +483,19 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyTh ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandListBase(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceBefore = commandListBase->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandListBase->getCmdContainer().getCommandStream()->getUsed(); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; result = commandListBase->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandListBase->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandListBase->getCmdContainer().getCommandStream()->getUsed(); EXPECT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdListBase; EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdListBase, ptrOffset(commandListBase->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdListBase, ptrOffset(commandListBase->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorPC = findAll(cmdListBase.begin(), cmdListBase.end()); @@ -497,17 +506,17 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyTh std::unique_ptr commandListWithDebugKey(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - usedSpaceBefore = commandListWithDebugKey->commandContainer.getCommandStream()->getUsed(); + usedSpaceBefore = commandListWithDebugKey->getCmdContainer().getCommandStream()->getUsed(); result = commandListWithDebugKey->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - usedSpaceAfter = commandListWithDebugKey->commandContainer.getCommandStream()->getUsed(); + usedSpaceAfter = commandListWithDebugKey->getCmdContainer().getCommandStream()->getUsed(); EXPECT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdListBaseWithDebugKey; EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdListBaseWithDebugKey, ptrOffset(commandListWithDebugKey->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdListBaseWithDebugKey, ptrOffset(commandListWithDebugKey->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); itorPC = findAll(cmdListBaseWithDebugKey.begin(), cmdListBaseWithDebugKey.end()); @@ -527,18 +536,18 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenForcePipeControlPriorToWalkerKeyAn std::unique_ptr commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result)); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto firstBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto firstBatchBufferAllocation = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); - auto useSize = commandList->commandContainer.getCommandStream()->getAvailableSpace(); + auto useSize = commandList->getCmdContainer().getCommandStream()->getAvailableSpace(); useSize -= sizeof(PIPE_CONTROL); - commandList->commandContainer.getCommandStream()->getSpace(useSize); + commandList->getCmdContainer().getCommandStream()->getSpace(useSize); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto secondBatchBufferAllocation = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto secondBatchBufferAllocation = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); EXPECT_NE(firstBatchBufferAllocation, secondBatchBufferAllocation); } @@ -603,7 +612,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenIndirectDispatchWhenAppendingThenWo GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(itor, cmdList.end()); @@ -677,11 +686,11 @@ HWTEST_F(CommandListAppendLaunchKernel, givenCommandListWhenResetCalledThenState ze_result_t returnValue; auto commandList = std::unique_ptr(whiteboxCast(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); ASSERT_NE(nullptr, commandList); - ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); + ASSERT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); auto commandListControl = std::unique_ptr(whiteboxCast(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue))); ASSERT_NE(nullptr, commandListControl); - ASSERT_NE(nullptr, commandListControl->commandContainer.getCommandStream()); + ASSERT_NE(nullptr, commandListControl->getCmdContainer().getCommandStream()); ze_group_count_t groupCount{1, 1, 1}; CmdListKernelLaunchParams launchParams = {}; @@ -696,40 +705,40 @@ HWTEST_F(CommandListAppendLaunchKernel, givenCommandListWhenResetCalledThenState ASSERT_EQ(ZE_RESULT_SUCCESS, result); ASSERT_EQ(device, commandList->device); - ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); - ASSERT_GE(commandListControl->commandContainer.getCmdBufferAllocations()[0]->getUnderlyingBufferSize(), commandList->commandContainer.getCmdBufferAllocations()[0]->getUnderlyingBufferSize()); - ASSERT_EQ(commandListControl->commandContainer.getResidencyContainer().size(), - commandList->commandContainer.getResidencyContainer().size()); - ASSERT_EQ(commandListControl->commandContainer.getDeallocationContainer().size(), - commandList->commandContainer.getDeallocationContainer().size()); + ASSERT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); + ASSERT_GE(commandListControl->getCmdContainer().getCmdBufferAllocations()[0]->getUnderlyingBufferSize(), commandList->getCmdContainer().getCmdBufferAllocations()[0]->getUnderlyingBufferSize()); + ASSERT_EQ(commandListControl->getCmdContainer().getResidencyContainer().size(), + commandList->getCmdContainer().getResidencyContainer().size()); + ASSERT_EQ(commandListControl->getCmdContainer().getDeallocationContainer().size(), + commandList->getCmdContainer().getDeallocationContainer().size()); ASSERT_EQ(commandListControl->getPrintfKernelContainer().size(), commandList->getPrintfKernelContainer().size()); - ASSERT_EQ(commandListControl->commandContainer.getCommandStream()->getUsed(), commandList->commandContainer.getCommandStream()->getUsed()); - ASSERT_EQ(commandListControl->commandContainer.slmSize, commandList->commandContainer.slmSize); + ASSERT_EQ(commandListControl->getCmdContainer().getCommandStream()->getUsed(), commandList->getCmdContainer().getCommandStream()->getUsed()); + ASSERT_EQ(commandListControl->getCmdContainer().slmSize, commandList->getCmdContainer().slmSize); for (uint32_t i = 0; i < NEO::HeapType::NUM_TYPES; i++) { auto heapType = static_cast(i); if (NEO::HeapType::DYNAMIC_STATE == heapType && !device->getHwInfo().capabilityTable.supportsImages) { - ASSERT_EQ(nullptr, commandListControl->commandContainer.getIndirectHeapAllocation(heapType)); - ASSERT_EQ(nullptr, commandListControl->commandContainer.getIndirectHeap(heapType)); + ASSERT_EQ(nullptr, commandListControl->getCmdContainer().getIndirectHeapAllocation(heapType)); + ASSERT_EQ(nullptr, commandListControl->getCmdContainer().getIndirectHeap(heapType)); } else { - ASSERT_NE(nullptr, commandListControl->commandContainer.getIndirectHeapAllocation(heapType)); - ASSERT_NE(nullptr, commandList->commandContainer.getIndirectHeapAllocation(heapType)); - ASSERT_EQ(commandListControl->commandContainer.getIndirectHeapAllocation(heapType)->getUnderlyingBufferSize(), - commandList->commandContainer.getIndirectHeapAllocation(heapType)->getUnderlyingBufferSize()); + ASSERT_NE(nullptr, commandListControl->getCmdContainer().getIndirectHeapAllocation(heapType)); + ASSERT_NE(nullptr, commandList->getCmdContainer().getIndirectHeapAllocation(heapType)); + ASSERT_EQ(commandListControl->getCmdContainer().getIndirectHeapAllocation(heapType)->getUnderlyingBufferSize(), + commandList->getCmdContainer().getIndirectHeapAllocation(heapType)->getUnderlyingBufferSize()); - ASSERT_NE(nullptr, commandListControl->commandContainer.getIndirectHeap(heapType)); - ASSERT_NE(nullptr, commandList->commandContainer.getIndirectHeap(heapType)); - ASSERT_EQ(commandListControl->commandContainer.getIndirectHeap(heapType)->getUsed(), - commandList->commandContainer.getIndirectHeap(heapType)->getUsed()); + ASSERT_NE(nullptr, commandListControl->getCmdContainer().getIndirectHeap(heapType)); + ASSERT_NE(nullptr, commandList->getCmdContainer().getIndirectHeap(heapType)); + ASSERT_EQ(commandListControl->getCmdContainer().getIndirectHeap(heapType)->getUsed(), + commandList->getCmdContainer().getIndirectHeap(heapType)->getUsed()); - ASSERT_EQ(commandListControl->commandContainer.isHeapDirty(heapType), commandList->commandContainer.isHeapDirty(heapType)); + ASSERT_EQ(commandListControl->getCmdContainer().isHeapDirty(heapType), commandList->getCmdContainer().isHeapDirty(heapType)); } } GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -751,7 +760,7 @@ HWTEST_F(CommandListAppendLaunchKernel, WhenAddingKernelsThenResidencyContainerD commandList->close(); uint32_t it = 0; - const auto &residencyCont = commandList->commandContainer.getResidencyContainer(); + const auto &residencyCont = commandList->getCmdContainer().getResidencyContainer(); for (auto alloc : residencyCont) { auto occurences = std::count(residencyCont.begin(), residencyCont.end(), alloc); EXPECT_EQ(1U, static_cast(occurences)) << it; @@ -765,8 +774,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenSingleValidWaitEventsThenAddSemapho ze_result_t returnValue; auto commandList = std::unique_ptr(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + ASSERT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; @@ -785,12 +794,12 @@ HWTEST_F(CommandListAppendLaunchKernel, givenSingleValidWaitEventsThenAddSemapho auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 1, &hEventHandle, launchParams, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itor); @@ -814,8 +823,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenMultipleValidWaitEventsThenAddSemap ze_result_t returnValue; auto commandList = std::unique_ptr(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + ASSERT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; @@ -843,12 +852,12 @@ HWTEST_F(CommandListAppendLaunchKernel, givenMultipleValidWaitEventsThenAddSemap auto result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 2, waitEvents, launchParams, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; auto itor = findAll(cmdList.begin(), cmdList.end()); ASSERT_FALSE(itor.empty()); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp index 59d17e340b..f911c5c272 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_2.cpp @@ -95,7 +95,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); uint32_t regAddress = 0; uint64_t gpuAddress = 0; @@ -143,7 +143,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor auto groupCountStoreRegisterMemCmd = FamilyType::cmdInitStoreRegisterMem; groupCountStoreRegisterMemCmd.setRegisterAddress(GPUGPU_DISPATCHDIMX); - groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupXOffset); + groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupXOffset); EXPECT_EQ(cmd2->getRegisterAddress(), groupCountStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), groupCountStoreRegisterMemCmd.getMemoryAddress()); @@ -153,7 +153,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor cmd2 = genCmdCast(*itor); groupCountStoreRegisterMemCmd.setRegisterAddress(GPUGPU_DISPATCHDIMY); - groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupYOffset); + groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupYOffset); EXPECT_EQ(cmd2->getRegisterAddress(), groupCountStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), groupCountStoreRegisterMemCmd.getMemoryAddress()); @@ -163,7 +163,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor cmd2 = genCmdCast(*itor); groupCountStoreRegisterMemCmd.setRegisterAddress(GPUGPU_DISPATCHDIMZ); - groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupZOffset); + groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupZOffset); EXPECT_EQ(cmd2->getRegisterAddress(), groupCountStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), groupCountStoreRegisterMemCmd.getMemoryAddress()); @@ -180,7 +180,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor EXPECT_NE(cmdList.end(), itor); cmd2 = genCmdCast(*itor); - workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeXOffset); + workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeXOffset); EXPECT_EQ(cmd2->getRegisterAddress(), workSizeStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), workSizeStoreRegisterMemCmd.getMemoryAddress()); @@ -193,7 +193,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor EXPECT_NE(cmdList.end(), itor); cmd2 = genCmdCast(*itor); - workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeYOffset); + workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeYOffset); EXPECT_EQ(cmd2->getRegisterAddress(), workSizeStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), workSizeStoreRegisterMemCmd.getMemoryAddress()); @@ -209,7 +209,7 @@ HWTEST_F(CommandListDualStorage, givenIndirectDispatchWithSharedDualStorageMemor EXPECT_NE(cmdList.end(), itor); cmd2 = genCmdCast(*itor); - workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeZOffset); + workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeZOffset); EXPECT_EQ(cmd2->getRegisterAddress(), workSizeStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), workSizeStoreRegisterMemCmd.getMemoryAddress()); @@ -267,7 +267,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); uint32_t regAddress = 0; uint64_t gpuAddress = 0; @@ -315,7 +315,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh auto groupCountStoreRegisterMemCmd = FamilyType::cmdInitStoreRegisterMem; groupCountStoreRegisterMemCmd.setRegisterAddress(GPUGPU_DISPATCHDIMX); - groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupXOffset - sizeof(INLINE_DATA)); + groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupXOffset - sizeof(INLINE_DATA)); EXPECT_EQ(cmd2->getRegisterAddress(), groupCountStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), groupCountStoreRegisterMemCmd.getMemoryAddress()); @@ -325,7 +325,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh cmd2 = genCmdCast(*itor); groupCountStoreRegisterMemCmd.setRegisterAddress(GPUGPU_DISPATCHDIMY); - groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupYOffset - sizeof(INLINE_DATA)); + groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupYOffset - sizeof(INLINE_DATA)); EXPECT_EQ(cmd2->getRegisterAddress(), groupCountStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), groupCountStoreRegisterMemCmd.getMemoryAddress()); @@ -335,7 +335,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh cmd2 = genCmdCast(*itor); groupCountStoreRegisterMemCmd.setRegisterAddress(GPUGPU_DISPATCHDIMZ); - groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupZOffset - sizeof(INLINE_DATA)); + groupCountStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + numWorkGroupZOffset - sizeof(INLINE_DATA)); EXPECT_EQ(cmd2->getRegisterAddress(), groupCountStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), groupCountStoreRegisterMemCmd.getMemoryAddress()); @@ -352,7 +352,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh EXPECT_NE(cmdList.end(), itor); cmd2 = genCmdCast(*itor); - workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeXOffset - sizeof(INLINE_DATA)); + workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeXOffset - sizeof(INLINE_DATA)); EXPECT_EQ(cmd2->getRegisterAddress(), workSizeStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), workSizeStoreRegisterMemCmd.getMemoryAddress()); @@ -365,7 +365,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh EXPECT_NE(cmdList.end(), itor); cmd2 = genCmdCast(*itor); - workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeYOffset - sizeof(INLINE_DATA)); + workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeYOffset - sizeof(INLINE_DATA)); EXPECT_EQ(cmd2->getRegisterAddress(), workSizeStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), workSizeStoreRegisterMemCmd.getMemoryAddress()); @@ -381,7 +381,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListDualStorage, givenIndirectDispatchWithSh EXPECT_NE(cmdList.end(), itor); cmd2 = genCmdCast(*itor); - workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeZOffset - sizeof(INLINE_DATA)); + workSizeStoreRegisterMemCmd.setMemoryAddress(commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->getGpuAddress() + globalWorkSizeZOffset - sizeof(INLINE_DATA)); EXPECT_EQ(cmd2->getRegisterAddress(), workSizeStoreRegisterMemCmd.getRegisterAddress()); EXPECT_EQ(cmd2->getMemoryAddress(), workSizeStoreRegisterMemCmd.getMemoryAddress()); @@ -396,7 +396,7 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendLaunchK ze_group_count_t groupCount{1, 1, 1}; ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = cmdStream->getUsed(); @@ -467,7 +467,7 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendEventRe ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = cmdStream->getUsed(); @@ -541,7 +541,7 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendSignalE ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = cmdStream->getUsed(); @@ -615,7 +615,7 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendWaitOnE ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = cmdStream->getUsed(); @@ -689,7 +689,7 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendMemoryC ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = cmdStream->getUsed(); @@ -746,7 +746,7 @@ HWTEST_F(CommandListAppendLaunchKernelSWTags, givenEnableSWTagsWhenAppendMemoryC ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto usedSpaceBefore = cmdStream->getUsed(); @@ -814,12 +814,12 @@ HWTEST_F(CommandListArbitrationPolicyTest, whenCreatingCommandListThenDefaultThr 0u, returnValue))); EXPECT_NE(nullptr, commandList); - EXPECT_NE(nullptr, commandList->commandContainer.getCommandStream()); + EXPECT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); GenCmdList parsedCommandList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - parsedCommandList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), - commandList->commandContainer.getCommandStream()->getUsed())); + parsedCommandList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), + commandList->getCmdContainer().getCommandStream()->getUsed())); using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; auto miLoadImm = findAll(parsedCommandList.begin(), parsedCommandList.end()); @@ -846,12 +846,12 @@ HWTEST_F(CommandListArbitrationPolicyTest, whenCreatingCommandListThenChosenThre 0u, returnValue))); EXPECT_NE(nullptr, commandList); - EXPECT_NE(nullptr, commandList->commandContainer.getCommandStream()); + EXPECT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); GenCmdList parsedCommandList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - parsedCommandList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), - commandList->commandContainer.getCommandStream()->getUsed())); + parsedCommandList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), + commandList->getCmdContainer().getCommandStream()->getUsed())); using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; auto miLoadImm = findAll(parsedCommandList.begin(), parsedCommandList.end()); @@ -876,14 +876,14 @@ HWTEST_F(CommandListArbitrationPolicyTest, whenCommandListIsResetThenOriginalThr 0u, returnValue))); EXPECT_NE(nullptr, commandList); - EXPECT_NE(nullptr, commandList->commandContainer.getCommandStream()); + EXPECT_NE(nullptr, commandList->getCmdContainer().getCommandStream()); uint64_t originalThreadArbitrationPolicy = std::numeric_limits::max(); { GenCmdList parsedCommandList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - parsedCommandList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), - commandList->commandContainer.getCommandStream()->getUsed())); + parsedCommandList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), + commandList->getCmdContainer().getCommandStream()->getUsed())); using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; auto miLoadImm = findAll(parsedCommandList.begin(), parsedCommandList.end()); @@ -904,8 +904,8 @@ HWTEST_F(CommandListArbitrationPolicyTest, whenCommandListIsResetThenOriginalThr { GenCmdList parsedCommandList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - parsedCommandList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), - commandList->commandContainer.getCommandStream()->getUsed())); + parsedCommandList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), + commandList->getCmdContainer().getCommandStream()->getUsed())); using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM; auto miLoadImm = findAll(parsedCommandList.begin(), parsedCommandList.end()); @@ -983,7 +983,7 @@ struct CmdlistAppendLaunchKernelWithImplicitArgsTests : CmdlistAppendLaunchKerne EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto indirectHeap = commandList->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); + auto indirectHeap = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); indirectHeapAllocation = indirectHeap->getGraphicsAllocation(); ze_group_count_t groupCount{expectedImplicitArgs.groupCountX, expectedImplicitArgs.groupCountY, expectedImplicitArgs.groupCountZ}; @@ -1136,7 +1136,7 @@ HWTEST_F(CmdlistAppendLaunchKernelTests, givenKernelWithoutImplicitArgsWhenAppen result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto indirectHeap = commandList->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); + auto indirectHeap = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT); auto sizeCrossThreadData = kernel->getCrossThreadDataSize(); auto sizePerThreadDataForWholeGroup = kernel->getPerThreadDataSizeForWholeThreadGroup(); @@ -1187,33 +1187,33 @@ HWTEST_F(CmdlistAppendLaunchKernelTests, whenEncodingWorkDimForIndirectDispatchT { uint32_t groupSize[] = {1, 1, 1}; auto estimate = EncodeIndirectParams::getCmdsSizeForSetWorkDimIndirect(groupSize, false); - auto sizeBefore = commandList->commandContainer.getCommandStream()->getUsed(); - EncodeIndirectParams::setWorkDimIndirect(commandList->commandContainer, 0x4, 0u, groupSize); - auto sizeAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto sizeBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); + EncodeIndirectParams::setWorkDimIndirect(commandList->getCmdContainer(), 0x4, 0u, groupSize); + auto sizeAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_LE(sizeAfter - sizeBefore, estimate); } { uint32_t groupSize[] = {1, 1, 2}; auto estimate = EncodeIndirectParams::getCmdsSizeForSetWorkDimIndirect(groupSize, false); - auto sizeBefore = commandList->commandContainer.getCommandStream()->getUsed(); - EncodeIndirectParams::setWorkDimIndirect(commandList->commandContainer, 0x4, 0u, groupSize); - auto sizeAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto sizeBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); + EncodeIndirectParams::setWorkDimIndirect(commandList->getCmdContainer(), 0x4, 0u, groupSize); + auto sizeAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_LE(sizeAfter - sizeBefore, estimate); } { uint32_t groupSize[] = {1, 1, 1}; auto estimate = EncodeIndirectParams::getCmdsSizeForSetWorkDimIndirect(groupSize, true); - auto sizeBefore = commandList->commandContainer.getCommandStream()->getUsed(); - EncodeIndirectParams::setWorkDimIndirect(commandList->commandContainer, 0x2, 0u, groupSize); - auto sizeAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto sizeBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); + EncodeIndirectParams::setWorkDimIndirect(commandList->getCmdContainer(), 0x2, 0u, groupSize); + auto sizeAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_LE(sizeAfter - sizeBefore, estimate); } { uint32_t groupSize[] = {1, 1, 2}; auto estimate = EncodeIndirectParams::getCmdsSizeForSetWorkDimIndirect(groupSize, true); - auto sizeBefore = commandList->commandContainer.getCommandStream()->getUsed(); - EncodeIndirectParams::setWorkDimIndirect(commandList->commandContainer, 0x2, 0u, groupSize); - auto sizeAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto sizeBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); + EncodeIndirectParams::setWorkDimIndirect(commandList->getCmdContainer(), 0x2, 0u, groupSize); + auto sizeAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_LE(sizeAfter - sizeBefore, estimate); } } @@ -1427,14 +1427,14 @@ HWTEST2_F(MultiTileCommandListAppendLaunchKernelXeHpCoreTest, givenCooperativeKe auto commandListWithNonCooperativeKernel = std::make_unique>>(); auto result = commandListWithNonCooperativeKernel->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto sizeBefore = commandListWithNonCooperativeKernel->commandContainer.getCommandStream()->getUsed(); + auto sizeBefore = commandListWithNonCooperativeKernel->getCmdContainer().getCommandStream()->getUsed(); CmdListKernelLaunchParams launchParams = {}; result = commandListWithNonCooperativeKernel->appendLaunchKernelWithParams(kernel.get(), &groupCount, nullptr, launchParams); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto sizeAfter = commandListWithNonCooperativeKernel->commandContainer.getCommandStream()->getUsed(); + auto sizeAfter = commandListWithNonCooperativeKernel->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandListWithNonCooperativeKernel->commandContainer.getCommandStream()->getCpuBase(), sizeBefore), sizeAfter - sizeBefore)); + cmdList, ptrOffset(commandListWithNonCooperativeKernel->getCmdContainer().getCommandStream()->getCpuBase(), sizeBefore), sizeAfter - sizeBefore)); auto itorWalker = find(cmdList.begin(), cmdList.end()); auto cmd = genCmdCast(*itorWalker); EXPECT_TRUE(cmd->getWorkloadPartitionEnable()); @@ -1443,14 +1443,14 @@ HWTEST2_F(MultiTileCommandListAppendLaunchKernelXeHpCoreTest, givenCooperativeKe auto commandListWithCooperativeKernel = std::make_unique>>(); result = commandListWithCooperativeKernel->initialize(device, NEO::EngineGroupType::RenderCompute, 0u); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - sizeBefore = commandListWithCooperativeKernel->commandContainer.getCommandStream()->getUsed(); + sizeBefore = commandListWithCooperativeKernel->getCmdContainer().getCommandStream()->getUsed(); launchParams.isCooperative = true; result = commandListWithCooperativeKernel->appendLaunchKernelWithParams(kernel.get(), &groupCount, nullptr, launchParams); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - sizeAfter = commandListWithCooperativeKernel->commandContainer.getCommandStream()->getUsed(); + sizeAfter = commandListWithCooperativeKernel->getCmdContainer().getCommandStream()->getUsed(); cmdList.clear(); ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandListWithCooperativeKernel->commandContainer.getCommandStream()->getCpuBase(), sizeBefore), sizeAfter - sizeBefore)); + cmdList, ptrOffset(commandListWithCooperativeKernel->getCmdContainer().getCommandStream()->getCpuBase(), sizeBefore), sizeAfter - sizeBefore)); itorWalker = find(cmdList.begin(), cmdList.end()); cmd = genCmdCast(*itorWalker); @@ -1466,7 +1466,7 @@ HWTEST2_F(MultiTileCommandListAppendLaunchKernelXeHpCoreTest, ze_group_count_t groupCount{128, 1, 1}; - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); auto sizeBefore = cmdStream->getUsed(); CmdListKernelLaunchParams launchParams = {}; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp index 2b5b3e279e..3e65d47992 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp @@ -50,7 +50,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenFunctionWhenBind CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); - auto commandStream = commandList->commandContainer.getCommandStream(); + auto commandStream = commandList->getCmdContainer().getCommandStream(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandStream->getCpuBase(), commandStream->getUsed())); @@ -61,7 +61,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenFunctionWhenBind auto cmd = genCmdCast(*itorMIDL); ASSERT_NE(cmd, nullptr); - auto dsh = NEO::ApiSpecificConfig::getBindlessConfiguration() ? device->getNEODevice()->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::GLOBAL_DSH) : commandList->commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); + auto dsh = NEO::ApiSpecificConfig::getBindlessConfiguration() ? device->getNEODevice()->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::GLOBAL_DSH) : commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); auto idd = static_cast(ptrOffset(dsh->getCpuBase(), cmd->getInterfaceDescriptorDataStartAddress())); if (NEO::EncodeSurfaceState::doBindingTablePrefetch()) { @@ -81,7 +81,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenEventsWhenAppend Mock<::L0::Kernel> kernel; ze_result_t returnValue; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; eventPoolDesc.count = 1; @@ -99,12 +99,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenEventsWhenAppend kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itor); @@ -126,10 +126,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenEventsWhenAppend EXPECT_TRUE(postSyncFound); { - auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()), - std::end(commandList->commandContainer.getResidencyContainer()), + auto itorEvent = std::find(std::begin(commandList->getCmdContainer().getResidencyContainer()), + std::end(commandList->getCmdContainer().getResidencyContainer()), &event->getAllocation(device)); - EXPECT_NE(itorEvent, std::end(commandList->commandContainer.getResidencyContainer())); + EXPECT_NE(itorEvent, std::end(commandList->getCmdContainer().getResidencyContainer())); } } @@ -147,11 +147,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult result = commandList->appendLaunchMultipleKernelsIndirect(1, &launchKernels, numLaunchArgs, nullptr, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); *numLaunchArgs = 0; - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorWalker = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itorWalker); @@ -176,11 +176,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult result = commandList->appendLaunchMultipleKernelsIndirect(numKernels, launchKernels, numLaunchArgs, nullptr, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); *numLaunchArgs = 2; - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = cmdList.begin(); @@ -211,8 +211,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendingL NEO::EngineGroupType::RenderCompute, result)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); ze_group_count_t groupCount{1, 1, 1}; @@ -238,8 +239,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendingL NEO::EngineGroupType::RenderCompute, result)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); ze_group_count_t groupCount{1, 1, 1}; @@ -384,8 +386,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendingL NEO::EngineGroupType::RenderCompute, result)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); ze_group_count_t groupCount{1, 1, 1}; @@ -410,8 +413,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendingL NEO::EngineGroupType::RenderCompute, result)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); - CommandQueueImp *cmdQueue = reinterpret_cast(commandList0->cmdQImmediate); + CommandQueueImp *cmdQueue = reinterpret_cast(whiteBoxCmdList->cmdQImmediate); EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver); ze_group_count_t groupCount{1, 1, 1}; @@ -595,7 +599,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenA ze_command_queue_desc_t queueDesc = {}; std::unique_ptr commandList(whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue))); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); const auto stream = commandContainer.getCommandStream(); const auto streamCpu = stream->getCpuBase(); @@ -694,7 +698,7 @@ HWTEST_F(CommandListAppendLaunchKernelWithImplicitArgs, givenIndirectDispatchWit static_cast(alloc), nullptr, 0, nullptr, false); EXPECT_EQ(result, ZE_RESULT_SUCCESS); - auto heap = commandList->commandContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT); + auto heap = commandList->getCmdContainer().getIndirectHeap(HeapType::INDIRECT_OBJECT); uint64_t pImplicitArgsGPUVA = heap->getGraphicsAllocation()->getGpuAddress() + getIndirectHeapOffsetForImplicitArgsBuffer(kernel); auto workDimStoreRegisterMemCmd = FamilyType::cmdInitStoreRegisterMem; @@ -727,7 +731,7 @@ HWTEST_F(CommandListAppendLaunchKernelWithImplicitArgs, givenIndirectDispatchWit GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(itor, cmdList.end()); @@ -868,7 +872,7 @@ HWTEST2_F(MultiTileImmediateCommandListAppendLaunchKernelXeHpCoreTest, givenImpl result = immediateCmdList->appendLaunchKernelWithParams(kernel.get(), &groupCount, nullptr, launchParams); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto cmdStream = immediateCmdList->commandContainer.getCommandStream(); + auto cmdStream = immediateCmdList->getCmdContainer().getCommandStream(); auto sizeBefore = cmdStream->getUsed(); result = immediateCmdList->appendLaunchKernelWithParams(kernel.get(), &groupCount, nullptr, launchParams); @@ -926,7 +930,7 @@ HWTEST2_F(MultiTileImmediateCommandListAppendLaunchKernelXeHpCoreTest, givenImpl auto result = immediateCmdList->initialize(device, NEO::EngineGroupType::Compute, 0u); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto cmdStream = immediateCmdList->commandContainer.getCommandStream(); + auto cmdStream = immediateCmdList->getCmdContainer().getCommandStream(); auto sizeBefore = cmdStream->getUsed(); CmdListKernelLaunchParams launchParams = {}; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_multipartition_prologue.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_multipartition_prologue.cpp index 09e664a6ce..d0d586d8f3 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_multipartition_prologue.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_multipartition_prologue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,7 +23,7 @@ HWTEST2_F(MultiPartitionPrologueTest, whenAppendMultiPartitionPrologueIsCalledTh ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); @@ -57,7 +57,7 @@ HWTEST2_F(MultiPartitionPrologueTest, whenAppendMultiPartitionPrologueIsCalledTh HWTEST2_F(MultiPartitionPrologueTest, whenAppendMultiPartitionPrologueIsCalledThenCommandListIsNotUpdated, IsAtMostGen12lp) { ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); @@ -78,7 +78,7 @@ HWTEST2_F(MultiPartitionEpilogueTest, whenAppendMultiPartitionEpilogueIsCalledTh ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); @@ -109,7 +109,7 @@ HWTEST2_F(MultiPartitionEpilogueTest, whenAppendMultiPartitionPrologueIsCalledTh ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp index 8a23fcde37..93f58f3292 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp @@ -28,16 +28,16 @@ HWTEST_F(CommandListAppendSignalEvent, WhenAppendingSignalEventWithoutScopeThenM using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); auto result = commandList->appendSignalEvent(event->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto baseAddr = event->getCompletionFieldGpuAddress(device); auto itor = find(cmdList.begin(), cmdList.end()); @@ -50,7 +50,7 @@ HWTEST_F(CommandListAppendSignalEvent, givenCmdlistWhenAppendingSignalEventThenE auto result = commandList->appendSignalEvent(event->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto &residencyContainer = commandList->commandContainer.getResidencyContainer(); + auto &residencyContainer = commandList->getCmdContainer().getResidencyContainer(); auto eventPoolAlloc = &eventPool->getAllocation(); for (auto alloc : eventPoolAlloc->getGraphicsAllocations()) { auto itor = @@ -76,16 +76,16 @@ HWTEST_F(CommandListAppendSignalEvent, givenEventWithScopeFlagDeviceWhenAppendin EXPECT_EQ(ZE_RESULT_SUCCESS, result); auto eventHostVisible = std::unique_ptr(Event::create(eventPoolHostVisible.get(), &eventDesc, device)); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); result = commandList->appendSignalEvent(eventHostVisible->toHandle()); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorPC = findAll(cmdList.begin(), cmdList.end()); @@ -106,7 +106,7 @@ HWTEST_F(CommandListAppendSignalEvent, givenEventWithScopeFlagDeviceWhenAppendin HWTEST2_F(CommandListAppendSignalEvent, givenCommandListWhenAppendWriteGlobalTimestampCalledWithSignalEventThenPipeControlForTimestampAndSignalEncoded, IsAtLeastSkl) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); uint64_t timestampAddress = 0x12345678555500; uint64_t *dstptr = reinterpret_cast(timestampAddress); @@ -149,7 +149,7 @@ HWTEST2_F(CommandListAppendSignalEvent, givenTimestampEventUsedInSignalThenPipeC using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -194,7 +194,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); size_t useSize = cmdStream->getAvailableSpace(); useSize -= sizeof(MI_BATCH_BUFFER_END); @@ -247,7 +247,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); size_t useSize = cmdStream->getAvailableSpace(); useSize -= sizeof(MI_BATCH_BUFFER_END); @@ -305,7 +305,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); size_t useSize = cmdStream->getAvailableSpace(); useSize -= sizeof(MI_BATCH_BUFFER_END); @@ -354,7 +354,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, givenMultiTileCommandListWhenAppendWriteGlobalTimestampCalledWithSignalEventThenWorkPartitionedRegistersAreUsed, IsAtLeastXeHpCore) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); uint64_t timestampAddress = 0x12345678555500; uint64_t *dstptr = reinterpret_cast(timestampAddress); @@ -433,7 +433,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Copy, 0u); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); event->setEventTimestampFlag(true); @@ -474,7 +474,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Copy, 0u); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); event->setEventTimestampFlag(false); @@ -517,7 +517,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Copy, 0u); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - auto cmdStream = commandList->commandContainer.getCommandStream(); + auto cmdStream = commandList->getCmdContainer().getCommandStream(); event->setEventTimestampFlag(false); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp index 6ba9b5f47c..55add36e46 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp @@ -29,17 +29,17 @@ using CommandListAppendWaitOnUsedPacketSignalEvent = TestcommandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_handle_t hEventHandle = event->toHandle(); auto result = commandList->appendWaitOnEvents(1, &hEventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); @@ -78,8 +78,9 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ze_result_t returnValue; std::unique_ptr immCommandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, immCommandList); + auto whiteBoxCmdList = static_cast(immCommandList.get()); - auto ultCsr = static_cast *>(immCommandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); auto directSubmission = new MockDirectSubmissionHw>(*ultCsr); ultCsr->directSubmission.reset(directSubmission); @@ -88,11 +89,11 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio auto result = static_cast *>(immCommandList.get())->addEventsToCmdList(1, &hEventHandle, true, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = immCommandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = immCommandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - immCommandList->commandContainer.getCommandStream()->getCpuBase(), + immCommandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); @@ -173,8 +174,9 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ze_result_t returnValue; std::unique_ptr immCommandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, immCommandList); + auto whiteBoxCmdList = static_cast(immCommandList.get()); - auto ultCsr = static_cast *>(immCommandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); auto directSubmission = new MockDirectSubmissionHw>(*ultCsr); ultCsr->directSubmission.reset(directSubmission); @@ -184,11 +186,11 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = immCommandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = immCommandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - immCommandList->commandContainer.getCommandStream()->getCpuBase(), + immCommandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); @@ -206,8 +208,9 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ze_result_t returnValue; std::unique_ptr immCommandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, immCommandList); + auto whiteBoxCmdList = static_cast(immCommandList.get()); - auto ultCsr = static_cast *>(immCommandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); auto directSubmission = new MockDirectSubmissionHw>(*ultCsr); ultCsr->directSubmission.reset(directSubmission); @@ -217,11 +220,11 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = immCommandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = immCommandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - immCommandList->commandContainer.getCommandStream()->getCpuBase(), + immCommandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); @@ -242,8 +245,9 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ze_result_t returnValue; std::unique_ptr immCommandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, immCommandList); + auto whiteBoxCmdList = static_cast(immCommandList.get()); - auto ultCsr = static_cast *>(immCommandList->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); auto directSubmission = new MockDirectSubmissionHw>(*ultCsr); ultCsr->directSubmission.reset(directSubmission); @@ -253,11 +257,11 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = immCommandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = immCommandList->getCmdContainer().getCommandStream()->getUsed(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - immCommandList->commandContainer.getCommandStream()->getCpuBase(), + immCommandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); @@ -266,19 +270,19 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenImmediateCmdListWithDirectSubmissio HWTEST_F(CommandListAppendWaitOnEvent, givenTwoEventsWhenWaitOnEventsAppendedThenTwoSemaphoreWaitCmdsAreGenerated) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_handle_t handles[2] = {event->toHandle(), event->toHandle()}; auto result = commandList->appendWaitOnEvents(2, handles, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = findAll(cmdList.begin(), cmdList.end()); @@ -304,7 +308,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, WhenAppendingWaitOnEventsThenEventGraphic auto result = commandList->appendWaitOnEvents(1, &hEventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto &residencyContainer = commandList->commandContainer.getResidencyContainer(); + auto &residencyContainer = commandList->getCmdContainer().getResidencyContainer(); auto eventPoolAlloc = &eventPool->getAllocation(); for (auto alloc : eventPoolAlloc->getGraphicsAllocations()) { auto itor = @@ -316,7 +320,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, WhenAppendingWaitOnEventsThenEventGraphic HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppendingWaitOnEventThenPCWithDcFlushIsGenerated) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); const ze_event_desc_t eventDesc = { ZE_STRUCTURE_TYPE_EVENT_DESC, @@ -331,11 +335,11 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppe auto result = commandList->appendWaitOnEvents(1, &hEventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itor = find(cmdList.begin(), cmdList.end()); @@ -358,7 +362,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppe HWTEST_F(CommandListAppendWaitOnUsedPacketSignalEvent, WhenAppendingWaitOnTimestampEventWithThreePacketsThenSemaphoreWaitCmdIsGeneratedThreeTimes) { using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -375,14 +379,14 @@ HWTEST_F(CommandListAppendWaitOnUsedPacketSignalEvent, WhenAppendingWaitOnTimest ze_event_handle_t hEventHandle = event->toHandle(); result = commandList->appendWaitOnEvents(1, &hEventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); auto gpuAddress = event->getGpuAddress(device) + event->getContextEndOffset(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorSW = findAll(cmdList.begin(), cmdList.end()); @@ -414,7 +418,7 @@ HWTEST_F(CommandListAppendWaitOnUsedPacketSignalEvent, WhenAppendingWaitOnTimest ze_result_t result = ZE_RESULT_SUCCESS; commandList.reset(whiteboxCast(CommandList::create(device->getHwInfo().platform.eProductFamily, device, NEO::EngineGroupType::RenderCompute, 0u, result))); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -438,14 +442,14 @@ HWTEST_F(CommandListAppendWaitOnUsedPacketSignalEvent, WhenAppendingWaitOnTimest ze_event_handle_t hEventHandle = event->toHandle(); result = commandList->appendWaitOnEvents(1, &hEventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); auto gpuAddress = event->getGpuAddress(device) + event->getContextEndOffset(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); auto itorSW = findAll(cmdList.begin(), cmdList.end()); @@ -481,8 +485,8 @@ HWTEST2_F(CommandListAppendWaitOnEvent, givenCommandListWhenAppendWriteGlobalTim GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), - commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), + commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), itor); @@ -522,9 +526,9 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenCommandBufferIsEmptyWhenAppendingWai using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT; using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; - auto consumeSpace = commandList->commandContainer.getCommandStream()->getAvailableSpace(); + auto consumeSpace = commandList->getCmdContainer().getCommandStream()->getAvailableSpace(); consumeSpace -= sizeof(MI_BATCH_BUFFER_END); - commandList->commandContainer.getCommandStream()->getSpace(consumeSpace); + commandList->getCmdContainer().getCommandStream()->getSpace(consumeSpace); size_t expectedConsumedSpace = NEO::EncodeSempahore::getSizeMiSemaphoreWait(); if (MemorySynchronizationCommands::getDcFlushEnable(true, device->getNEODevice()->getRootDeviceEnvironment())) { @@ -541,12 +545,12 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenCommandBufferIsEmptyWhenAppendingWai auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); ze_event_handle_t hEventHandle = event->toHandle(); - auto oldCommandBuffer = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto oldCommandBuffer = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); auto result = commandList->appendWaitOnEvents(1, &hEventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); - auto newCommandBuffer = commandList->commandContainer.getCommandStream()->getGraphicsAllocation(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); + auto newCommandBuffer = commandList->getCmdContainer().getCommandStream()->getGraphicsAllocation(); EXPECT_EQ(expectedConsumedSpace, usedSpaceAfter); EXPECT_NE(oldCommandBuffer, newCommandBuffer); @@ -555,7 +559,7 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenCommandBufferIsEmptyWhenAppendingWai GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - commandList->commandContainer.getCommandStream()->getCpuBase(), + commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto itorPC = find(cmdList.begin(), cmdList.end()); @@ -603,18 +607,18 @@ HWTEST2_F(MultTileCommandListAppendWaitOnEvent, ze_event_handle_t eventHandle = event->toHandle(); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); auto result = commandList->appendWaitOnEvents(1, &eventHandle, false, true); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_EQ(expectedSize, (usedSpaceAfter - usedSpaceBefore)); auto gpuAddress = event->getGpuAddress(device) + event->getContextEndOffset(); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceBefore), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceBefore), expectedSize)); auto itorSW = findAll(cmdList.begin(), cmdList.end()); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp index e390fbd70c..bf0aa310f2 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp @@ -99,7 +99,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBlt commandList.appendMemoryFill(ptr, reinterpret_cast(&pattern), sizeof(pattern), 0x1000, nullptr, 0, nullptr, false); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList.commandContainer.getCommandStream()->getCpuBase(), 0), commandList.commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList.getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList.getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); device->setDriverHandle(driverHandle.get()); @@ -131,7 +131,7 @@ HWTEST2_F(AppendMemoryCopy, GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList.commandContainer.getCommandStream()->getCpuBase(), 0), commandList.commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList.getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList.getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -154,7 +154,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListAndHostPointersWhenMemoryCop void *dstPtr = reinterpret_cast(0x2345); commandList->appendMemoryCopy(dstPtr, srcPtr, 8, nullptr, 0, nullptr, false); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); GenCmdList genCmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed())); @@ -179,7 +179,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListAndHostPointersWhenMemoryCop ze_copy_region_t srcRegion = {4, 4, 0, 2, 2, 1}; commandList->appendMemoryCopyRegion(dstPtr, &dstRegion, 0, 0, srcPtr, &srcRegion, 0, 0, nullptr, 0, nullptr, false); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); GenCmdList genCmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed())); @@ -211,7 +211,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListThenDcFlushIsNotAddedAfterBl MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); commandList->appendMemoryCopyBlit(ptrOffset(dstPtr, dstOffset), &mockAllocationDst, 0, ptrOffset(srcPtr, srcOffset), &mockAllocationSrc, 0, copySize); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); GenCmdList genCmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( genCmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed())); @@ -257,7 +257,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToMemoryCopyR auto globalEndOffset = event->getGlobalEndOffset(); ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); auto cmd = genCmdCast(*itor); @@ -309,7 +309,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenTimestampPassedToImageCopyBl commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event.get()); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); auto cmd = genCmdCast(*itor); @@ -332,7 +332,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyCommandListWhenCopyFromImagBlitThenCommandA commandList->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, nullptr, nullptr, 0, nullptr, false); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_copy_event_xehp_and_later.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_copy_event_xehp_and_later.cpp index 1c43a07a0d..f7db699d6c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_copy_event_xehp_and_later.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_copy_event_xehp_and_later.cpp @@ -455,7 +455,7 @@ void testSingleTileAppendMemoryCopySignalScopeEventToSubDevice(CopyTestInput &in ze_result_t result = ZE_RESULT_SUCCESS; std::unique_ptr commandList(CommandList::create(productFamily, input.device, NEO::EngineGroupType::RenderCompute, 0u, result)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp index 9c97344581..a325ab8769 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_xehp_and_later.cpp @@ -35,7 +35,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAnd ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto gmmHelper = commandContainer.getDevice()->getGmmHelper(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); @@ -94,7 +94,7 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto gmmHelper = commandContainer.getDevice()->getGmmHelper(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); @@ -159,8 +159,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, MultiTileCommandListTests, givenPartitionedCommandL ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - EXPECT_EQ(2u, commandList->partitionCount); - auto &commandContainer = commandList->commandContainer; + EXPECT_EQ(2u, commandList->getPartitionCount()); + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp index 22aee1e906..a2aae771d1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_2.cpp @@ -748,7 +748,8 @@ HWTEST2_F(DeviceWithDualStorage, givenCmdListWithAppendedKernelAndUsmTransferAnd CmdListKernelLaunchParams launchParams = {}; commandList->appendLaunchKernel(kernel.toHandle(), &dispatchKernelArguments, nullptr, 0, nullptr, launchParams, false); auto deviceImp = static_cast(device); - auto pageFaultCmdQueue = whiteboxCast(deviceImp->pageFaultCommandList->cmdQImmediate); + + auto pageFaultCmdQueue = whiteboxCast(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate); auto sizeBefore = commandQueue->commandStream.getUsed(); auto pageFaultSizeBefore = pageFaultCmdQueue->commandStream.getUsed(); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp index fd97a8f0bb..6605b780c9 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_3.cpp @@ -20,6 +20,7 @@ #include "shared/test/common/test_macros/hw_test.h" #include "level_zero/core/test/unit_tests/fixtures/module_fixture.h" +#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" #include "level_zero/core/test/unit_tests/mocks/mock_memory_manager.h" @@ -434,10 +435,10 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDebugModeToTreatIndirectAllocatio launchParams, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()), - std::end(commandList->commandContainer.getResidencyContainer()), + auto itorEvent = std::find(std::begin(commandList->getCmdContainer().getResidencyContainer()), + std::end(commandList->getCmdContainer().getResidencyContainer()), gpuAlloc); - EXPECT_EQ(itorEvent, std::end(commandList->commandContainer.getResidencyContainer())); + EXPECT_EQ(itorEvent, std::end(commandList->getCmdContainer().getResidencyContainer())); auto commandListHandle = commandList->toHandle(); @@ -496,10 +497,10 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir launchParams, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); - auto itorEvent = std::find(std::begin(commandList->commandContainer.getResidencyContainer()), - std::end(commandList->commandContainer.getResidencyContainer()), + auto itorEvent = std::find(std::begin(commandList->getCmdContainer().getResidencyContainer()), + std::end(commandList->getCmdContainer().getResidencyContainer()), gpuAlloc); - EXPECT_EQ(itorEvent, std::end(commandList->commandContainer.getResidencyContainer())); + EXPECT_EQ(itorEvent, std::end(commandList->getCmdContainer().getResidencyContainer())); auto commandListHandle = commandList->toHandle(); @@ -535,8 +536,10 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir NEO::EngineGroupType::Compute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + auto whiteBoxCmdList = static_cast(commandList.get()); + + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); void *deviceAlloc = nullptr; ze_device_mem_alloc_desc_t deviceDesc = {}; @@ -585,8 +588,10 @@ HWTEST_F(CommandQueueIndirectAllocations, givenImmediateCommandListAndFlushTaskW NEO::EngineGroupType::Compute, returnValue)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + auto whiteBoxCmdList = static_cast(commandList.get()); + + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); void *deviceAlloc = nullptr; ze_device_mem_alloc_desc_t deviceDesc = {}; diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp index aaa8bacb09..5d53d1a76a 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -74,12 +74,12 @@ struct MultiDeviceCommandQueueExecuteCommandLists : public TesttoHandle(); ASSERT_NE(nullptr, commandLists[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - EXPECT_EQ(2u, CommandList::fromHandle(commandLists[0])->partitionCount); + EXPECT_EQ(2u, CommandList::fromHandle(commandLists[0])->getPartitionCount()); commandLists[1] = CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle(); ASSERT_NE(nullptr, commandLists[1]); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); - EXPECT_EQ(2u, CommandList::fromHandle(commandLists[1])->partitionCount); + EXPECT_EQ(2u, CommandList::fromHandle(commandLists[1])->getPartitionCount()); } void TearDown() override { @@ -183,7 +183,7 @@ HWTEST_F(CommandQueueExecuteCommandLists, whenASecondLevelBatchBufferPerCommandL auto itorCurrent = cmdList.begin(); for (auto i = 0u; i < numCommandLists; i++) { auto commandList = CommandList::fromHandle(commandLists[i]); - auto allocation = commandList->commandContainer.getCmdBufferAllocations()[0]; + auto allocation = commandList->getCmdContainer().getCmdBufferAllocations()[0]; itorCurrent = find(itorCurrent, cmdList.end()); ASSERT_NE(cmdList.end(), itorCurrent); @@ -932,9 +932,10 @@ HWTEST_F(CommandQueueExecuteCommandLists, GivenCopyCommandQueueWhenExecutingCopy ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Copy, 0u, returnValue)); ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); + auto whiteBoxCmdList = static_cast(commandList.get()); // force command list to have preemption state to verify this state is not used during execution - commandList->commandListPreemptionMode = NEO::PreemptionMode::MidThread; + whiteBoxCmdList->commandListPreemptionMode = NEO::PreemptionMode::MidThread; auto currentCsr = neoDevice->getDefaultEngine().commandStreamReceiver; EXPECT_EQ(NEO::PreemptionMode::Initial, currentCsr->getPreemptionMode()); @@ -1167,7 +1168,7 @@ HWTEST2_F(MultiDeviceCommandQueueExecuteCommandLists, givenMultiplePartitionCoun size_t cmdBufferSizeWithoutMmioProgramming = usedSpaceAfter2ndExecute - usedSpaceBefore2ndExecute; for (auto i = 0u; i < numCommandLists; i++) { - auto commandList = CommandList::fromHandle(commandLists[i]); + auto commandList = whiteboxCast(CommandList::fromHandle(commandLists[i])); commandList->partitionCount = 2; } diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp index 55b4f85800..423b188b5c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist_2.cpp @@ -197,7 +197,7 @@ HWTEST2_F(CommandQueueExecuteCommandListsSimpleTest, givenTwoCommandQueuesUsingS ze_command_list_handle_t commandList = CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle(); ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); - CommandList::fromHandle(commandList)->commandListPreemptionMode = NEO::PreemptionMode::ThreadGroup; + whiteboxCast(CommandList::fromHandle(commandList))->commandListPreemptionMode = NEO::PreemptionMode::ThreadGroup; ze_command_queue_desc_t queueDesc = {}; queueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; @@ -432,17 +432,17 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetWhenDispatchWalkersThenInser DebugManager.flags.PauseOnEnqueue.set(1); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); findPipeControls(cmdList); @@ -459,17 +459,17 @@ HWTEST_F(PauseOnGpuTests, givenPauseOnEnqueueFlagSetToAlwaysWhenDispatchWalkersT DebugManager.flags.PauseOnEnqueue.set(-2); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); findPipeControls(cmdList); @@ -487,17 +487,17 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeOnlyWhenDispatchingThenInsert DebugManager.flags.PauseOnEnqueue.set(0); DebugManager.flags.PauseOnGpuMode.set(PauseOnGpuProperties::PauseMode::BeforeWorkload); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); @@ -516,16 +516,16 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToAfterOnlyWhenDispatchingThenInsertP DebugManager.flags.PauseOnEnqueue.set(0); DebugManager.flags.PauseOnGpuMode.set(PauseOnGpuProperties::PauseMode::AfterWorkload); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); findPipeControls(cmdList); @@ -543,16 +543,16 @@ HWTEST_F(PauseOnGpuTests, givenPauseModeSetToBeforeAndAfterWhenDispatchingThenIn DebugManager.flags.PauseOnEnqueue.set(0); DebugManager.flags.PauseOnGpuMode.set(PauseOnGpuProperties::PauseMode::BeforeAndAfterWorkload); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); @@ -591,17 +591,17 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseOnEnqueueFlagSetWhen DebugManager.flags.PauseOnEnqueue.set(1); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); findPipeControls(cmdList); @@ -618,17 +618,17 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseOnEnqueueFlagSetToAl DebugManager.flags.PauseOnEnqueue.set(-2); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); findPipeControls(cmdList); @@ -646,17 +646,17 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToBeforeOnlyW DebugManager.flags.PauseOnEnqueue.set(0); DebugManager.flags.PauseOnGpuMode.set(PauseOnGpuProperties::PauseMode::BeforeWorkload); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); @@ -675,16 +675,16 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToAfterOnlyWh DebugManager.flags.PauseOnEnqueue.set(0); DebugManager.flags.PauseOnGpuMode.set(PauseOnGpuProperties::PauseMode::AfterWorkload); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); findPipeControls(cmdList); @@ -702,16 +702,16 @@ HWTEST_F(PauseOnGpuWithImmediateCommandListTests, givenPauseModeSetToBeforeAndAf DebugManager.flags.PauseOnEnqueue.set(0); DebugManager.flags.PauseOnGpuMode.set(PauseOnGpuProperties::PauseMode::BeforeAndAfterWorkload); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); enqueueKernel(); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), usedSpaceAfter)); findSemaphores(cmdList); diff --git a/level_zero/core/test/unit_tests/sources/context/test_context.cpp b/level_zero/core/test/unit_tests/sources/context/test_context.cpp index b4d3b70533..b95197fcc7 100644 --- a/level_zero/core/test/unit_tests/sources/context/test_context.cpp +++ b/level_zero/core/test/unit_tests/sources/context/test_context.cpp @@ -840,7 +840,7 @@ HWTEST_F(ContextMakeMemoryResidentAndMigrationTests, auto allocation = svmManager->getSVMAlloc(sharedPtr); auto gpuAllocation = allocation->gpuAllocations.getGraphicsAllocation(mockRootDeviceIndex); - auto &commandContainer = commandList0->commandContainer; + auto &commandContainer = commandList0->getCmdContainer(); commandContainer.addToResidencyContainer(gpuAllocation); commandContainer.addToResidencyContainer(allocation->cpuAllocation); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index 28d0a69f30..716604b6e2 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -20,6 +20,7 @@ #include "level_zero/core/source/event/event.h" #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/fixtures/module_fixture.h" +#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" #include "level_zero/core/test/unit_tests/mocks/mock_event.h" #include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" @@ -166,7 +167,7 @@ HWTEST2_P(L0DebuggerParameterizedTests, givenDebuggerWhenAppendingKernelToComman commandList->close(); - auto *ssh = commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE); + auto *ssh = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::SURFACE_STATE); auto debugSurfaceState = reinterpret_cast(ssh->getCpuBase()); auto debugSurface = static_cast(device)->getDebugSurface(); @@ -196,7 +197,7 @@ HWTEST2_P(L0DebuggerParameterizedTests, givenDebuggerWhenAppendingKernelToComman commandList->close(); - auto *ssh = commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE); + auto *ssh = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::SURFACE_STATE); auto debugSurfaceState = reinterpret_cast(ssh->getCpuBase()); const auto mocsNoCache = device->getNEODevice()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1; @@ -245,10 +246,11 @@ HWTEST_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionEnabledWithImmediat ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -308,10 +310,11 @@ HWTEST_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionDisabledWithImmedia ze_result_t returnValue; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue)); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(1u, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(1u, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -555,7 +558,7 @@ HWTEST2_F(L0DebuggerTest, givenDebuggerEnabledAndL1CachePolicyWBWhenAppendingThe ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); commandList->close(); - auto *ssh = commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE); + auto *ssh = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::SURFACE_STATE); ASSERT_NE(ssh, nullptr); auto debugSurfaceState = reinterpret_cast(ssh->getCpuBase()); ASSERT_NE(debugSurfaceState, nullptr); @@ -592,7 +595,7 @@ HWTEST2_F(L0DebuggerTest, givenFlushTaskSubmissionAndSharedHeapsEnabledWhenAppen ze_command_queue_desc_t queueDesc = {}; ze_result_t returnValue = ZE_RESULT_SUCCESS; - auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue); + auto commandList = whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue)); EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); EXPECT_TRUE(commandList->isFlushTaskSubmissionEnabled); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp index 3630deb0c4..05d2c10394 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp @@ -14,6 +14,7 @@ #include "level_zero/core/source/cmdlist/cmdlist.h" #include "level_zero/core/source/device/device.h" #include "level_zero/core/source/image/image_hw.h" +#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" #include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" #include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h" @@ -40,12 +41,12 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenFlushTaskSubmissionEnabledWhenCommandLi ze_result_t returnValue = ZE_RESULT_SUCCESS; auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GE(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter)); + cmdList, commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto sbaItor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), sbaItor); @@ -69,12 +70,12 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenFlushTaskSubmissionDisabledWhenCommandL ze_result_t returnValue = ZE_RESULT_SUCCESS; auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter)); + cmdList, commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto sbaItor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), sbaItor); @@ -123,7 +124,7 @@ HWTEST2_F(singleAddressSpaceModeTest, givenImmediateCommandListWhenExecutingWith auto &csr = neoDevice->getUltCommandStreamReceiver(); csr.storeMakeResidentAllocations = true; - auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue); + auto commandList = whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue)); EXPECT_TRUE(commandList->isFlushTaskSubmissionEnabled); EXPECT_EQ(&csr, commandList->csr); @@ -168,7 +169,7 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenImmediateCommandListWhenExecutingWithF auto &csr = neoDevice->getUltCommandStreamReceiver(); csr.storeMakeResidentAllocations = true; - auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue); + auto commandList = whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::RenderCompute, returnValue)); EXPECT_TRUE(commandList->isFlushTaskSubmissionEnabled); EXPECT_EQ(&csr, commandList->csr); @@ -225,7 +226,7 @@ HWTEST_P(L0DebuggerWithBlitterTest, givenInternalUsageImmediateCommandListWhenEx ze_result_t returnValue = ZE_RESULT_SUCCESS; ze_group_count_t groupCount{1, 1, 1}; - auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue); + auto commandList = whiteboxCast(CommandList::createImmediate(productFamily, device, &queueDesc, true, NEO::EngineGroupType::RenderCompute, returnValue)); // Internal command list must not have flush task enabled EXPECT_FALSE(commandList->isFlushTaskSubmissionEnabled); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp index cf47083384..4233719710 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_sba_tracking.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -281,19 +281,19 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledWhenNonCopyCommandListIsInititali ze_command_list_handle_t commandListHandle = CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue)->toHandle(); auto commandList = CommandList::fromHandle(commandListHandle); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); ASSERT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceAfter)); + cmdList, commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceAfter)); auto sbaItor = find(cmdList.begin(), cmdList.end()); ASSERT_NE(cmdList.end(), sbaItor); auto cmdSba = genCmdCast(*sbaItor); uint64_t sshGpuVa = cmdSba->getSurfaceStateBaseAddress(); - auto expectedGpuVa = commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getHeapGpuBase(); + auto expectedGpuVa = commandList->getCmdContainer().getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getHeapGpuBase(); EXPECT_EQ(expectedGpuVa, sshGpuVa); EXPECT_EQ(1u, getMockDebuggerL0Hw()->captureStateBaseAddressCount); diff --git a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp index 1f41ac5f35..29e8d5e719 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp @@ -109,9 +109,9 @@ TEST(L0DeviceTest, GivenDualStorageSharedMemorySupportedWhenCreatingDeviceThenPa auto deviceImp = static_cast(device.get()); ASSERT_NE(nullptr, deviceImp->pageFaultCommandList); - ASSERT_NE(nullptr, deviceImp->pageFaultCommandList->cmdQImmediate); - EXPECT_NE(nullptr, static_cast(deviceImp->pageFaultCommandList->cmdQImmediate)->getCsr()); - EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast(deviceImp->pageFaultCommandList->cmdQImmediate)->getSynchronousMode()); + ASSERT_NE(nullptr, whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate); + EXPECT_NE(nullptr, static_cast(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getCsr()); + EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getSynchronousMode()); } TEST(L0DeviceTest, GivenDualStorageSharedMemoryAndImplicitScalingThenPageFaultCmdListImmediateWithInitializedCmdQIsCreatedAgainstSubDeviceZero) { @@ -131,10 +131,10 @@ TEST(L0DeviceTest, GivenDualStorageSharedMemoryAndImplicitScalingThenPageFaultCm auto deviceImp = static_cast(device.get()); ASSERT_NE(nullptr, deviceImp->pageFaultCommandList); - ASSERT_NE(nullptr, deviceImp->pageFaultCommandList->cmdQImmediate); - EXPECT_NE(nullptr, static_cast(deviceImp->pageFaultCommandList->cmdQImmediate)->getCsr()); - EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast(deviceImp->pageFaultCommandList->cmdQImmediate)->getSynchronousMode()); - EXPECT_EQ(deviceImp->pageFaultCommandList->device, deviceImp->subDevices[0]); + ASSERT_NE(nullptr, whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate); + EXPECT_NE(nullptr, static_cast(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getCsr()); + EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast(whiteboxCast(deviceImp->pageFaultCommandList)->cmdQImmediate)->getSynchronousMode()); + EXPECT_EQ(whiteboxCast(deviceImp->pageFaultCommandList)->device, deviceImp->subDevices[0]); } TEST(L0DeviceTest, givenMultipleMaskedSubDevicesWhenCreatingL0DeviceThenDontAddDisabledNeoDevies) { diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp index c12625728f..f1f53c3478 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp @@ -505,6 +505,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); + EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -521,7 +523,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC size, alignment, &srcPtr); ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, size, alignment, &dstPtr); - auto ultCsr = static_cast *>(commandList0->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); ultCsr->recordFlusheBatchBuffer = true; ultCsr->registerClient(); @@ -564,6 +566,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); + EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -580,7 +584,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenFlushTaskSubmissionEnabledAndSplitBcsC size, alignment, &srcPtr); ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, size, alignment, &dstPtr); - auto ultCsr = static_cast *>(commandList0->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); ultCsr->recordFlusheBatchBuffer = true; ultCsr->registerClient(); ultCsr->registerClient(); @@ -627,6 +631,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenRelaxedOrderingNotAllowedWhenDispatchS NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); constexpr size_t alignment = 4096u; constexpr size_t size = 8 * MemoryConstants::megaByte; @@ -638,7 +643,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenRelaxedOrderingNotAllowedWhenDispatchS size, alignment, &srcPtr); ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, size, alignment, &dstPtr); - auto ultCsr = static_cast *>(commandList0->csr); + auto ultCsr = static_cast *>(whiteBoxCmdList->csr); ultCsr->recordFlusheBatchBuffer = true; EXPECT_EQ(0u, ultCsr->getNumClients()); @@ -660,7 +665,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenRelaxedOrderingNotAllowedWhenDispatchS uint32_t semaphoresFound = 0; GenCmdList cmdList; - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->commandContainer.getCommandStream()->getCpuBase(), commandList0->commandContainer.getCommandStream()->getUsed())); + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->getCmdContainer().getCommandStream()->getCpuBase(), commandList0->getCmdContainer().getCommandStream()->getUsed())); for (auto &cmd : cmdList) { if (genCmdCast(cmd)) { @@ -890,7 +895,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[3])->getTaskCount(), 0u); GenCmdList cmdList; - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->commandContainer.getCommandStream()->getCpuBase(), commandList0->commandContainer.getCommandStream()->getUsed())); + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->getCmdContainer().getCommandStream()->getCpuBase(), commandList0->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -924,6 +929,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe NEO::EngineGroupType::Copy, returnValue)); ASSERT_NE(nullptr, commandList0); + auto whiteBoxCmdList = static_cast(commandList0.get()); + EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.cmdQs.size(), 4u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[0])->getTaskCount(), 0u); EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[1])->getTaskCount(), 0u); @@ -940,8 +947,8 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe size, alignment, &srcPtr); ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, size, alignment, &dstPtr); - *commandList0->csr->getBarrierCountTagAddress() = 0u; - commandList0->csr->getNextBarrierCount(); + *whiteBoxCmdList->csr->getBarrierCountTagAddress() = 0u; + whiteBoxCmdList->csr->getNextBarrierCount(); auto result = commandList0->appendMemoryCopy(dstPtr, srcPtr, size, nullptr, 0, nullptr, false); ASSERT_EQ(ZE_RESULT_SUCCESS, result); @@ -951,7 +958,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[3])->getTaskCount(), 0u); GenCmdList cmdList; - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->commandContainer.getCommandStream()->getCpuBase(), commandList0->commandContainer.getCommandStream()->getUsed())); + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->getCmdContainer().getCommandStream()->getCpuBase(), commandList0->getCmdContainer().getCommandStream()->getUsed())); auto itor = cmdList.begin(); for (uint32_t i = 0u; i < static_cast(testL0Device.get())->bcsSplit.cmdQs.size() * 2; ++i) { @@ -1025,7 +1032,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(static_cast(testL0Device.get())->bcsSplit.cmdQs[3])->getTaskCount(), 0u); GenCmdList cmdList; - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->commandContainer.getCommandStream()->getCpuBase(), commandList0->commandContainer.getCommandStream()->getUsed())); + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandList0->getCmdContainer().getCommandStream()->getCpuBase(), commandList0->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -1073,7 +1080,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.barrier.size(), 0u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 12); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->getCmdListContext()), 12); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 1u); @@ -1081,7 +1088,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.barrier.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 6u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 12); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->getCmdListContext()), 12); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 2u); @@ -1089,7 +1096,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.barrier.size(), 2u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 12u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 12); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->getCmdListContext()), 12); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 2u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 3u); @@ -1134,7 +1141,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.barrier.size(), 0u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 0u); - static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->hContext), 12); + static_cast(testL0Device.get())->bcsSplit.events.allocateNew(Context::fromHandle(commandList0->getCmdListContext()), 12); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.marker.size(), 1u); @@ -1142,7 +1149,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.barrier.size(), 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.createdFromLatestPool, 6u); - auto ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 12); + auto ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->getCmdListContext()), 12); EXPECT_EQ(ret, 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); @@ -1153,7 +1160,7 @@ HWTEST2_F(CommandQueueCommandsXeHpc, givenSplitBcsCopyAndImmediateCommandListWhe static_cast(testL0Device.get())->bcsSplit.events.marker[1]->hostSignal(); - ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->hContext), 12); + ret = static_cast(testL0Device.get())->bcsSplit.events.obtainForSplit(Context::fromHandle(commandList0->getCmdListContext()), 12); EXPECT_EQ(ret, 1u); EXPECT_EQ(static_cast(testL0Device.get())->bcsSplit.events.pools.size(), 1u); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp index d47fdf72bb..c2f5fa1600 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdlist_dg2.cpp @@ -30,7 +30,7 @@ HWTEST2_F(CommandListTests, givenDG2WithBSteppingWhenCreatingCommandListThenAddi hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); auto usedSpaceBefore = commandContainer.getCommandStream()->getUsed(); diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp index 0819c53640..86ec07822d 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_cmdlist_xe_hpg_core.cpp @@ -34,7 +34,7 @@ HWTEST2_F(CommandListCreate, WhenCreatingCommandListThenBindingTablePoolAllocAdd ze_result_t returnValue; std::unique_ptr commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, 0u, returnValue)); - auto &commandContainer = commandList->commandContainer; + auto &commandContainer = commandList->getCmdContainer(); auto gmmHelper = commandContainer.getDevice()->getGmmHelper(); ASSERT_NE(nullptr, commandContainer.getCommandStream()); @@ -93,7 +93,7 @@ HWTEST2_F(CommandListCreate, givenNotCopyCommandListWhenProfilingEventBeforeComm GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -129,7 +129,7 @@ HWTEST2_F(CommandListCreate, givenNotCopyCommandListWhenProfilingEventAfterComma GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); @@ -163,7 +163,7 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingEventThenStoreRegC commandList->appendEventForProfiling(event.get(), false); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); } @@ -187,7 +187,7 @@ HWTEST2_F(CommandListCreate, givenAllocationsWhenAppendRangesBarrierThenL3Contro commandList->applyMemoryRangesBarrier(1, sizes, ranges); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); EXPECT_EQ(cmdList.end(), ++itor); @@ -212,7 +212,7 @@ HWTEST2_F(CommandListCreate, givenAllocationWithSizeTooBigForL3ControlWhenAppend commandList->applyMemoryRangesBarrier(1, sizes, ranges); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); EXPECT_NE(cmdList.end(), ++itor); @@ -237,7 +237,7 @@ HWTEST2_F(CommandListCreate, givenRangeSizeTwiceBiggerThanAllocWhenAppendRangesB commandList->applyMemoryRangesBarrier(1, sizes, ranges); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_EQ(cmdList.end(), itor); } @@ -255,7 +255,7 @@ HWTEST2_F(CommandListCreate, givenRangeNotInSvmManagerThanAllocWhenAppendRangesB commandList->applyMemoryRangesBarrier(1, sizes, ranges); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_EQ(cmdList.end(), itor); } @@ -280,7 +280,7 @@ HWTEST2_F(CommandListCreate, givenRangeNotAlignedToPageWhenAppendRangesBarrierTh commandList->applyMemoryRangesBarrier(1, sizes, ranges); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); auto programmedCommand = genCmdCast(*itor); @@ -309,7 +309,7 @@ HWTEST2_F(CommandListCreate, givenRangeBetweenTwoPagesWhenAppendRangesBarrierThe commandList->applyMemoryRangesBarrier(1, sizes, ranges); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), 0), commandList->commandContainer.getCommandStream()->getUsed())); + cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed())); auto itor = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itor); auto programmedCommand = genCmdCast(*itor); @@ -435,18 +435,18 @@ HWTEST2_F(CommandListAppendLaunchKernelXeHpgCore, givenEventWhenAppendKernelIsCa EXPECT_EQ(ZE_RESULT_SUCCESS, result); auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); - auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); CmdListKernelLaunchParams launchParams = {}; result = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, event->toHandle(), 0, nullptr, launchParams, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - auto usedSpaceAfter = commandList->commandContainer.getCommandStream()->getUsed(); + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); EXPECT_GT(usedSpaceAfter, usedSpaceBefore); GenCmdList cmdList; EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer( cmdList, - ptrOffset(commandList->commandContainer.getCommandStream()->getCpuBase(), usedSpaceBefore), + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceBefore), usedSpaceAfter - usedSpaceBefore)); auto gpuAddress = event->getGpuAddress(device); diff --git a/level_zero/tools/source/metrics/metric_oa_query_imp.cpp b/level_zero/tools/source/metrics/metric_oa_query_imp.cpp index d2251bce87..1193757821 100644 --- a/level_zero/tools/source/metrics/metric_oa_query_imp.cpp +++ b/level_zero/tools/source/metrics/metric_oa_query_imp.cpp @@ -334,7 +334,7 @@ bool MetricsLibrary::getGpuCommands(CommandList &commandList, } // Allocate command buffer. - auto stream = commandList.commandContainer.getCommandStream(); + auto stream = commandList.getCmdContainer().getCommandStream(); auto buffer = stream->getSpace(commandBuffer.Size); // Fill attached command buffer with gpu commands. @@ -793,7 +793,7 @@ ze_result_t OaMetricQueryImp::writeMetricQuery(CommandList &commandList, ze_even const size_t metricQueriesSize = metricQueries.size(); // Make gpu allocation visible. - commandList.commandContainer.addToResidencyContainer(pool.pAllocation); + commandList.getCmdContainer().addToResidencyContainer(pool.pAllocation); // Wait for events before executing query. commandList.appendWaitOnEvents(numWaitEvents, phWaitEvents, false, true); @@ -839,7 +839,7 @@ ze_result_t OaMetricQueryImp::writeMetricQuery(CommandList &commandList, ze_even // Allocate command buffer only once. if (buffer == nullptr) { - auto stream = commandList.commandContainer.getCommandStream(); + auto stream = commandList.getCmdContainer().getCommandStream(); buffer = stream->getSpace(commandBuffer.Size); } diff --git a/level_zero/tools/source/metrics/metric_oa_source.cpp b/level_zero/tools/source/metrics/metric_oa_source.cpp index e233c1af56..bba4fab12e 100644 --- a/level_zero/tools/source/metrics/metric_oa_source.cpp +++ b/level_zero/tools/source/metrics/metric_oa_source.cpp @@ -39,7 +39,7 @@ bool OaMetricSourceImp::isAvailable() { } ze_result_t OaMetricSourceImp::appendMetricMemoryBarrier(CommandList &commandList) { - DeviceImp *pDeviceImp = static_cast(commandList.device); + DeviceImp *pDeviceImp = static_cast(commandList.getDevice()); if (pDeviceImp->metricContext->isImplicitScalingCapable()) { // Use one of the sub-device contexts to append to command list. diff --git a/level_zero/tools/source/metrics/metric_oa_streamer_imp.cpp b/level_zero/tools/source/metrics/metric_oa_streamer_imp.cpp index dc1a60c0c3..51672b5877 100644 --- a/level_zero/tools/source/metrics/metric_oa_streamer_imp.cpp +++ b/level_zero/tools/source/metrics/metric_oa_streamer_imp.cpp @@ -341,7 +341,7 @@ ze_result_t OaMetricGroupImp::streamerOpen( ze_result_t OaMetricStreamerImp::appendStreamerMarker(CommandList &commandList, uint32_t value) { - DeviceImp *pDeviceImp = static_cast(commandList.device); + DeviceImp *pDeviceImp = static_cast(commandList.getDevice()); if (pDeviceImp->metricContext->isImplicitScalingCapable()) { // Use one of the sub-device contexts to append to command list. diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_query_pool_2.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_query_pool_2.cpp index baa2c64fa8..9801ea34d7 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_query_pool_2.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_query_pool_2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -315,10 +315,12 @@ TEST_F(MetricQueryPoolTest, givenExecutionQueryTypeWithImmediateCommandListDefau ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); + + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); zet_command_list_handle_t commandListHandle = commandList->toHandle(); TypedValue_1_0 value = {}; @@ -411,10 +413,11 @@ TEST_F(MetricQueryPoolTest, givenExecutionQueryTypeWithImmediateCommandListDefau ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); ASSERT_NE(nullptr, commandList); + auto whiteBoxCmdList = static_cast(commandList.get()); - EXPECT_EQ(device, commandList->device); - EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType); - EXPECT_NE(nullptr, commandList->cmdQImmediate); + EXPECT_EQ(device, commandList->getDevice()); + EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->getCmdListType()); + EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate); zet_command_list_handle_t commandListHandle = commandList->toHandle(); TypedValue_1_0 value = {};