Files
TheRock/compiler/amd-llvm/offload/test/offloading/fortran/descriptor-stack-jam-regression.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

103 lines
2.9 KiB
Fortran

! This test doesn't expect any results, the pass condition is running to completion
! without any memory access errors on device or mapping issues from descriptor
! collisions due to local descriptors being placed on device and not being unampped
! before a subsequent local descriptor residing at the same address is mapped to
! device.
! REQUIRES: flang, amdgpu
! RUN: %libomptarget-compile-fortran-generic
! RUN: env LIBOMPTARGET_TREAT_ATTACH_AUTO_AS_ALWAYS=1 %libomptarget-run-generic 2>&1 | %fcheck-generic
module test
contains
subroutine kernel_1d(array)
implicit none
real, dimension(:) :: array
integer :: i
!$omp target enter data map(alloc:array)
!$omp target teams distribute parallel do
do i=1, ubound(array, 1)
array(i) = 42.0
end do
!$omp target update from(array)
end subroutine
subroutine kernel_2d(array)
implicit none
real, dimension(:,:) :: array
integer :: i, j
!$omp target enter data map(alloc:array)
!$omp target teams distribute parallel do collapse(2)
do j=1, ubound(array, 2)
do i=1, ubound(array, 1)
array(i,j) = 42.0
end do
end do
!$omp target update from(array)
end subroutine
subroutine kernel_3d(array)
implicit none
real, dimension(:,:,:) :: array
integer :: i, j, k
!$omp target enter data map(alloc:array)
!$omp target teams distribute parallel do collapse(3)
do k=1, ubound(array, 3)
do j=1, ubound(array, 2)
do i=1, ubound(array, 1)
array(i,j,k) = 42.0
end do
end do
end do
!$omp target update from(array)
end subroutine
subroutine kernel_4d(array)
implicit none
real, dimension(:,:,:,:) :: array
integer :: i, j, k, l
!$omp target enter data map(alloc:array)
!$omp target teams distribute parallel do collapse(4)
do l=1, ubound(array, 4)
do k=1, ubound(array, 3)
do j=1, ubound(array, 2)
do i=1, ubound(array, 1)
array(i,j,k,l) = 42.0
end do
end do
end do
enddo
!$omp target update from(array)
end subroutine
end module
program main
use test
implicit none
integer, parameter :: n = 2
real :: array1(n)
real :: array2(n,n)
real :: array3(n,n,n)
real :: array4(n,n,n,n)
call kernel_1d(array1)
call kernel_2d(array2)
call kernel_3d(array3)
call kernel_4d(array4)
print *, array1
print *, array2
print *, array3
print *, array4
print *, "PASS"
end program
! CHECK: 42. 42.
! CHECK: 42. 42. 42. 42.
! CHECK: 42. 42. 42. 42. 42. 42. 42. 42.
! CHECK: 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.
! CHECK: PASS