From 32766de8510ae2e510000517dc672849e91d9e59 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Thu, 15 Jul 2021 14:28:48 -0500 Subject: [PATCH] Add support for reporting vm faults through the queue error handler. Under xnack we can now identify the queue which generated a vm fault. This allows users to identify which queue, and therefore which dispatch, a vm fault came from. Change-Id: If72ff3de05800f2b811aa7842a15eedff8b5e45a [ROCm/ROCR-Runtime commit: 59ee761f8135f7822d4dde3d52a4520b1eac0ab8] --- .../runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp | 2 +- .../rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp | 4 ++++ .../rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp index d6eea8c122..19d5cc622d 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_aql_queue.cpp @@ -970,7 +970,7 @@ bool AqlQueue::ExceptionHandler(hsa_signal_value_t error_code, void* arg) { // EC_QUEUE_WAVE_ILLEGAL_INSTRUCTION 4, (hsa_status_t)HSA_STATUS_ERROR_ILLEGAL_INSTRUCTION, // EC_QUEUE_WAVE_MEMORY_VIOLATION - 5, HSA_STATUS_ERROR, + 5, (hsa_status_t)HSA_STATUS_ERROR_MEMORY_FAULT, // EC_QUEUE_WAVE_APERTURE_VIOLATION 6, (hsa_status_t)HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION, // EC_QUEUE_PACKET_DISPATCH_DIM_INVALID diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp index f496f2ca9d..b2d1f6537c 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp @@ -2758,6 +2758,10 @@ hsa_status_t hsa_status_string( *status_string = "HSA_EXT_STATUS_ERROR_DIRECTIVE_MISMATCH: Directive mismatch"; break; + case HSA_STATUS_ERROR_MEMORY_FAULT: + *status_string = + "HSA_STATUS_ERROR_MEMORY_FAULT: Agent attempted to access an inaccessible address."; + break; default: return HSA_STATUS_ERROR_INVALID_ARGUMENT; } diff --git a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h index df48de94ec..b1ba20f631 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h @@ -184,6 +184,13 @@ enum { * Agent executed an invalid shader instruction. */ HSA_STATUS_ERROR_ILLEGAL_INSTRUCTION = 42, + + /** + * Agent attempted to access an inaccessible address. + * See hsa_amd_register_system_event_handler and + * HSA_AMD_GPU_MEMORY_FAULT_EVENT for more information on illegal accesses. + */ + HSA_STATUS_ERROR_MEMORY_FAULT = 43, }; /**