diff --git a/test/smoke-dev/flang-273759/flang-273759.f95 b/test/smoke-dev/flang-273759/flang-273759.f95 index eeb532a267..5a84eaab8d 100644 --- a/test/smoke-dev/flang-273759/flang-273759.f95 +++ b/test/smoke-dev/flang-273759/flang-273759.f95 @@ -1,8 +1,9 @@ ! example of simple Fortran AMD GPU offloading program main + implicit none parameter (nsize=1000) real a(nsize), b(nsize), c(nsize) - integer i + integer i, nsize do i=1,nsize a(i)=0 @@ -24,9 +25,10 @@ program main ! call exit(1) end subroutine foo(a,b,c) + implicit none parameter (nsize=1000) real a(nsize), b(nsize), c(nsize) - integer i + integer i, omp_q, nsize !$omp target map(from:a) map(to:b,c) depend(out:omp_q) !$omp parallel do do i=1,nsize diff --git a/test/smoke-fort-dev/rocm-issue-2419/Makefile b/test/smoke-fort-dev/rocm-issue-2419/Makefile new file mode 100644 index 0000000000..7ee1072d41 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2419/Makefile @@ -0,0 +1,20 @@ +#NOOPT = 1 +#NOOMP = 1 +#OMP_FLAGS = -DNO_OMP +include ../../Makefile.defs + +TESTNAME = minimal +TESTSRC_MAIN = minimal.f90 +TESTSRC_AUX = +TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) + +FLANG ?= flang +CFLAGS = $(FLANG_GPU_LINK_FLAGS) +OMP_BIN = $(AOMP)/bin/$(FLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME} + +include ../Makefile.rules diff --git a/test/smoke-fort-dev/rocm-issue-2419/chk.stderr b/test/smoke-fort-dev/rocm-issue-2419/chk.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/smoke-fort-dev/rocm-issue-2419/chk.stdout b/test/smoke-fort-dev/rocm-issue-2419/chk.stdout new file mode 100644 index 0000000000..ec6df1d594 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2419/chk.stdout @@ -0,0 +1 @@ + 1. diff --git a/test/smoke-fort-dev/rocm-issue-2419/chkit.sh b/test/smoke-fort-dev/rocm-issue-2419/chkit.sh new file mode 100755 index 0000000000..925eb16390 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2419/chkit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +diff -w "$1.stderr.log" chk.stderr +diff -w "$1.stdout.log" chk.stdout diff --git a/test/smoke-fort-dev/rocm-issue-2419/doit.sh b/test/smoke-fort-dev/rocm-issue-2419/doit.sh new file mode 100755 index 0000000000..8f1e6a1439 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2419/doit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -f "$1.stdout.log" "$1.stderr.log" +"./$1" 2> "$1.stderr.log" | tee -a "$1.stdout.log" diff --git a/test/smoke-fort-dev/rocm-issue-2419/minimal.f90 b/test/smoke-fort-dev/rocm-issue-2419/minimal.f90 new file mode 100644 index 0000000000..81821b0ba9 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2419/minimal.f90 @@ -0,0 +1,26 @@ +program minimal + implicit none + integer, parameter :: n = 64 + real, allocatable :: b(:,:) + allocate(b(n,n)) + b = 0.0 + !$OMP target data map(tofrom: b) + call compute(b) + !$OMP end target data + write(*,*) b(1,1) +contains + subroutine compute(b) + real, dimension(:,:), intent(inout) :: b + real, dimension(size(b, 1)) :: tmp ! automatic array sized from assumed-shape arg + integer :: i, j, k + !$OMP target teams distribute parallel do collapse(2) private(tmp) + do j = 1, size(b, 2) + do i = 1, size(b, 1) + do k = 1, size(b, 1) + tmp(k) = 1.0 + end do + b(i,j) = tmp(1) + end do + end do + end subroutine +end program diff --git a/test/smoke-fort-dev/rocm-issue-2601-1/Makefile b/test/smoke-fort-dev/rocm-issue-2601-1/Makefile new file mode 100644 index 0000000000..2de9adf337 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-1/Makefile @@ -0,0 +1,20 @@ +#NOOPT = 1 +#NOOMP = 1 +#OMP_FLAGS = -DNO_OMP +include ../../Makefile.defs + +TESTNAME = minimal +TESTSRC_MAIN = minimal_array_constructor.f90 +TESTSRC_AUX = +TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) + +FLANG ?= flang +CFLAGS = -fopenmp-target-fast -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription +OMP_BIN = $(AOMP)/bin/$(FLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME} + +include ../Makefile.rules diff --git a/test/smoke-fort-dev/rocm-issue-2601-1/chk.stderr b/test/smoke-fort-dev/rocm-issue-2601-1/chk.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/smoke-fort-dev/rocm-issue-2601-1/chk.stdout b/test/smoke-fort-dev/rocm-issue-2601-1/chk.stdout new file mode 100644 index 0000000000..660b40f440 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-1/chk.stdout @@ -0,0 +1 @@ + PASS diff --git a/test/smoke-fort-dev/rocm-issue-2601-1/chkit.sh b/test/smoke-fort-dev/rocm-issue-2601-1/chkit.sh new file mode 100755 index 0000000000..925eb16390 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-1/chkit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +diff -w "$1.stderr.log" chk.stderr +diff -w "$1.stdout.log" chk.stdout diff --git a/test/smoke-fort-dev/rocm-issue-2601-1/doit.sh b/test/smoke-fort-dev/rocm-issue-2601-1/doit.sh new file mode 100755 index 0000000000..8f1e6a1439 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-1/doit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -f "$1.stdout.log" "$1.stderr.log" +"./$1" 2> "$1.stderr.log" | tee -a "$1.stdout.log" diff --git a/test/smoke-fort-dev/rocm-issue-2601-1/minimal_array_constructor.f90 b/test/smoke-fort-dev/rocm-issue-2601-1/minimal_array_constructor.f90 new file mode 100644 index 0000000000..f104308e9e --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-1/minimal_array_constructor.f90 @@ -0,0 +1,30 @@ +program minimal_array_constructor + implicit none + integer, parameter :: N = 64 + real(8) :: x(N), y(N), z(N), out(N,3) + real(8) :: loc(3) + integer :: i, nerr + + do i = 1, N + x(i) = real(i,8)*0.1d0; y(i) = real(i,8)*0.2d0; z(i) = real(i,8)*0.3d0 + end do + + !$omp target teams distribute parallel do map(to:x,y,z) map(from:out) private(loc) + do i = 1, N + loc = [x(i), y(i), z(i)] + out(i,1) = loc(1); out(i,2) = loc(2); out(i,3) = loc(3) + end do + !$omp end target teams distribute parallel do + + nerr = 0 + do i = 1, N + if (abs(out(i,1)-x(i)) > 1d-14 .or. & + abs(out(i,2)-y(i)) > 1d-14 .or. & + abs(out(i,3)-z(i)) > 1d-14) nerr = nerr + 1 + end do + if (nerr == 0) then + print *, "PASS" + else + print *, "FAIL:", nerr, "of", N + end if +end program diff --git a/test/smoke-fort-dev/rocm-issue-2601-2/Makefile b/test/smoke-fort-dev/rocm-issue-2601-2/Makefile new file mode 100644 index 0000000000..728e29834d --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-2/Makefile @@ -0,0 +1,20 @@ +#NOOPT = 1 +#NOOMP = 1 +#OMP_FLAGS = -DNO_OMP +include ../../Makefile.defs + +TESTNAME = minimal +TESTSRC_MAIN = minimal_whole_array_ops.f90 +TESTSRC_AUX = +TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) + +FLANG ?= flang +CFLAGS = -fopenmp-target-fast -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription +OMP_BIN = $(AOMP)/bin/$(FLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME} + +include ../Makefile.rules diff --git a/test/smoke-fort-dev/rocm-issue-2601-2/chk.stderr b/test/smoke-fort-dev/rocm-issue-2601-2/chk.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/smoke-fort-dev/rocm-issue-2601-2/chk.stdout b/test/smoke-fort-dev/rocm-issue-2601-2/chk.stdout new file mode 100644 index 0000000000..660b40f440 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-2/chk.stdout @@ -0,0 +1 @@ + PASS diff --git a/test/smoke-fort-dev/rocm-issue-2601-2/chkit.sh b/test/smoke-fort-dev/rocm-issue-2601-2/chkit.sh new file mode 100755 index 0000000000..925eb16390 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-2/chkit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +diff -w "$1.stderr.log" chk.stderr +diff -w "$1.stdout.log" chk.stdout diff --git a/test/smoke-fort-dev/rocm-issue-2601-2/doit.sh b/test/smoke-fort-dev/rocm-issue-2601-2/doit.sh new file mode 100755 index 0000000000..8f1e6a1439 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-2/doit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -f "$1.stdout.log" "$1.stderr.log" +"./$1" 2> "$1.stderr.log" | tee -a "$1.stdout.log" diff --git a/test/smoke-fort-dev/rocm-issue-2601-2/minimal_whole_array_ops.f90 b/test/smoke-fort-dev/rocm-issue-2601-2/minimal_whole_array_ops.f90 new file mode 100644 index 0000000000..b70599fcc0 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2601-2/minimal_whole_array_ops.f90 @@ -0,0 +1,32 @@ +program minimal_whole_array_ops + implicit none + integer, parameter :: N = 64, M = 2 + real(8) :: A(N,M), B(N,M), s(N), out(N,M) + integer :: i, k, nerr + + do i = 1, N + s(i) = 0.5d0 + 0.001d0*real(i,8) + do k = 1, M + A(i,k) = real(i+k,8)*0.01d0 + B(i,k) = real(i*k,8)*0.001d0 + end do + end do + + !$omp target teams distribute parallel do map(to:A,B,s) map(from:out) + do i = 1, N + out(i,:) = A(i,:) + s(i)*(B(i,:) - A(i,:)) + end do + !$omp end target teams distribute parallel do + + nerr = 0 + do i = 1, N + do k = 1, M + if (abs(out(i,k) - (A(i,k) + s(i)*(B(i,k) - A(i,k)))) > 1d-12) nerr = nerr + 1 + end do + end do + if (nerr == 0) then + print *, "PASS" + else + print *, "FAIL:", nerr, "of", N*M + end if +end program diff --git a/test/smoke-fort-dev/rocm-issue-2602/Makefile b/test/smoke-fort-dev/rocm-issue-2602/Makefile new file mode 100644 index 0000000000..5cdd46128e --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2602/Makefile @@ -0,0 +1,20 @@ +#NOOPT = 1 +#NOOMP = 1 +#OMP_FLAGS = -DNO_OMP +include ../../Makefile.defs + +TESTNAME = minimal +TESTSRC_MAIN = minimal.f90 +TESTSRC_AUX = +TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) + +FLANG ?= flang +CFLAGS = -fopenmp-target-fast -fopenmp-assume-threads-oversubscription -fopenmp-assume-teams-oversubscription +OMP_BIN = $(AOMP)/bin/$(FLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME} + +include ../Makefile.rules diff --git a/test/smoke-fort-dev/rocm-issue-2602/chk.stderr b/test/smoke-fort-dev/rocm-issue-2602/chk.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/smoke-fort-dev/rocm-issue-2602/chk.stdout b/test/smoke-fort-dev/rocm-issue-2602/chk.stdout new file mode 100644 index 0000000000..660b40f440 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2602/chk.stdout @@ -0,0 +1 @@ + PASS diff --git a/test/smoke-fort-dev/rocm-issue-2602/chkit.sh b/test/smoke-fort-dev/rocm-issue-2602/chkit.sh new file mode 100755 index 0000000000..925eb16390 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2602/chkit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +diff -w "$1.stderr.log" chk.stderr +diff -w "$1.stdout.log" chk.stdout diff --git a/test/smoke-fort-dev/rocm-issue-2602/doit.sh b/test/smoke-fort-dev/rocm-issue-2602/doit.sh new file mode 100755 index 0000000000..8f1e6a1439 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2602/doit.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -f "$1.stdout.log" "$1.stderr.log" +"./$1" 2> "$1.stderr.log" | tee -a "$1.stdout.log" diff --git a/test/smoke-fort-dev/rocm-issue-2602/minimal.f90 b/test/smoke-fort-dev/rocm-issue-2602/minimal.f90 new file mode 100644 index 0000000000..73d5084de8 --- /dev/null +++ b/test/smoke-fort-dev/rocm-issue-2602/minimal.f90 @@ -0,0 +1,18 @@ +program t + integer, parameter :: N = 64 + integer :: out(N, 2), i, nerr + !$omp target teams distribute parallel do map(from:out) + do i = 1, N + out(i,:) = [i, i*2] + end do + !$omp end target teams distribute parallel do + nerr = 0 + do i = 1, N + if (out(i,1) /= i .or. out(i,2) /= i*2) nerr = nerr + 1 + end do + if (nerr == 0) then + print *, "PASS" + else + print *, "FAIL:", nerr, "of", N ! without fix: FAIL: 31 of 64 + end if +end program