88#include " shared/source/helpers/state_base_address.h"
99#include " shared/test/unit_test/helpers/debug_manager_state_restore.h"
1010#include " shared/test/unit_test/helpers/default_hw_info.h"
11+ #include " shared/test/unit_test/mocks/mock_command_stream_receiver.h"
1112
12- #include " opencl/test/unit_test/mocks/mock_graphics_allocation.h"
1313#include " test.h"
1414
1515#include " level_zero/core/source/driver/driver_handle_imp.h"
@@ -217,5 +217,45 @@ HWTEST2_F(CommandQueueDestroy, whenCommandQueueDestroyIsCalledPrintPrintfOutputI
217217 EXPECT_EQ (1u , kernel.printPrintfOutputCalledTimes );
218218}
219219
220+ using CommandQueueCommands = Test<DeviceFixture>;
221+ HWTEST_F (CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) {
222+ const ze_command_queue_desc_t desc = {
223+ ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT,
224+ ZE_COMMAND_QUEUE_FLAG_NONE,
225+ ZE_COMMAND_QUEUE_MODE_DEFAULT,
226+ ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
227+ 0 };
228+
229+ MockCsrHw2<FamilyType> csr (*neoDevice->getExecutionEnvironment (), 0 );
230+ csr.initializeTagAllocation ();
231+ csr.setupContext (*neoDevice->getDefaultEngine ().osContext );
232+
233+ L0::CommandQueue *commandQueue = CommandQueue::create (productFamily,
234+ device,
235+ &csr,
236+ &desc,
237+ true );
238+ ASSERT_NE (nullptr , commandQueue);
239+
240+ std::unique_ptr<L0::CommandList> commandList (CommandList::create (productFamily, device, true ));
241+ auto commandListHandle = commandList->toHandle ();
242+ auto status = commandQueue->executeCommandLists (1 , &commandListHandle, nullptr , false );
243+
244+ auto globalFence = csr.getGlobalFenceAllocation ();
245+ if (globalFence) {
246+ bool found = false ;
247+ for (auto alloc : csr.copyOfAllocations ) {
248+ if (alloc == globalFence) {
249+ found = true ;
250+ break ;
251+ }
252+ }
253+ EXPECT_TRUE (found);
254+ }
255+ EXPECT_EQ (status, ZE_RESULT_SUCCESS);
256+ EXPECT_TRUE (csr.programHardwareContextCalled );
257+ commandQueue->destroy ();
258+ }
259+
220260} // namespace ult
221261} // namespace L0
0 commit comments