SpiecsEngine
 
Loading...
Searching...
No Matches

◆ AftermathDeviceLostCheck()

void Spices::GpuCrashTracker::AftermathDeviceLostCheck ( )
static

Aftermath handle device lost function.

Definition at line 83 of file NsightAftermathGpuCrashTracker.cpp.

84 {
86
87 // Device lost notification is asynchronous to the NVIDIA display
88 // driver's GPU crash handling. Give the Nsight Aftermath GPU crash dump
89 // thread some time to do its work before terminating the process.
90 constexpr auto tdrTerminationTimeout = std::chrono::seconds(3);
91 const auto tStart = std::chrono::steady_clock::now();
92 auto tElapsed = std::chrono::milliseconds::zero();
93
94 GFSDK_Aftermath_CrashDump_Status status = GFSDK_Aftermath_CrashDump_Status_Unknown;
95 AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetCrashDumpStatus(&status));
96
97 while (status != GFSDK_Aftermath_CrashDump_Status_CollectingDataFailed &&
98 status != GFSDK_Aftermath_CrashDump_Status_Finished &&
99 tElapsed < tdrTerminationTimeout)
100 {
101 // Sleep 50ms and poll the status again until timeout or Aftermath finished processing the crash dump.
102 std::this_thread::sleep_for(std::chrono::milliseconds(50));
103 AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetCrashDumpStatus(&status));
104
105 auto tEnd = std::chrono::steady_clock::now();
106 tElapsed = std::chrono::duration_cast<std::chrono::milliseconds>(tEnd - tStart);
107 }
108
109 if (status == GFSDK_Aftermath_CrashDump_Status_Finished)
110 {
111 std::stringstream ss;
112 ss << "Aftermath finished processing the crash dump ";
113 SPICES_CORE_INFO(ss.str());
114 }
115 else
116 {
117 std::stringstream err_msg;
118 err_msg << "Unexpected crash dump status: " << status;
119 SPICES_CORE_CRITICAL(err_msg.str().c_str())
120 }
121
122 // Terminate on failure
123 exit(1);
124 }
#define AFTERMATH_CHECK_ERROR(FC)
Helper macro for checking Nsight Aftermath results and throwing exception in case of a failure.
#define SPICES_PROFILE_ZONE