[llvm] [Offload] Improve error reporting on memory faults (PR #104254)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 14:37:14 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff d213981c80626698a07b11ce872acba098a863d4 f3f87e126c2be7a6f9d219cf3aae4c935ffb88c2 --extensions c,cpp,h -- offload/test/sanitizer/ptr_outside_alloc_1.c offload/test/sanitizer/ptr_outside_alloc_2.c offload/test/sanitizer/use_after_free_1.c offload/test/sanitizer/use_after_free_2.c offload/plugins-nextgen/amdgpu/src/rtl.cpp offload/plugins-nextgen/common/include/ErrorReporting.h offload/plugins-nextgen/common/include/PluginInterface.h offload/test/sanitizer/double_free.c offload/test/sanitizer/double_free_racy.c offload/test/sanitizer/free_wrong_ptr_kind.c offload/test/sanitizer/free_wrong_ptr_kind.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/offload/test/sanitizer/ptr_outside_alloc_1.c b/offload/test/sanitizer/ptr_outside_alloc_1.c
index ae7dbb1cfb..86b626f2b4 100644
--- a/offload/test/sanitizer/ptr_outside_alloc_1.c
+++ b/offload/test/sanitizer/ptr_outside_alloc_1.c
@@ -26,13 +26,13 @@ int main() {
     P = &A[0];
     *P = 3;
   }
-// clang-format off
+  // clang-format off
 // CHECK: OFFLOAD ERROR: Memory access fault by GPU {{.*}} (agent 0x{{.*}}) at virtual address [[PTR:0x[0-9a-z]*]]. Reasons: {{.*}}
 // NTRCE: Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations
 // TRACE: Device pointer [[PTR]] does not point into any (current or prior) host-issued allocation.
 // TRACE: Closest host-issued allocation (distance 4096 bytes; might be by page):
 // TRACE: Last allocation of size 1073741824
-// clang-format on
+  // clang-format on
 #pragma omp target
   { P[-4] = 5; }
 
diff --git a/offload/test/sanitizer/use_after_free_1.c b/offload/test/sanitizer/use_after_free_1.c
index 3e3b130873..b44f37f479 100644
--- a/offload/test/sanitizer/use_after_free_1.c
+++ b/offload/test/sanitizer/use_after_free_1.c
@@ -27,13 +27,13 @@ int main() {
     *P = 3;
   }
   llvm_omp_target_free_host(A, omp_get_default_device());
-// clang-format off
+  // clang-format off
 // CHECK: OFFLOAD ERROR: Memory access fault by GPU {{.*}} (agent 0x{{.*}}) at virtual address [[PTR:0x[0-9a-z]*]]. Reasons: {{.*}}
 // NTRCE: Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations
 // TRACE: Device pointer [[PTR]] points into prior host-issued allocation:
 // TRACE: Last deallocation:
 // TRACE: Last allocation of size 1073741824
-// clang-format on
+  // clang-format on
 #pragma omp target
   { *P = 5; }
 }
diff --git a/offload/test/sanitizer/use_after_free_2.c b/offload/test/sanitizer/use_after_free_2.c
index 581cf1abc9..b9e5f7fdc5 100644
--- a/offload/test/sanitizer/use_after_free_2.c
+++ b/offload/test/sanitizer/use_after_free_2.c
@@ -21,12 +21,12 @@ int main() {
     P = &A[N / 2];
     *P = 3;
   }
-// clang-format off
+  // clang-format off
 // CHECK: OFFLOAD ERROR: Memory access fault by GPU {{.*}} (agent 0x{{.*}}) at virtual address [[PTR:0x[0-9a-z]*]]. Reasons: {{.*}}
 // CHECK: Device pointer [[PTR]] points into prior host-issued allocation:
 // CHECK: Last deallocation:
 // CHECK: Last allocation of size 1073741824
-// clang-format on
+  // clang-format on
 #pragma omp target
   { *P = 5; }
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/104254


More information about the llvm-commits mailing list