Skip to content

Commit 6c6a9b2

Browse files
Set indirect flags upon command list reset
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
1 parent ebf6c24 commit 6c6a9b2

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::reset() {
8080
indirectAllocationsAllowed = false;
8181
unifiedMemoryControls.indirectHostAllocationsAllowed = false;
8282
unifiedMemoryControls.indirectSharedAllocationsAllowed = false;
83+
unifiedMemoryControls.indirectDeviceAllocationsAllowed = false;
8384
commandListPreemptionMode = device->getDevicePreemptionMode();
8485
commandListPerThreadScratchSize = 0u;
8586
requiredStreamState = {};

level_zero/core/test/unit_tests/mocks/mock_cmdlist.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ struct WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>
4747
using BaseClass::getAllocationFromHostPtrMap;
4848
using BaseClass::getHostPtrAlloc;
4949
using BaseClass::hostPtrMap;
50+
using BaseClass::indirectAllocationsAllowed;
5051
using BaseClass::initialize;
5152
using BaseClass::requiredStreamState;
53+
using BaseClass::unifiedMemoryControls;
5254
using BaseClass::updateStreamProperties;
5355

5456
WhiteBox() : ::L0::CommandListCoreFamily<gfxCoreFamily>(BaseClass::defaultNumIddsPerBlock) {}

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,5 +804,32 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndCopyOnlyImmediateCommandListWhe
804804
EXPECT_EQ(used, commandContainer.getCommandStream()->getUsed());
805805
}
806806

807+
HWTEST2_F(CommandListCreate, givenIndirectAccessFlagsAreChangedWhenResetingCommandListThenExpectAllFlagsSetToDefault, TestPlatforms) {
808+
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
809+
810+
auto commandList = std::make_unique<::L0::ult::CommandListCoreFamily<gfxCoreFamily>>();
811+
ASSERT_NE(nullptr, commandList);
812+
ze_result_t returnValue = commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
813+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
814+
815+
EXPECT_FALSE(commandList->indirectAllocationsAllowed);
816+
EXPECT_FALSE(commandList->unifiedMemoryControls.indirectHostAllocationsAllowed);
817+
EXPECT_FALSE(commandList->unifiedMemoryControls.indirectSharedAllocationsAllowed);
818+
EXPECT_FALSE(commandList->unifiedMemoryControls.indirectDeviceAllocationsAllowed);
819+
820+
commandList->indirectAllocationsAllowed = true;
821+
commandList->unifiedMemoryControls.indirectHostAllocationsAllowed = true;
822+
commandList->unifiedMemoryControls.indirectSharedAllocationsAllowed = true;
823+
commandList->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true;
824+
825+
returnValue = commandList->reset();
826+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
827+
828+
EXPECT_FALSE(commandList->indirectAllocationsAllowed);
829+
EXPECT_FALSE(commandList->unifiedMemoryControls.indirectHostAllocationsAllowed);
830+
EXPECT_FALSE(commandList->unifiedMemoryControls.indirectSharedAllocationsAllowed);
831+
EXPECT_FALSE(commandList->unifiedMemoryControls.indirectDeviceAllocationsAllowed);
832+
}
833+
807834
} // namespace ult
808835
} // namespace L0

0 commit comments

Comments
 (0)