15
15
https://github.com/intel/llvm/blob/sycl/sycl/doc/design/CommandGraph.md#level-zero
16
16
*/
17
17
18
+ // Print the name of a variable and its value in the L0 debug log
19
+ #define DEBUG_LOG (VAR ) logger::debug(#VAR " {}" , VAR);
20
+
18
21
namespace {
19
22
// / Checks the version of the level-zero driver.
20
23
// / @param Context Execution context
@@ -495,6 +498,8 @@ urCommandBufferCreateExp(ur_context_handle_t Context, ur_device_handle_t Device,
495
498
ZeCommandListDesc.flags = IsInOrder ? ZE_COMMAND_LIST_FLAG_IN_ORDER
496
499
: ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING;
497
500
501
+ DEBUG_LOG (ZeCommandListDesc.flags );
502
+
498
503
ZeStruct<ze_mutable_command_list_exp_desc_t > ZeMutableCommandListDesc;
499
504
if (CommandBufferDesc && CommandBufferDesc->isUpdatable ) {
500
505
ZeMutableCommandListDesc.flags = 0 ;
@@ -678,6 +683,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp(
678
683
ZE2UR_CALL (
679
684
Plt->ZeMutableCmdListExt .zexCommandListGetNextCommandIdExp ,
680
685
(CommandBuffer->ZeCommandList , &ZeMutableCommandDesc, &CommandId));
686
+ DEBUG_LOG (CommandId);
681
687
}
682
688
try {
683
689
if (Command)
@@ -1201,6 +1207,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1201
1207
auto SupportedFeatures =
1202
1208
Command->CommandBuffer ->Device ->ZeDeviceMutableCmdListsProperties
1203
1209
->mutableCommandFlags ;
1210
+ logger::debug (" Mutable features supported by device {}" , SupportedFeatures);
1204
1211
1205
1212
// We need the created descriptors to live till the point when
1206
1213
// zexCommandListUpdateMutableCommandsExp is called at the end of the
@@ -1228,10 +1235,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1228
1235
auto MutableGroupOffestDesc =
1229
1236
std::make_unique<ZeStruct<ze_mutable_global_offset_exp_desc_t >>();
1230
1237
MutableGroupOffestDesc->commandId = Command->CommandId ;
1238
+ DEBUG_LOG (MutableGroupOffestDesc->commandId );
1231
1239
MutableGroupOffestDesc->pNext = NextDesc;
1240
+ DEBUG_LOG (MutableGroupOffestDesc->pNext );
1232
1241
MutableGroupOffestDesc->offsetX = NewGlobalWorkOffset[0 ];
1242
+ DEBUG_LOG (MutableGroupOffestDesc->offsetX );
1233
1243
MutableGroupOffestDesc->offsetY = Dim >= 2 ? NewGlobalWorkOffset[1 ] : 0 ;
1244
+ DEBUG_LOG (MutableGroupOffestDesc->offsetY );
1234
1245
MutableGroupOffestDesc->offsetZ = Dim == 3 ? NewGlobalWorkOffset[2 ] : 0 ;
1246
+ DEBUG_LOG (MutableGroupOffestDesc->offsetZ );
1235
1247
NextDesc = MutableGroupOffestDesc.get ();
1236
1248
OffsetDescs.push_back (std::move (MutableGroupOffestDesc));
1237
1249
}
@@ -1245,10 +1257,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1245
1257
auto MutableGroupSizeDesc =
1246
1258
std::make_unique<ZeStruct<ze_mutable_group_size_exp_desc_t >>();
1247
1259
MutableGroupSizeDesc->commandId = Command->CommandId ;
1260
+ DEBUG_LOG (MutableGroupSizeDesc->commandId );
1248
1261
MutableGroupSizeDesc->pNext = NextDesc;
1262
+ DEBUG_LOG (MutableGroupSizeDesc->pNext );
1249
1263
MutableGroupSizeDesc->groupSizeX = NewLocalWorkSize[0 ];
1264
+ DEBUG_LOG (MutableGroupSizeDesc->groupSizeX );
1250
1265
MutableGroupSizeDesc->groupSizeY = Dim >= 2 ? NewLocalWorkSize[1 ] : 1 ;
1266
+ DEBUG_LOG (MutableGroupSizeDesc->groupSizeY );
1251
1267
MutableGroupSizeDesc->groupSizeZ = Dim == 3 ? NewLocalWorkSize[2 ] : 1 ;
1268
+ DEBUG_LOG (MutableGroupSizeDesc->groupSizeZ );
1252
1269
NextDesc = MutableGroupSizeDesc.get ();
1253
1270
GroupSizeDescs.push_back (std::move (MutableGroupSizeDesc));
1254
1271
}
@@ -1273,20 +1290,29 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1273
1290
Dim, NewGlobalWorkSize, NewLocalWorkSize));
1274
1291
auto MutableGroupCountDesc =
1275
1292
std::make_unique<ZeStruct<ze_mutable_group_count_exp_desc_t >>();
1276
- MutableGroupCountDesc->pNext = NextDesc;
1277
1293
MutableGroupCountDesc->commandId = Command->CommandId ;
1294
+ DEBUG_LOG (MutableGroupCountDesc->commandId );
1295
+ MutableGroupCountDesc->pNext = NextDesc;
1296
+ DEBUG_LOG (MutableGroupCountDesc->pNext );
1278
1297
MutableGroupCountDesc->pGroupCount = &ZeThreadGroupDimensions;
1298
+ DEBUG_LOG (MutableGroupCountDesc->pGroupCount );
1279
1299
NextDesc = MutableGroupCountDesc.get ();
1280
1300
GroupCountDescs.push_back (std::move (MutableGroupCountDesc));
1281
1301
1282
1302
if (UpdateWGSize) {
1283
1303
auto MutableGroupSizeDesc =
1284
1304
std::make_unique<ZeStruct<ze_mutable_group_size_exp_desc_t >>();
1285
1305
MutableGroupSizeDesc->commandId = Command->CommandId ;
1306
+ DEBUG_LOG (MutableGroupSizeDesc->commandId );
1286
1307
MutableGroupSizeDesc->pNext = NextDesc;
1308
+ DEBUG_LOG (MutableGroupSizeDesc->pNext );
1287
1309
MutableGroupSizeDesc->groupSizeX = WG[0 ];
1310
+ DEBUG_LOG (MutableGroupSizeDesc->groupSizeX );
1288
1311
MutableGroupSizeDesc->groupSizeY = WG[1 ];
1312
+ DEBUG_LOG (MutableGroupSizeDesc->groupSizeY );
1289
1313
MutableGroupSizeDesc->groupSizeZ = WG[2 ];
1314
+ DEBUG_LOG (MutableGroupSizeDesc->groupSizeZ );
1315
+
1290
1316
NextDesc = MutableGroupSizeDesc.get ();
1291
1317
GroupSizeDescs.push_back (std::move (MutableGroupSizeDesc));
1292
1318
}
@@ -1333,10 +1359,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1333
1359
auto ZeMutableArgDesc =
1334
1360
std::make_unique<ZeStruct<ze_mutable_kernel_argument_exp_desc_t >>();
1335
1361
ZeMutableArgDesc->commandId = Command->CommandId ;
1362
+ DEBUG_LOG (ZeMutableArgDesc->commandId );
1336
1363
ZeMutableArgDesc->pNext = NextDesc;
1364
+ DEBUG_LOG (ZeMutableArgDesc->pNext );
1337
1365
ZeMutableArgDesc->argIndex = NewMemObjArgDesc.argIndex ;
1366
+ DEBUG_LOG (ZeMutableArgDesc->argIndex );
1338
1367
ZeMutableArgDesc->argSize = sizeof (void *);
1368
+ DEBUG_LOG (ZeMutableArgDesc->argSize );
1339
1369
ZeMutableArgDesc->pArgValue = ZeHandlePtr;
1370
+ DEBUG_LOG (ZeMutableArgDesc->pArgValue );
1340
1371
1341
1372
NextDesc = ZeMutableArgDesc.get ();
1342
1373
ArgDescs.push_back (std::move (ZeMutableArgDesc));
@@ -1350,10 +1381,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1350
1381
auto ZeMutableArgDesc =
1351
1382
std::make_unique<ZeStruct<ze_mutable_kernel_argument_exp_desc_t >>();
1352
1383
ZeMutableArgDesc->commandId = Command->CommandId ;
1384
+ DEBUG_LOG (ZeMutableArgDesc->commandId );
1353
1385
ZeMutableArgDesc->pNext = NextDesc;
1386
+ DEBUG_LOG (ZeMutableArgDesc->pNext );
1354
1387
ZeMutableArgDesc->argIndex = NewPointerArgDesc.argIndex ;
1388
+ DEBUG_LOG (ZeMutableArgDesc->argIndex );
1355
1389
ZeMutableArgDesc->argSize = sizeof (void *);
1390
+ DEBUG_LOG (ZeMutableArgDesc->argSize );
1356
1391
ZeMutableArgDesc->pArgValue = NewPointerArgDesc.pNewPointerArg ;
1392
+ DEBUG_LOG (ZeMutableArgDesc->pArgValue );
1357
1393
1358
1394
NextDesc = ZeMutableArgDesc.get ();
1359
1395
ArgDescs.push_back (std::move (ZeMutableArgDesc));
@@ -1367,9 +1403,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1367
1403
auto ZeMutableArgDesc =
1368
1404
std::make_unique<ZeStruct<ze_mutable_kernel_argument_exp_desc_t >>();
1369
1405
ZeMutableArgDesc->commandId = Command->CommandId ;
1406
+ DEBUG_LOG (ZeMutableArgDesc->commandId );
1370
1407
ZeMutableArgDesc->pNext = NextDesc;
1408
+ DEBUG_LOG (ZeMutableArgDesc->pNext );
1371
1409
ZeMutableArgDesc->argIndex = NewValueArgDesc.argIndex ;
1410
+ DEBUG_LOG (ZeMutableArgDesc->argIndex );
1372
1411
ZeMutableArgDesc->argSize = NewValueArgDesc.argSize ;
1412
+ DEBUG_LOG (ZeMutableArgDesc->argSize );
1373
1413
// OpenCL: "the arg_value pointer can be NULL or point to a NULL value
1374
1414
// in which case a NULL value will be used as the value for the argument
1375
1415
// declared as a pointer to global or constant memory in the kernel"
@@ -1383,6 +1423,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferUpdateKernelLaunchExp(
1383
1423
ArgValuePtr = nullptr ;
1384
1424
}
1385
1425
ZeMutableArgDesc->pArgValue = ArgValuePtr;
1426
+ DEBUG_LOG (ZeMutableArgDesc->pArgValue );
1386
1427
NextDesc = ZeMutableArgDesc.get ();
1387
1428
ArgDescs.push_back (std::move (ZeMutableArgDesc));
1388
1429
}
0 commit comments