diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 49d24e1b8f..835dd7dfcc 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -89,6 +89,11 @@ void CommandListCoreFamily::postInitComputeSetup() { setStreamPropertiesDefaultSettings(requiredStreamState); setStreamPropertiesDefaultSettings(finalStreamState); + + currentSurfaceStateBaseAddress = NEO::StreamProperty64::initValue; + currentDynamicStateBaseAddress = NEO::StreamProperty64::initValue; + currentIndirectObjectBaseAddress = NEO::StreamProperty64::initValue; + currentBindingTablePoolBaseAddress = NEO::StreamProperty64::initValue; } template 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 4eb2798639..a819023caa 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -54,6 +54,10 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::containsAnyKernel; using BaseClass::containsCooperativeKernelsFlag; using BaseClass::csr; + using BaseClass::currentBindingTablePoolBaseAddress; + using BaseClass::currentDynamicStateBaseAddress; + using BaseClass::currentIndirectObjectBaseAddress; + using BaseClass::currentSurfaceStateBaseAddress; using BaseClass::device; using BaseClass::doubleSbaWa; using BaseClass::engineGroupType; @@ -199,6 +203,10 @@ struct WhiteBox<::L0::CommandList> : public ::L0::CommandListImp { using BaseClass::commandContainer; using BaseClass::commandListPreemptionMode; using BaseClass::csr; + using BaseClass::currentBindingTablePoolBaseAddress; + using BaseClass::currentDynamicStateBaseAddress; + using BaseClass::currentIndirectObjectBaseAddress; + using BaseClass::currentSurfaceStateBaseAddress; using BaseClass::device; using BaseClass::doubleSbaWa; using BaseClass::finalStreamState; 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 5751272a89..5ed44c1236 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 @@ -2341,5 +2341,39 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest, cmdQueueHw->destroy(); } +HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest, + givenCommandListAppendsKernelWhenCommandListIsResetThenBaseAddressPropertiesAreResetToo, + IsAtLeastSkl) { + + ze_group_count_t groupCount{1, 1, 1}; + CmdListKernelLaunchParams launchParams = {}; + auto result = commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, launchParams, false); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + + result = commandList->close(); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + + auto &container = commandList->getCmdContainer(); + auto indirectBaseAddress = container.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT)->getHeapGpuBase(); + auto surfaceBaseAddress = container.getIndirectHeap(NEO::HeapType::SURFACE_STATE)->getHeapGpuBase(); + auto dynamicBaseAddress = static_cast(NEO::StreamProperty64::initValue); + if (dshRequired) { + dynamicBaseAddress = container.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE)->getHeapGpuBase(); + } + + EXPECT_EQ(static_cast(indirectBaseAddress), commandList->currentIndirectObjectBaseAddress); + EXPECT_EQ(static_cast(surfaceBaseAddress), commandList->currentSurfaceStateBaseAddress); + EXPECT_EQ(static_cast(surfaceBaseAddress), commandList->currentBindingTablePoolBaseAddress); + EXPECT_EQ(static_cast(dynamicBaseAddress), commandList->currentDynamicStateBaseAddress); + + result = commandList->reset(); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + + EXPECT_EQ(NEO::StreamProperty64::initValue, commandList->currentIndirectObjectBaseAddress); + EXPECT_EQ(NEO::StreamProperty64::initValue, commandList->currentSurfaceStateBaseAddress); + EXPECT_EQ(NEO::StreamProperty64::initValue, commandList->currentBindingTablePoolBaseAddress); + EXPECT_EQ(NEO::StreamProperty64::initValue, commandList->currentDynamicStateBaseAddress); +} + } // namespace ult } // namespace L0