[Openmp-commits] [openmp] 93e7571 - [OpenMP][AMDGPU][NFC] Improve error message for errors
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jan 3 17:10:25 PST 2023
Author: Johannes Doerfert
Date: 2023-01-03T17:09:32-08:00
New Revision: 93e75714cdac3a83635da9cd68d866d518debe31
URL: https://github.com/llvm/llvm-project/commit/93e75714cdac3a83635da9cd68d866d518debe31
DIFF: https://github.com/llvm/llvm-project/commit/93e75714cdac3a83635da9cd68d866d518debe31.diff
LOG: [OpenMP][AMDGPU][NFC] Improve error message for errors
Added:
Modified:
openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 53c5a20c3680..10477aee829f 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -2320,26 +2320,33 @@ struct AMDGPUPluginTy final : public GenericPluginTy {
std::string Reasons;
uint32_t ReasonsMask = Event->memory_fault.fault_reason_mask;
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_PAGE_NOT_PRESENT)
- Reasons += "HSA_AMD_MEMORY_FAULT_PAGE_NOT_PRESENT\n";
+ Reasons += "HSA_AMD_MEMORY_FAULT_PAGE_NOT_PRESENT, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_READ_ONLY)
- Reasons += " HSA_AMD_MEMORY_FAULT_READ_ONLY\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_READ_ONLY, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_NX)
- Reasons += " HSA_AMD_MEMORY_FAULT_NX\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_NX, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_HOST_ONLY)
- Reasons += " HSA_AMD_MEMORY_FAULT_HOST_ONLY\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_HOST_ONLY, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_DRAMECC)
- Reasons += " HSA_AMD_MEMORY_FAULT_DRAMECC\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_DRAMECC, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_IMPRECISE)
- Reasons += " HSA_AMD_MEMORY_FAULT_IMPRECISE\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_IMPRECISE, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_SRAMECC)
- Reasons += " HSA_AMD_MEMORY_FAULT_SRAMECC\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_SRAMECC, ";
if (ReasonsMask & HSA_AMD_MEMORY_FAULT_HANG)
- Reasons += " HSA_AMD_MEMORY_FAULT_HANG\n";
+ Reasons += " HSA_AMD_MEMORY_FAULT_HANG, ";
+
+ // If we do not know the reason, say so, otherwise remove the trailing comma
+ // and space.
+ if (Reasons.empty())
+ Reasons = "Unknown (Mask: " + std::to_string(ReasonsMask) + ")";
+ else
+ Reasons.resize(Reasons.size() - /* ', ' */ 2);
// Abort the execution since we do not recover from this error.
FATAL_MESSAGE(1,
"Found HSA_AMD_GPU_MEMORY_FAULT_EVENT in agent %" PRIu64
- " at virtual address %p and reasons:\n %s",
+ " at virtual address %p and reasons: %s",
Event->memory_fault.agent.handle,
(void *)Event->memory_fault.virtual_address, Reasons.data());
More information about the Openmp-commits
mailing list