@@ -344,8 +344,38 @@ void DebugSessionLinuxXe::handleEvent(NEO::EuDebugEvent *event) {
344
344
vmBindOpData.vmBindOpMetadataVec .push_back (*vmBindOpMetadata);
345
345
vmBindOpData.pendingNumExtensions --;
346
346
handleVmBind (vmBindMap[vmBindSeqNo]);
347
- } else if (type == euDebugInterface->getParamValue (NEO::EuDebugParam::eventTypePagefault) ||
348
- type == euDebugInterface->getParamValue (NEO::EuDebugParam::eventTypeExecQueuePlacements)) {
347
+ } else if (type == euDebugInterface->getParamValue (NEO::EuDebugParam::eventTypeExecQueuePlacements)) {
348
+ NEO::EuDebugEventExecQueuePlacements *execQueuePlacements = reinterpret_cast <NEO::EuDebugEventExecQueuePlacements *>(event);
349
+
350
+ PRINT_DEBUGGER_INFO_LOG (" DRM_XE_EUDEBUG_IOCTL_READ_EVENT type: PRELIM_DRM_XE_EUDEBUG_EVENT_EXEC_QUEUE_PLACEMENTS client_handle = %" SCNx64
351
+ " vm_handle = %" SCNx64
352
+ " exec_queue_handle = %" SCNx64
353
+ " lrc_handle = %" SCNx64
354
+ " num_placements = %" SCNx32
355
+ " \n " ,
356
+ static_cast <uint64_t >(execQueuePlacements->clientHandle ),
357
+ static_cast <uint64_t >(execQueuePlacements->vmHandle ),
358
+ static_cast <uint64_t >(execQueuePlacements->execQueueHandle ), static_cast <uint64_t >(execQueuePlacements->lrcHandle ),
359
+ static_cast <uint32_t >(execQueuePlacements->numPlacements ));
360
+
361
+ UNRECOVERABLE_IF (execQueuePlacements->numPlacements == 0 );
362
+ auto engine = reinterpret_cast <NEO::EngineClassInstance *>(&(execQueuePlacements->instances [0 ]));
363
+ NEO::EngineClassInstance engineClassInstance = {engine->engineClass , engine->engineInstance };
364
+ auto tileIndex = DrmHelper::getEngineTileIndex (connectedDevice, engineClassInstance);
365
+
366
+ auto &vmToTile = clientHandleToConnection[execQueuePlacements->clientHandle ]->vmToTile ;
367
+ if (vmToTile.find (execQueuePlacements->vmHandle ) != vmToTile.end ()) {
368
+ if (vmToTile[execQueuePlacements->vmHandle ] != tileIndex) {
369
+ PRINT_DEBUGGER_ERROR_LOG (" vmToTile map: For vm_handle = %lu tileIndex = %u already present. Attempt to overwrite with tileIndex = %u\n " ,
370
+ static_cast <uint64_t >(execQueuePlacements->vmHandle ), vmToTile[execQueuePlacements->vmHandle ], tileIndex);
371
+ DEBUG_BREAK_IF (true );
372
+ }
373
+ } else {
374
+ clientHandleToConnection[execQueuePlacements->clientHandle ]->vmToTile [execQueuePlacements->vmHandle ] = tileIndex;
375
+ PRINT_DEBUGGER_INFO_LOG (" clientHandleToConnection[%" SCNx64 " ]->vmToTile[%" SCNx64 " ] = %u\n " ,
376
+ static_cast <uint64_t >(execQueuePlacements->clientHandle ), static_cast <uint64_t >(execQueuePlacements->vmHandle ), tileIndex);
377
+ }
378
+ } else if (type == euDebugInterface->getParamValue (NEO::EuDebugParam::eventTypePagefault)) {
349
379
PRINT_DEBUGGER_INFO_LOG (" DRM_XE_EUDEBUG_IOCTL_READ_EVENT type: UNHANDLED %u flags = %u len = %lu\n " , type, event->flags , event->len );
350
380
} else {
351
381
additionalEvents (event);
@@ -383,6 +413,10 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
383
413
uint64_t isaAddr = 0 ;
384
414
bool triggerModuleLoadEvent = false ;
385
415
416
+ uint32_t tileIndex = 0 ;
417
+ if (connection->vmToTile .find (vmBindData.vmBind .vmHandle ) != connection->vmToTile .end ()) {
418
+ tileIndex = connection->vmToTile [vmBindData.vmBind .vmHandle ];
419
+ }
386
420
for (auto &vmBindOpData : vmBindData.vmBindOpMap ) {
387
421
auto &vmBindOp = vmBindOpData.second .vmBindOp ;
388
422
for (const auto &vmBindOpMetadata : vmBindOpData.second .vmBindOpMetadataVec ) {
@@ -398,8 +432,8 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
398
432
}
399
433
if (metaDataEntry.metadata .type == euDebugInterface->getParamValue (NEO::EuDebugParam::metadataModuleArea)) {
400
434
isaAddr = vmBindOp.addr ;
401
- if (connection->isaMap [0 ].find (vmBindOp.addr ) == connection->isaMap [0 ].end ()) {
402
- auto &isaMap = connection->isaMap [0 ];
435
+ if (connection->isaMap [tileIndex ].find (vmBindOp.addr ) == connection->isaMap [tileIndex ].end ()) {
436
+ auto &isaMap = connection->isaMap [tileIndex ];
403
437
auto isa = std::make_unique<IsaAllocation>();
404
438
isa->bindInfo = {vmBindOp.addr , vmBindOp.range };
405
439
isa->vmHandle = vmBindData.vmBind .vmHandle ;
@@ -424,8 +458,8 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
424
458
425
459
if (metaDataEntry.metadata .type == euDebugInterface->getParamValue (NEO::EuDebugParam::metadataElfBinary)) {
426
460
isaAddr = vmBindOp.addr ;
427
- if (connection->isaMap [0 ].find (vmBindOp.addr ) == connection->isaMap [0 ].end ()) {
428
- auto &isaMap = connection->isaMap [0 ];
461
+ if (connection->isaMap [tileIndex ].find (vmBindOp.addr ) == connection->isaMap [tileIndex ].end ()) {
462
+ auto &isaMap = connection->isaMap [tileIndex ];
429
463
auto &elfMap = connection->elfMap ;
430
464
auto isa = std::make_unique<IsaAllocation>();
431
465
isa->bindInfo = {vmBindOp.addr , vmBindOp.range };
@@ -441,45 +475,45 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
441
475
isaMap[vmBindOp.addr ]->moduleLoadEventAck = true ;
442
476
elfHandleInVmBind = vmBindOpMetadata.metadataHandle ;
443
477
} else {
444
- auto &isa = connection->isaMap [0 ][vmBindOp.addr ];
478
+ auto &isa = connection->isaMap [tileIndex ][vmBindOp.addr ];
445
479
isa->validVMs .insert (vmBindData.vmBind .vmHandle );
446
480
}
447
481
}
448
482
if (metaDataEntry.metadata .type == euDebugInterface->getParamValue (NEO::EuDebugParam::metadataProgramModule)) {
449
483
auto &module = connection->metaDataToModule [vmBindOpMetadata.metadataHandle ];
450
- module .segmentVmBindCounter [0 ]++;
451
- DEBUG_BREAK_IF (module .loadAddresses [0 ].size () > module .segmentCount );
484
+ module .segmentVmBindCounter [tileIndex ]++;
485
+ DEBUG_BREAK_IF (module .loadAddresses [tileIndex ].size () > module .segmentCount );
452
486
453
- bool canTriggerEvent = module .loadAddresses [0 ].size () == (module .segmentCount - 1 );
454
- module .loadAddresses [0 ].insert (vmBindOp.addr );
487
+ bool canTriggerEvent = module .loadAddresses [tileIndex ].size () == (module .segmentCount - 1 );
488
+ module .loadAddresses [tileIndex ].insert (vmBindOp.addr );
455
489
moduleHandle = vmBindOpMetadata.metadataHandle ;
456
- if (canTriggerEvent && module .loadAddresses [0 ].size () == module .segmentCount ) {
490
+ if (canTriggerEvent && module .loadAddresses [tileIndex ].size () == module .segmentCount ) {
457
491
triggerModuleLoadEvent = true ;
458
492
}
459
493
}
460
494
}
461
495
}
462
496
463
497
if (vmBindOp.base .flags & euDebugInterface->getParamValue (NEO::EuDebugParam::eventBitDestroy)) {
464
- if (connection->isaMap [0 ].count (vmBindOp.addr )) {
465
- auto &isa = connection->isaMap [0 ][vmBindOp.addr ];
498
+ if (connection->isaMap [tileIndex ].count (vmBindOp.addr )) {
499
+ auto &isa = connection->isaMap [tileIndex ][vmBindOp.addr ];
466
500
if (isa->validVMs .count (vmBindData.vmBind .vmHandle )) {
467
501
auto &module = connection->metaDataToModule [isa->moduleHandle ];
468
- module .segmentVmBindCounter [0 ]--;
469
- if (module .segmentVmBindCounter [0 ] == 0 ) {
502
+ module .segmentVmBindCounter [tileIndex ]--;
503
+ if (module .segmentVmBindCounter [tileIndex ] == 0 ) {
470
504
zet_debug_event_t debugEvent = {};
471
505
auto &metaDataEntry = connection->metaDataMap [isa->moduleHandle ];
472
506
auto gmmHelper = connectedDevice->getNEODevice ()->getGmmHelper ();
473
- auto loadAddress = gmmHelper->canonize (*std::min_element (module .loadAddresses [0 ].begin (), module .loadAddresses [0 ].end ()));
507
+ auto loadAddress = gmmHelper->canonize (*std::min_element (module .loadAddresses [tileIndex ].begin (), module .loadAddresses [tileIndex ].end ()));
474
508
debugEvent.type = ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD;
475
509
debugEvent.info .module .format = ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF;
476
510
debugEvent.info .module .load = loadAddress;
477
511
auto &elfMetadata = connection->metaDataMap [isa->elfHandle ];
478
512
debugEvent.info .module .moduleBegin = reinterpret_cast <uint64_t >(elfMetadata.data .get ());
479
513
debugEvent.info .module .moduleEnd = reinterpret_cast <uint64_t >(elfMetadata.data .get ()) + elfMetadata.metadata .len ;
480
514
pushApiEvent (debugEvent, metaDataEntry.metadata .metadataHandle );
481
- module .loadAddresses [0 ].clear ();
482
- module .moduleLoadEventAcked [0 ] = false ;
515
+ module .loadAddresses [tileIndex ].clear ();
516
+ module .moduleLoadEventAcked [tileIndex ] = false ;
483
517
}
484
518
isa->validVMs .erase (vmBindData.vmBind .vmHandle );
485
519
}
@@ -488,7 +522,7 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
488
522
}
489
523
490
524
if (isaAddr && moduleHandle != invalidHandle) {
491
- connection->isaMap [0 ][isaAddr]->moduleHandle = moduleHandle;
525
+ connection->isaMap [tileIndex ][isaAddr]->moduleHandle = moduleHandle;
492
526
}
493
527
494
528
if (triggerModuleLoadEvent) {
@@ -497,7 +531,7 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
497
531
auto &metaDataEntry = connection->metaDataMap [moduleHandle];
498
532
auto &module = connection->metaDataToModule [moduleHandle];
499
533
auto gmmHelper = connectedDevice->getNEODevice ()->getGmmHelper ();
500
- auto loadAddress = gmmHelper->canonize (*std::min_element (module .loadAddresses [0 ].begin (), module .loadAddresses [0 ].end ()));
534
+ auto loadAddress = gmmHelper->canonize (*std::min_element (module .loadAddresses [tileIndex ].begin (), module .loadAddresses [tileIndex ].end ()));
501
535
PRINT_DEBUGGER_INFO_LOG (" Zebin module loaded at: %p, with %u isa allocations" , (void *)loadAddress, module .segmentCount );
502
536
503
537
auto &elfMetadata = connection->metaDataMap [elfHandleInVmBind];
@@ -514,7 +548,7 @@ void DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
514
548
if (vmBindData.vmBind .flags & euDebugInterface->getParamValue (NEO::EuDebugParam::eventVmBindFlagUfence)) {
515
549
if (vmBindData.vmBindUfence .base .flags & euDebugInterface->getParamValue (NEO::EuDebugParam::eventBitNeedAck)) {
516
550
EventToAck ackEvent (vmBindData.vmBindUfence .base .seqno , vmBindData.vmBindUfence .base .type );
517
- module .ackEvents [0 ].push_back (ackEvent);
551
+ module .ackEvents [tileIndex ].push_back (ackEvent);
518
552
shouldAckEvent = false ;
519
553
}
520
554
}
0 commit comments