diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 029a308b39..975b4cd1cf 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -80,6 +80,7 @@ ze_result_t CommandListCoreFamily::reset() { indirectAllocationsAllowed = false; unifiedMemoryControls.indirectHostAllocationsAllowed = false; unifiedMemoryControls.indirectSharedAllocationsAllowed = false; + unifiedMemoryControls.indirectDeviceAllocationsAllowed = false; commandListPreemptionMode = device->getDevicePreemptionMode(); commandListPerThreadScratchSize = 0u; requiredStreamState = {}; 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 0ca82557dc..0a416176ec 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -47,8 +47,10 @@ struct WhiteBox<::L0::CommandListCoreFamily> using BaseClass::getAllocationFromHostPtrMap; using BaseClass::getHostPtrAlloc; using BaseClass::hostPtrMap; + using BaseClass::indirectAllocationsAllowed; using BaseClass::initialize; using BaseClass::requiredStreamState; + using BaseClass::unifiedMemoryControls; using BaseClass::updateStreamProperties; WhiteBox() : ::L0::CommandListCoreFamily(BaseClass::defaultNumIddsPerBlock) {} 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 d28957bf08..ef9f296f23 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 @@ -804,5 +804,32 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndCopyOnlyImmediateCommandListWhe EXPECT_EQ(used, commandContainer.getCommandStream()->getUsed()); } +HWTEST2_F(CommandListCreate, givenIndirectAccessFlagsAreChangedWhenResetingCommandListThenExpectAllFlagsSetToDefault, TestPlatforms) { + using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; + + auto commandList = std::make_unique<::L0::ult::CommandListCoreFamily>(); + ASSERT_NE(nullptr, commandList); + ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u); + EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); + + EXPECT_FALSE(commandList->indirectAllocationsAllowed); + EXPECT_FALSE(commandList->unifiedMemoryControls.indirectHostAllocationsAllowed); + EXPECT_FALSE(commandList->unifiedMemoryControls.indirectSharedAllocationsAllowed); + EXPECT_FALSE(commandList->unifiedMemoryControls.indirectDeviceAllocationsAllowed); + + commandList->indirectAllocationsAllowed = true; + commandList->unifiedMemoryControls.indirectHostAllocationsAllowed = true; + commandList->unifiedMemoryControls.indirectSharedAllocationsAllowed = true; + commandList->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; + + returnValue = commandList->reset(); + EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue); + + EXPECT_FALSE(commandList->indirectAllocationsAllowed); + EXPECT_FALSE(commandList->unifiedMemoryControls.indirectHostAllocationsAllowed); + EXPECT_FALSE(commandList->unifiedMemoryControls.indirectSharedAllocationsAllowed); + EXPECT_FALSE(commandList->unifiedMemoryControls.indirectDeviceAllocationsAllowed); +} + } // namespace ult } // namespace L0