From aae4dab88e467d390a874da526541fd8ebfc274e Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 16 Aug 2024 15:21:54 +0000 Subject: [PATCH] Do not generate coredump on VM fault signal event Skip coredump generation when receiving HSA_STATUS_ERROR_MEMORY_FAULT. We also receive a system error of type HSA_EVENTTYPE_MEMORY and generate the coredump there. Trying to generate coredump from 2 places sometimes causes unnecessary error message because both places try to create a coredump file with the same name. Change-Id: If3f03bab2c24ad71dfeff39ab411bb9ac08b337e Signed-off-by: David Yat Sin --- .../core/runtime/amd_aql_queue.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index 4720a6b32b..c823e59087 100644 --- a/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -1290,21 +1290,6 @@ bool AqlQueue::ExceptionHandler(hsa_signal_value_t error_code, void* arg) { return false; } - // Fallback if KFD does not support GPU core dump. In this case, there core dump is - // generated by hsa-runtime. - if (!core::Runtime::runtime_singleton_->KfdVersion().supports_core_dump && - queue->agent_->isa()->GetMajorVersion() != 11) { - - if (pcs::PcsRuntime::instance()->SessionsActive()) - fprintf(stderr, "GPU core dump skipped because PC Sampling active\n"); - else if (amd::coredump::dump_gpu_core()) - fprintf(stderr, "GPU core dump failed\n"); - // supports_core_dump flag is overwritten to avoid generate core dump file again - // caught by a different exception handler. Such as VMFaultHandler. - core::Runtime::runtime_singleton_->KfdVersion( - core::Runtime::runtime_singleton_->KfdVersion().supports_exception_debugging, true); - } - for (auto& error : QueueErrors) { if (error_code & (1 << (error.code - 1))) { errorCode = error.status; @@ -1322,6 +1307,21 @@ bool AqlQueue::ExceptionHandler(hsa_signal_value_t error_code, void* arg) { return false; } + // Fallback if KFD does not support GPU core dump. In this case, there core dump is + // generated by hsa-runtime. + if (!core::Runtime::runtime_singleton_->KfdVersion().supports_core_dump && + queue->agent_->isa()->GetMajorVersion() != 11) { + + if (pcs::PcsRuntime::instance()->SessionsActive()) + fprintf(stderr, "GPU core dump skipped because PC Sampling active\n"); + else if (amd::coredump::dump_gpu_core()) + fprintf(stderr, "GPU core dump failed\n"); + // supports_core_dump flag is overwritten to avoid generate core dump file again + // caught by a different exception handler. Such as VMFaultHandler. + core::Runtime::runtime_singleton_->KfdVersion( + core::Runtime::runtime_singleton_->KfdVersion().supports_exception_debugging, true); + } + queue->Suspend(); if (queue->errors_callback_ != nullptr) { queue->errors_callback_(errorCode, queue->public_handle(), queue->errors_data_);