From 4370aa136459a60cccd4a5cd17401e0cb5721845 Mon Sep 17 00:00:00 2001 From: Alex Sierra Date: Thu, 16 Feb 2023 16:32:23 -0600 Subject: [PATCH] reports KFD core dump support through hsakmt API Member added to KFDVersion to report if KFD supports core dump mechanism. This is done through hsaKmtRuntimeEnable API call while the topology is being built. It also dictates if core dump will be generated by either KFD or hsa-runtime. Signed-off-by: Alex Sierra Change-Id: I2e9d4166563402f78613d728446feb692c52d9d1 [ROCm/ROCR-Runtime commit: 54604654bde5134ba01ce3e03ab63db26d014f3d] --- projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h | 4 +++- .../runtime/hsa-runtime/core/runtime/amd_topology.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h index e7f856b067..d2d9d48e16 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h @@ -124,6 +124,7 @@ class Runtime { HsaVersionInfo version; bool supports_exception_debugging; bool supports_event_age; + bool supports_core_dump; }; /// @brief Open connection to kernel driver and increment reference count. @@ -451,8 +452,9 @@ class Runtime { kfd_version.supports_event_age = true; } - void KfdVersion(bool exception_debugging) { + void KfdVersion(bool exception_debugging, bool core_dump) { kfd_version.supports_exception_debugging = exception_debugging; + kfd_version.supports_core_dump = core_dump; } KfdVersion_t KfdVersion() const { return kfd_version; } diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp index fc0d98ca9e..142175c326 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_topology.cpp @@ -417,7 +417,10 @@ bool Load() { HSAKMT_STATUS err = hsaKmtRuntimeEnable(&_amdgpu_r_debug, core::Runtime::runtime_singleton_->flag().debug()); if ((err != HSAKMT_STATUS_SUCCESS) && (err != HSAKMT_STATUS_NOT_SUPPORTED)) return false; - core::Runtime::runtime_singleton_->KfdVersion(err != HSAKMT_STATUS_NOT_SUPPORTED); + HSAuint32 caps_mask; + hsaKmtGetRuntimeCapabilities(&caps_mask); + core::Runtime::runtime_singleton_->KfdVersion(err != HSAKMT_STATUS_NOT_SUPPORTED, + !!(caps_mask & HSA_RUNTIME_ENABLE_CAPS_SUPPORTS_CORE_DUMP_MASK)); kfd.Dismiss(); return true;