@@ -504,6 +504,86 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL
504504 commandQueue->destroy ();
505505}
506506
507+ using DeviceCreateCommandQueueTest = Test<DeviceFixture>;
508+ TEST_F (DeviceCreateCommandQueueTest, givenLowPriorityDescWhenCreateCommandQueueIsCalledThenLowPriorityCsrIsAssigned) {
509+ ze_command_queue_desc_t desc{};
510+ desc.ordinal = 0u ;
511+ desc.index = 0u ;
512+ desc.priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW;
513+
514+ ze_command_queue_handle_t commandQueueHandle = {};
515+
516+ ze_result_t res = device->createCommandQueue (&desc, &commandQueueHandle);
517+ EXPECT_EQ (ZE_RESULT_SUCCESS, res);
518+ auto commandQueue = static_cast <CommandQueueImp *>(L0::CommandQueue::fromHandle (commandQueueHandle));
519+ EXPECT_NE (commandQueue, nullptr );
520+ EXPECT_TRUE (commandQueue->getCsr ()->getOsContext ().isLowPriority ());
521+ NEO::CommandStreamReceiver *csr = nullptr ;
522+ device->getCsrForLowPriority (&csr);
523+ EXPECT_EQ (commandQueue->getCsr (), csr);
524+ commandQueue->destroy ();
525+ }
526+
527+ TEST_F (DeviceCreateCommandQueueTest, givenNormalPriorityDescWhenCreateCommandQueueIsCalledWithValidArgumentThenCsrIsAssignedWithOrdinalAndIndex) {
528+ ze_command_queue_desc_t desc{};
529+ desc.ordinal = 0u ;
530+ desc.index = 0u ;
531+ desc.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
532+
533+ ze_command_queue_handle_t commandQueueHandle = {};
534+
535+ ze_result_t res = device->createCommandQueue (&desc, &commandQueueHandle);
536+ EXPECT_EQ (ZE_RESULT_SUCCESS, res);
537+ auto commandQueue = static_cast <CommandQueueImp *>(L0::CommandQueue::fromHandle (commandQueueHandle));
538+ EXPECT_NE (commandQueue, nullptr );
539+ EXPECT_FALSE (commandQueue->getCsr ()->getOsContext ().isLowPriority ());
540+ NEO::CommandStreamReceiver *csr = nullptr ;
541+ device->getCsrForOrdinalAndIndex (&csr, 0u , 0u );
542+ EXPECT_EQ (commandQueue->getCsr (), csr);
543+ commandQueue->destroy ();
544+ }
545+
546+ TEST_F (DeviceCreateCommandQueueTest, givenLowPriorityDescAndWithoutLowPriorityCsrWhenCreateCommandQueueIsCalledThenAbortIsThrown) {
547+ // remove low priority EngineControl objects for negative testing
548+ neoDevice->engines .erase (std::remove_if (
549+ neoDevice->engines .begin (),
550+ neoDevice->engines .end (),
551+ [](EngineControl &p) { return p.osContext ->isLowPriority (); }));
552+
553+ ze_command_queue_desc_t desc{};
554+ desc.ordinal = 0u ;
555+ desc.index = 0u ;
556+ desc.priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW;
557+
558+ ze_command_queue_handle_t commandQueueHandle = {};
559+
560+ ze_result_t res{};
561+ EXPECT_THROW (res = device->createCommandQueue (&desc, &commandQueueHandle), std::exception);
562+ }
563+
564+ using MultiDeviceCreateCommandQueueTest = Test<MultiDeviceFixture>;
565+
566+ TEST_F (MultiDeviceCreateCommandQueueTest, givenLowPriorityDescWhenCreateCommandQueueIsCalledThenLowPriorityCsrIsAssigned) {
567+ auto device = driverHandle->devices [0 ];
568+
569+ ze_command_queue_desc_t desc{};
570+ desc.ordinal = 0u ;
571+ desc.index = 0u ;
572+ desc.priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW;
573+
574+ ze_command_queue_handle_t commandQueueHandle = {};
575+
576+ ze_result_t res = device->createCommandQueue (&desc, &commandQueueHandle);
577+ EXPECT_EQ (ZE_RESULT_SUCCESS, res);
578+ auto commandQueue = static_cast <CommandQueueImp *>(L0::CommandQueue::fromHandle (commandQueueHandle));
579+ EXPECT_NE (commandQueue, nullptr );
580+ EXPECT_TRUE (commandQueue->getCsr ()->getOsContext ().isLowPriority ());
581+ NEO::CommandStreamReceiver *csr = nullptr ;
582+ device->getCsrForLowPriority (&csr);
583+ EXPECT_EQ (commandQueue->getCsr (), csr);
584+ commandQueue->destroy ();
585+ }
586+
507587using ContextCreateCommandQueueTest = Test<ContextFixture>;
508588
509589TEST_F (ContextCreateCommandQueueTest, givenCallToContextCreateCommandQueueThenCallSucceeds) {
0 commit comments