diff options
Diffstat (limited to 'offload')
-rw-r--r-- | offload/cmake/caches/AMDGPULibcBot.cmake | 3 | ||||
-rw-r--r-- | offload/test/lit.cfg | 2 | ||||
-rw-r--r-- | offload/test/offloading/fortran/dtype-char-array-map-2.f90 | 25 | ||||
-rw-r--r-- | offload/test/offloading/fortran/dtype-char-array-map.f90 | 27 | ||||
-rw-r--r-- | offload/unittests/OffloadAPI/common/Environment.cpp | 3 | ||||
-rw-r--r-- | offload/unittests/OffloadAPI/common/Fixtures.hpp | 6 |
6 files changed, 64 insertions, 2 deletions
diff --git a/offload/cmake/caches/AMDGPULibcBot.cmake b/offload/cmake/caches/AMDGPULibcBot.cmake index ffaa0c6..798f080 100644 --- a/offload/cmake/caches/AMDGPULibcBot.cmake +++ b/offload/cmake/caches/AMDGPULibcBot.cmake @@ -17,5 +17,6 @@ set(CLANG_DEFAULT_LINKER "lld" CACHE STRING "") set(CLANG_DEFAULT_RTLIB "compiler-rt" STRING "") set(LLVM_RUNTIME_TARGETS default;amdgcn-amd-amdhsa CACHE STRING "") -set(RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES "compiler-rt;openmp;libc" CACHE STRING "") +set(RUNTIMES_amdgcn-amd-amdhsa_CACHE_FILES "${CMAKE_SOURCE_DIR}/../libcxx/cmake/caches/AMDGPU.cmake" CACHE STRING "") +set(RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES "compiler-rt;openmp;libc;libcxxabi;libcxx" CACHE STRING "") set(RUNTIMES_amdgcn-amd-amdhsa_LIBC_GPU_TEST_JOBS 4 CACHE STRING "") diff --git a/offload/test/lit.cfg b/offload/test/lit.cfg index a41bcb9..c0290bf 100644 --- a/offload/test/lit.cfg +++ b/offload/test/lit.cfg @@ -83,6 +83,7 @@ config.test_format = lit.formats.ShTest() config.test_flags = " -I " + config.test_source_root + \ " -I " + config.omp_header_directory + \ " -L " + config.library_dir + \ + " -L " + config.llvm_library_intdir + \ " -L " + config.llvm_lib_directory # compiler specific flags @@ -165,6 +166,7 @@ else: # Unices config.test_flags += " -nogpulib" config.test_flags += " -Wl,-rpath," + config.library_dir config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory + config.test_flags += " -Wl,-rpath," + config.llvm_library_intdir config.test_flags += " -Wl,-rpath," + config.llvm_lib_directory if config.cuda_libdir: config.test_flags += " -Wl,-rpath," + config.cuda_libdir 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 0000000..f17ea9e --- /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 0000000..6b72c9e --- /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/unittests/OffloadAPI/common/Environment.cpp b/offload/unittests/OffloadAPI/common/Environment.cpp index 8007713..c9da6ef 100644 --- a/offload/unittests/OffloadAPI/common/Environment.cpp +++ b/offload/unittests/OffloadAPI/common/Environment.cpp @@ -129,6 +129,9 @@ const std::vector<TestEnvironment::Device> &TestEnvironment::getDevices() { } } + if (Devices.size() == 0) + errs() << "Warning: No devices found for OffloadAPI tests.\n"; + return Devices; } diff --git a/offload/unittests/OffloadAPI/common/Fixtures.hpp b/offload/unittests/OffloadAPI/common/Fixtures.hpp index 0538e60f..c5a35fa 100644 --- a/offload/unittests/OffloadAPI/common/Fixtures.hpp +++ b/offload/unittests/OffloadAPI/common/Fixtures.hpp @@ -250,9 +250,13 @@ struct OffloadEventTest : OffloadQueueTest { ol_event_handle_t Event = nullptr; }; +// Devices might not be available for offload testing, so allow uninstantiated +// tests (as the device list will be empty). This means that all tests requiring +// a device will be silently skipped. #define OFFLOAD_TESTS_INSTANTIATE_DEVICE_FIXTURE(FIXTURE) \ INSTANTIATE_TEST_SUITE_P( \ , FIXTURE, ::testing::ValuesIn(TestEnvironment::getDevices()), \ [](const ::testing::TestParamInfo<TestEnvironment::Device> &info) { \ return SanitizeString(info.param.Name); \ - }) + }); \ + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FIXTURE) |