diff --git a/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index 79b6d72b34..38e815b7ec 100644 --- a/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -1272,8 +1272,11 @@ bool AqlQueue::ExceptionHandler(hsa_signal_value_t error_code, void* arg) { // generated by hsa-runtime. if (!core::Runtime::runtime_singleton_->KfdVersion().supports_core_dump && queue->agent_->isa()->GetMajorVersion() != 11) { - if (amd::coredump::dump_gpu_core()) - debug_print("GPU core dump failed\n"); + + 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( diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 62e9362d68..740fd1c941 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -1804,8 +1804,11 @@ bool Runtime::VMFaultHandler(hsa_signal_value_t val, void* arg) { // generated by hsa-runtime. if (faulty_agent && faulty_agent->isa()->GetMajorVersion() != 11 && !runtime_singleton_->KfdVersion().supports_core_dump) { - if (amd::coredump::dump_gpu_core()) - debug_print("GPU core dump failed\n"); + + 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"); } assert(false && "GPU memory access fault."); std::abort(); diff --git a/runtime/hsa-runtime/pcs/pcs_runtime.cpp b/runtime/hsa-runtime/pcs/pcs_runtime.cpp index 8270a90fe6..9d453bb319 100644 --- a/runtime/hsa-runtime/pcs/pcs_runtime.cpp +++ b/runtime/hsa-runtime/pcs/pcs_runtime.cpp @@ -100,6 +100,10 @@ void PcsRuntime::DestroySingleton() { void ReleasePcSamplingRsrcs() { PcsRuntime::DestroySingleton(); } +bool PcsRuntime::SessionsActive() const { + return pc_sampling_.size() > 0; +} + PcsRuntime::PcSamplingSession::PcSamplingSession( core::Agent* _agent, hsa_ven_amd_pcs_method_kind_t method, hsa_ven_amd_pcs_units_t units, size_t interval, size_t latency, size_t buffer_size, diff --git a/runtime/hsa-runtime/pcs/pcs_runtime.h b/runtime/hsa-runtime/pcs/pcs_runtime.h index 6d8db2127f..6fa489c738 100644 --- a/runtime/hsa-runtime/pcs/pcs_runtime.h +++ b/runtime/hsa-runtime/pcs/pcs_runtime.h @@ -65,6 +65,8 @@ class PcsRuntime { /// @brief Getter for the PcsRuntime singleton object. static PcsRuntime* instance(); + bool SessionsActive() const; + /// @brief Destroy singleton object. static void DestroySingleton();