@@ -198,6 +198,25 @@ ze_result_t DeviceImp::createCommandListImmediate(const ze_command_queue_desc_t
198198 return returnValue;
199199}
200200
201+ void DeviceImp::adjustCommandQueueDesc (ze_command_queue_desc_t &desc) {
202+ auto nodeOrdinal = NEO::DebugManager.flags .NodeOrdinal .get ();
203+ if (nodeOrdinal != -1 ) {
204+ const NEO::HardwareInfo &hwInfo = neoDevice->getHardwareInfo ();
205+ const NEO::HwHelper &hwHelper = NEO::HwHelper::get (hwInfo.platform .eRenderCoreFamily );
206+ auto &engineGroups = getActiveDevice ()->getRegularEngineGroups ();
207+
208+ auto engineGroupTyp = hwHelper.getEngineGroupType (static_cast <aub_stream::EngineType>(nodeOrdinal), NEO::EngineUsage::Regular, hwInfo);
209+ uint32_t currentEngineIndex = 0u ;
210+ for (const auto &engine : engineGroups) {
211+ if (engine.engineGroupType == engineGroupTyp) {
212+ desc.ordinal = currentEngineIndex;
213+ break ;
214+ }
215+ currentEngineIndex++;
216+ }
217+ }
218+ }
219+
201220ze_result_t DeviceImp::createCommandQueue (const ze_command_queue_desc_t *desc,
202221 ze_command_queue_handle_t *commandQueue) {
203222 auto &platform = neoDevice->getHardwareInfo ().platform ;
@@ -207,21 +226,24 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
207226 uint32_t numEngineGroups = static_cast <uint32_t >(engineGroups.size ());
208227 auto &subDeviceEngineGroups = this ->getSubDeviceCopyEngineGroups ();
209228
229+ ze_command_queue_desc_t commandQueueDesc = *desc;
230+ adjustCommandQueueDesc (commandQueueDesc);
231+
210232 if (!this ->isQueueGroupOrdinalValid (desc->ordinal )) {
211233 return ZE_RESULT_ERROR_INVALID_ARGUMENT;
212234 }
213235
214236 bool isCopyOnly = false ;
215- if (desc-> ordinal < numEngineGroups) {
216- isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType (engineGroups[desc-> ordinal ].engineGroupType );
237+ if (commandQueueDesc. ordinal < numEngineGroups) {
238+ isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType (engineGroups[commandQueueDesc. ordinal ].engineGroupType );
217239 } else {
218- isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType (subDeviceEngineGroups[desc-> ordinal - numEngineGroups].engineGroupType );
240+ isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType (subDeviceEngineGroups[commandQueueDesc. ordinal - numEngineGroups].engineGroupType );
219241 }
220242
221- if (desc-> priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW && !isCopyOnly) {
243+ if (commandQueueDesc. priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW && !isCopyOnly) {
222244 getCsrForLowPriority (&csr);
223245 } else {
224- auto ret = getCsrForOrdinalAndIndex (&csr, desc-> ordinal , desc-> index );
246+ auto ret = getCsrForOrdinalAndIndex (&csr, commandQueueDesc. ordinal , commandQueueDesc. index );
225247 if (ret != ZE_RESULT_SUCCESS) {
226248 return ret;
227249 }
@@ -230,7 +252,7 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
230252 UNRECOVERABLE_IF (csr == nullptr );
231253
232254 ze_result_t returnValue = ZE_RESULT_SUCCESS;
233- *commandQueue = CommandQueue::create (platform.eProductFamily , this , csr, desc , isCopyOnly, false , returnValue);
255+ *commandQueue = CommandQueue::create (platform.eProductFamily , this , csr, &commandQueueDesc , isCopyOnly, false , returnValue);
234256
235257 return returnValue;
236258}
0 commit comments