2323#include " shared/source/helpers/constants.h"
2424#include " shared/source/helpers/engine_node_helper.h"
2525#include " shared/source/helpers/gfx_core_helper.h"
26+ #include " shared/source/helpers/hw_info.h"
2627#include " shared/source/helpers/ray_tracing_helper.h"
2728#include " shared/source/helpers/string.h"
2829#include " shared/source/helpers/topology_map.h"
@@ -96,6 +97,7 @@ ze_result_t DeviceImp::getStatus() {
9697ze_result_t DeviceImp::submitCopyForP2P (ze_device_handle_t hPeerDevice, ze_bool_t *value) {
9798 DeviceImp *pPeerDevice = static_cast <DeviceImp *>(Device::fromHandle (hPeerDevice));
9899 uint32_t peerRootDeviceIndex = pPeerDevice->getNEODevice ()->getRootDeviceIndex ();
100+ *value = false ;
99101
100102 ze_command_list_handle_t commandList = nullptr ;
101103 ze_command_list_desc_t listDescriptor = {};
@@ -114,8 +116,10 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
114116 queueDescriptor.ordinal = 0 ;
115117 queueDescriptor.index = 0 ;
116118
117- this ->createCommandList (&listDescriptor, &commandList);
118- this ->createCommandQueue (&queueDescriptor, &commandQueue);
119+ auto ret = this ->createInternalCommandList (&listDescriptor, &commandList);
120+ UNRECOVERABLE_IF (ret != ZE_RESULT_SUCCESS);
121+ ret = this ->createInternalCommandQueue (&queueDescriptor, &commandQueue);
122+ UNRECOVERABLE_IF (ret != ZE_RESULT_SUCCESS);
119123
120124 auto driverHandle = this ->getDriverHandle ();
121125 DriverHandleImp *driverHandleImp = static_cast <DriverHandleImp *>(driverHandle);
@@ -144,7 +148,7 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
144148 contextImp->allocDeviceMem (this ->toHandle (), &deviceDesc, 8 , 1 , &memory);
145149 contextImp->allocDeviceMem (hPeerDevice, &peerDeviceDesc, 8 , 1 , &peerMemory);
146150
147- auto ret = L0::CommandList::fromHandle (commandList)->appendMemoryCopy (peerMemory, memory, 8 , nullptr , 0 , nullptr , false , false );
151+ ret = L0::CommandList::fromHandle (commandList)->appendMemoryCopy (peerMemory, memory, 8 , nullptr , 0 , nullptr , false , false );
148152 L0::CommandList::fromHandle (commandList)->close ();
149153
150154 if (ret == ZE_RESULT_SUCCESS) {
@@ -163,9 +167,9 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
163167 contextImp->freeMem (peerMemory);
164168 contextImp->freeMem (memory);
165169
166- L0::Context::fromHandle (context)->destroy ();
167- L0::CommandQueue::fromHandle (commandQueue)->destroy ();
168170 L0::CommandList::fromHandle (commandList)->destroy ();
171+ L0::CommandQueue::fromHandle (commandQueue)->destroy ();
172+ L0::Context::fromHandle (context)->destroy ();
169173
170174 if (ret == ZE_RESULT_ERROR_DEVICE_LOST) {
171175 return ZE_RESULT_ERROR_DEVICE_LOST;
@@ -221,7 +225,19 @@ ze_result_t DeviceImp::createCommandList(const ze_command_list_desc_t *desc,
221225 auto productFamily = neoDevice->getHardwareInfo ().platform .eProductFamily ;
222226 ze_result_t returnValue = ZE_RESULT_SUCCESS;
223227 auto createCommandList = getCmdListCreateFunc (desc);
224- *commandList = createCommandList (productFamily, this , engineGroupType, desc->flags , returnValue);
228+ *commandList = createCommandList (productFamily, this , engineGroupType, desc->flags , returnValue, false );
229+
230+ return returnValue;
231+ }
232+
233+ ze_result_t DeviceImp::createInternalCommandList (const ze_command_list_desc_t *desc,
234+ ze_command_list_handle_t *commandList) {
235+ NEO::EngineGroupType engineGroupType = getInternalEngineGroupType ();
236+
237+ auto productFamily = neoDevice->getHardwareInfo ().platform .eProductFamily ;
238+ ze_result_t returnValue = ZE_RESULT_SUCCESS;
239+ auto createCommandList = getCmdListCreateFunc (desc);
240+ *commandList = createCommandList (productFamily, this , engineGroupType, desc->flags , returnValue, true );
225241
226242 return returnValue;
227243}
@@ -300,7 +316,22 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
300316
301317 ze_result_t returnValue = ZE_RESULT_SUCCESS;
302318 *commandQueue = CommandQueue::create (platform.eProductFamily , this , csr, &commandQueueDesc, isCopyOnly, false , false , returnValue);
319+ return returnValue;
320+ }
321+
322+ ze_result_t DeviceImp::createInternalCommandQueue (const ze_command_queue_desc_t *desc,
323+ ze_command_queue_handle_t *commandQueue) {
324+ auto &platform = neoDevice->getHardwareInfo ().platform ;
325+
326+ auto internalEngine = this ->getActiveDevice ()->getInternalEngine ();
327+ auto csr = internalEngine.commandStreamReceiver ;
328+ auto engineGroupType = getInternalEngineGroupType ();
329+ auto isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType (engineGroupType);
303330
331+ UNRECOVERABLE_IF (csr == nullptr );
332+
333+ ze_result_t returnValue = ZE_RESULT_SUCCESS;
334+ *commandQueue = CommandQueue::create (platform.eProductFamily , this , csr, desc, isCopyOnly, true , false , returnValue);
304335 return returnValue;
305336}
306337
@@ -479,6 +510,14 @@ ze_result_t DeviceImp::getComputeProperties(ze_device_compute_properties_t *pCom
479510 return ZE_RESULT_SUCCESS;
480511}
481512
513+ NEO::EngineGroupType DeviceImp::getInternalEngineGroupType () {
514+ auto &gfxCoreHelper = neoDevice->getGfxCoreHelper ();
515+ auto internalEngine = this ->getActiveDevice ()->getInternalEngine ();
516+ auto internalEngineType = internalEngine.getEngineType ();
517+ auto internalEngineUsage = internalEngine.getEngineUsage ();
518+ return gfxCoreHelper.getEngineGroupType (internalEngineType, internalEngineUsage, getHwInfo ());
519+ }
520+
482521void DeviceImp::getP2PPropertiesDirectFabricConnection (DeviceImp *peerDeviceImp,
483522 ze_device_p2p_bandwidth_exp_properties_t *bandwidthPropertiesDesc) {
484523
0 commit comments