summaryrefslogtreecommitdiff
path: root/offload/test/offloading
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /offload/test/offloading
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'offload/test/offloading')
-rw-r--r--offload/test/offloading/fortran/dtype-char-array-map-2.f9025
-rw-r--r--offload/test/offloading/fortran/dtype-char-array-map.f9027
-rw-r--r--offload/test/offloading/mandatory_but_no_devices.c43
-rw-r--r--offload/test/offloading/memory_manager.cpp2
4 files changed, 93 insertions, 4 deletions
diff --git a/offload/test/offloading/fortran/dtype-char-array-map-2.f90 b/offload/test/offloading/fortran/dtype-char-array-map-2.f90
new file mode 100644
index 000000000000..f17ea9e53853
--- /dev/null
+++ b/offload/test/offloading/fortran/dtype-char-array-map-2.f90
@@ -0,0 +1,25 @@
+! Offloading test that verifies certain type of character string arrays
+! map to and from device without problem.
+! REQUIRES: flang, amdgpu
+
+! RUN: %libomptarget-compile-fortran-run-and-check-generic
+program main
+ implicit none
+ type char_t
+ CHARACTER(LEN=16), dimension(10,10) :: char_arr
+ end type char_t
+ type(char_t) :: dtype_char
+
+!$omp target enter data map(alloc:dtype_char%char_arr)
+
+!$omp target
+ dtype_char%char_arr(2,2) = 'c'
+!$omp end target
+
+!$omp target update from(dtype_char%char_arr)
+
+
+ print *, dtype_char%char_arr(2,2)
+end program
+
+!CHECK: c
diff --git a/offload/test/offloading/fortran/dtype-char-array-map.f90 b/offload/test/offloading/fortran/dtype-char-array-map.f90
new file mode 100644
index 000000000000..6b72c9e95101
--- /dev/null
+++ b/offload/test/offloading/fortran/dtype-char-array-map.f90
@@ -0,0 +1,27 @@
+! Offloading test that verifies certain type of character string arrays
+! (in this case allocatable) map to and from device without problem.
+! REQUIRES: flang, amdgpu
+
+! RUN: %libomptarget-compile-fortran-run-and-check-generic
+program main
+ implicit none
+ type char_t
+ CHARACTER(LEN=16), dimension(:,:), allocatable :: char_arr
+ end type char_t
+ type(char_t) :: dtype_char
+
+ allocate(dtype_char%char_arr(10,10))
+
+!$omp target enter data map(alloc:dtype_char%char_arr)
+
+!$omp target
+ dtype_char%char_arr(2,2) = 'c'
+!$omp end target
+
+!$omp target update from(dtype_char%char_arr)
+
+
+ print *, dtype_char%char_arr(2,2)
+end program
+
+!CHECK: c
diff --git a/offload/test/offloading/mandatory_but_no_devices.c b/offload/test/offloading/mandatory_but_no_devices.c
index ecdee72acad0..df8a5f3b9278 100644
--- a/offload/test/offloading/mandatory_but_no_devices.c
+++ b/offload/test/offloading/mandatory_but_no_devices.c
@@ -3,6 +3,47 @@
// device. This behavior is proposed for OpenMP 5.2 in OpenMP spec github
// issue 2669.
+// AMD Tests
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -DDIR=target
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -DDIR='target teams'
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa -DDIR='target data map(X)'
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \
+// RUN: -DDIR='target enter data map(to:X)'
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \
+// RUN: -DDIR='target exit data map(from:X)'
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \
+// RUN: -DDIR='target update to(X)'
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// RUN: %libomptarget-compile-amdgcn-amd-amdhsa \
+// RUN: -DDIR='target update from(X)'
+// RUN: env OMP_TARGET_OFFLOAD=mandatory ROCR_VISIBLE_DEVICES= \
+// RUN: %libomptarget-run-fail-amdgcn-amd-amdhsa 2>&1 | \
+// RUN: %fcheck-amdgcn-amd-amdhsa
+
+// Nvidia Tests
// RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DDIR=target
// RUN: env OMP_TARGET_OFFLOAD=mandatory CUDA_VISIBLE_DEVICES= \
// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
@@ -42,8 +83,6 @@
// RUN: %libomptarget-run-fail-nvptx64-nvidia-cuda 2>&1 | \
// RUN: %fcheck-nvptx64-nvidia-cuda
-// REQUIRES: nvptx64-nvidia-cuda
-
#include <omp.h>
#include <stdio.h>
diff --git a/offload/test/offloading/memory_manager.cpp b/offload/test/offloading/memory_manager.cpp
index fba1e4a54012..d6d8697fcdec 100644
--- a/offload/test/offloading/memory_manager.cpp
+++ b/offload/test/offloading/memory_manager.cpp
@@ -1,7 +1,5 @@
// RUN: %libomptarget-compilexx-run-and-check-generic
-// REQUIRES: nvidiagpu
-
#include <omp.h>
#include <cassert>