[llvm] [OFFLOAD] Fix an issue with nested close, alloc mapping when using USM (PR #208122)
Abhinav Gaba via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 19:07:20 PDT 2026
================
@@ -0,0 +1,32 @@
+// RUN: %libomptarget-compile-run-and-check-generic
+
+// REQUIRES: unified_shared_memory
+// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
+
+// amdgpu runtime crash
+// Fails on nvptx with error: an illegal memory access was encountered
+// UNSUPPORTED: amdgcn-amd-amdhsa
+// UNSUPPORTED: nvptx64-nvidia-cuda
+// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
+// UNSUPPORTED: intelgpu
+
+#pragma omp requires unified_shared_memory
+
+#include <stdio.h>
+
+int main() {
+ double base[10] = {0};
----------------
abhinavgaba wrote:
You won't see 99 with declare_target unless you either use `target update from` or use `target data map (always, from:...)` to bring the data back:
```c
#pragma omp begin declare target
int base[10] = {0};
#pragma omp end declare target
int main() {
#pragma omp target map(close, alloc : base[1])
{
base[1] = 99;
}
#pragma omp target update from(base)
// CHECK: base[1] = 99 (expected 99)
printf("base[1] = %d (expected 99)\n", base[1]);
}
```
https://github.com/llvm/llvm-project/pull/208122
More information about the llvm-commits
mailing list