23
23
#include " shared/source/helpers/constants.h"
24
24
#include " shared/source/helpers/engine_node_helper.h"
25
25
#include " shared/source/helpers/gfx_core_helper.h"
26
+ #include " shared/source/helpers/hw_info.h"
26
27
#include " shared/source/helpers/ray_tracing_helper.h"
27
28
#include " shared/source/helpers/string.h"
28
29
#include " shared/source/helpers/topology_map.h"
@@ -96,6 +97,7 @@ ze_result_t DeviceImp::getStatus() {
96
97
ze_result_t DeviceImp::submitCopyForP2P (ze_device_handle_t hPeerDevice, ze_bool_t *value) {
97
98
DeviceImp *pPeerDevice = static_cast <DeviceImp *>(Device::fromHandle (hPeerDevice));
98
99
uint32_t peerRootDeviceIndex = pPeerDevice->getNEODevice ()->getRootDeviceIndex ();
100
+ *value = false ;
99
101
100
102
ze_command_list_handle_t commandList = nullptr ;
101
103
ze_command_list_desc_t listDescriptor = {};
@@ -114,8 +116,10 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
114
116
queueDescriptor.ordinal = 0 ;
115
117
queueDescriptor.index = 0 ;
116
118
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);
119
123
120
124
auto driverHandle = this ->getDriverHandle ();
121
125
DriverHandleImp *driverHandleImp = static_cast <DriverHandleImp *>(driverHandle);
@@ -144,7 +148,7 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
144
148
contextImp->allocDeviceMem (this ->toHandle (), &deviceDesc, 8 , 1 , &memory);
145
149
contextImp->allocDeviceMem (hPeerDevice, &peerDeviceDesc, 8 , 1 , &peerMemory);
146
150
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 );
148
152
L0::CommandList::fromHandle (commandList)->close ();
149
153
150
154
if (ret == ZE_RESULT_SUCCESS) {
@@ -163,9 +167,9 @@ ze_result_t DeviceImp::submitCopyForP2P(ze_device_handle_t hPeerDevice, ze_bool_
163
167
contextImp->freeMem (peerMemory);
164
168
contextImp->freeMem (memory);
165
169
166
- L0::Context::fromHandle (context)->destroy ();
167
- L0::CommandQueue::fromHandle (commandQueue)->destroy ();
168
170
L0::CommandList::fromHandle (commandList)->destroy ();
171
+ L0::CommandQueue::fromHandle (commandQueue)->destroy ();
172
+ L0::Context::fromHandle (context)->destroy ();
169
173
170
174
if (ret == ZE_RESULT_ERROR_DEVICE_LOST) {
171
175
return ZE_RESULT_ERROR_DEVICE_LOST;
@@ -221,7 +225,19 @@ ze_result_t DeviceImp::createCommandList(const ze_command_list_desc_t *desc,
221
225
auto productFamily = neoDevice->getHardwareInfo ().platform .eProductFamily ;
222
226
ze_result_t returnValue = ZE_RESULT_SUCCESS;
223
227
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 );
225
241
226
242
return returnValue;
227
243
}
@@ -300,7 +316,22 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
300
316
301
317
ze_result_t returnValue = ZE_RESULT_SUCCESS;
302
318
*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);
303
330
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);
304
335
return returnValue;
305
336
}
306
337
@@ -479,6 +510,14 @@ ze_result_t DeviceImp::getComputeProperties(ze_device_compute_properties_t *pCom
479
510
return ZE_RESULT_SUCCESS;
480
511
}
481
512
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
+
482
521
void DeviceImp::getP2PPropertiesDirectFabricConnection (DeviceImp *peerDeviceImp,
483
522
ze_device_p2p_bandwidth_exp_properties_t *bandwidthPropertiesDesc) {
484
523
0 commit comments