@@ -343,14 +343,18 @@ bool DebugSessionImp::writeResumeCommand(const std::vector<EuThread::ThreadId> &
343
343
dword = 4 ;
344
344
}
345
345
346
+ const auto regSize = std::max (getRegisterSize (registerType), hwInfo.capabilityTable .grfSize );
347
+ auto reg = std::make_unique<uint32_t []>(regSize / sizeof (uint32_t ));
348
+
346
349
for (auto &threadID : threadIds) {
347
- uint32_t reg[8 ] = {};
348
350
auto apiThread = convertToApi (threadID);
349
- if (readRegistersImp (apiThread, registerType, 0 , 1 , reg) != ZE_RESULT_SUCCESS) {
351
+ memset (reg.get (), 0 , regSize);
352
+
353
+ if (readRegistersImp (apiThread, registerType, 0 , 1 , reg.get ()) != ZE_RESULT_SUCCESS) {
350
354
success = false ;
351
355
} else {
352
356
reg[dword] |= sipResumeValue;
353
- if (writeRegistersImp (apiThread, registerType, 0 , 1 , reg) != ZE_RESULT_SUCCESS) {
357
+ if (writeRegistersImp (apiThread, registerType, 0 , 1 , reg. get () ) != ZE_RESULT_SUCCESS) {
354
358
success = false ;
355
359
}
356
360
}
@@ -626,14 +630,16 @@ bool DebugSessionImp::isForceExceptionOrForceExternalHaltOnlyExceptionReason(uin
626
630
627
631
void DebugSessionImp::fillResumeAndStoppedThreadsFromNewlyStopped (std::vector<EuThread::ThreadId> &resumeThreads, std::vector<EuThread::ThreadId> &stoppedThreadsToReport) {
628
632
633
+ const auto regSize = std::max (getRegisterSize (ZET_DEBUG_REGSET_TYPE_CR_INTEL_GPU), 64u );
634
+ auto reg = std::make_unique<uint32_t []>(regSize / sizeof (uint32_t ));
635
+
629
636
for (auto &newlyStopped : newlyStoppedThreads) {
630
637
if (allThreads[newlyStopped]->isStopped ()) {
631
- uint32_t reg[8 ] = {};
632
-
638
+ memset (reg.get (), 0 , regSize);
633
639
ze_device_thread_t apiThread = convertToApi (newlyStopped);
634
- readRegistersImp (apiThread, ZET_DEBUG_REGSET_TYPE_CR_INTEL_GPU, 0 , 1 , reg);
640
+ readRegistersImp (apiThread, ZET_DEBUG_REGSET_TYPE_CR_INTEL_GPU, 0 , 1 , reg. get () );
635
641
636
- if (isForceExceptionOrForceExternalHaltOnlyExceptionReason (reg)) {
642
+ if (isForceExceptionOrForceExternalHaltOnlyExceptionReason (reg. get () )) {
637
643
PRINT_DEBUGGER_THREAD_LOG (" RESUME accidentally stopped thread = %s\n " , allThreads[newlyStopped]->toString ().c_str ());
638
644
resumeThreads.push_back (newlyStopped);
639
645
} else {
@@ -727,7 +733,10 @@ const SIP::regset_desc *DebugSessionImp::getSbaRegsetDesc() {
727
733
const SIP::regset_desc *DebugSessionImp::typeToRegsetDesc (uint32_t type) {
728
734
auto pStateSaveAreaHeader = getStateSaveAreaHeader ();
729
735
730
- UNRECOVERABLE_IF (pStateSaveAreaHeader == nullptr );
736
+ DEBUG_BREAK_IF (pStateSaveAreaHeader == nullptr );
737
+ if (pStateSaveAreaHeader == nullptr ) {
738
+ return nullptr ;
739
+ }
731
740
732
741
switch (type) {
733
742
case ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU:
@@ -757,6 +766,14 @@ const SIP::regset_desc *DebugSessionImp::typeToRegsetDesc(uint32_t type) {
757
766
}
758
767
}
759
768
769
+ uint32_t DebugSessionImp::getRegisterSize (uint32_t type) {
770
+ auto regset = typeToRegsetDesc (type);
771
+ if (regset) {
772
+ return regset->bytes ;
773
+ }
774
+ return 0 ;
775
+ }
776
+
760
777
uint32_t DebugSessionImp::typeToRegsetFlags (uint32_t type) {
761
778
switch (type) {
762
779
case ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU:
@@ -806,8 +823,11 @@ ze_result_t DebugSessionImp::readSbaRegisters(ze_device_thread_t thread, uint32_
806
823
return ret;
807
824
}
808
825
809
- uint32_t r0[8 ];
810
- ret = readRegistersImp (thread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0 , 1 , r0);
826
+ const auto &hwInfo = connectedDevice->getHwInfo ();
827
+ const auto regSize = std::max (getRegisterSize (ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU), hwInfo.capabilityTable .grfSize );
828
+ auto r0 = std::make_unique<uint32_t []>(regSize / sizeof (uint32_t ));
829
+
830
+ ret = readRegistersImp (thread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0 , 1 , r0.get ());
811
831
if (ret != ZE_RESULT_SUCCESS) {
812
832
return ret;
813
833
}
0 commit comments