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
90 lines
2.9 KiB
Fortran
90 lines
2.9 KiB
Fortran
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
|
|
|
|
! Test that parameter (constant) arrays can be mapped to OpenMP target regions
|
|
! and are mapped as read-only when accessed with dynamic indices.
|
|
|
|
module param_array_module
|
|
implicit none
|
|
integer, parameter :: dp = selected_real_kind(15, 307)
|
|
|
|
! Parameter arrays that should be mapped to device
|
|
real(dp), parameter :: const_array(3) = [1.0_dp, 2.0_dp, 3.0_dp]
|
|
integer, parameter :: int_array(4) = [10, 20, 30, 40]
|
|
|
|
contains
|
|
|
|
! Parameter array with dynamic index in target region with teams distribute
|
|
! CHECK-LABEL: func.func @_QMparam_array_modulePtest_param_array_target
|
|
subroutine test_param_array_target(idx)
|
|
integer, intent(in) :: idx
|
|
integer :: i
|
|
real(dp) :: result
|
|
|
|
! CHECK: omp.map.info{{.*}}map_clauses(implicit, to){{.*}}{name = "const_array"}
|
|
!$omp target teams distribute parallel do
|
|
do i = 1, 3
|
|
! Access parameter array with dynamic index
|
|
result = const_array(idx)
|
|
end do
|
|
!$omp end target teams distribute parallel do
|
|
|
|
end subroutine test_param_array_target
|
|
|
|
! Integer parameter array in simple target region
|
|
! CHECK-LABEL: func.func @_QMparam_array_modulePtest_int_param_array
|
|
subroutine test_int_param_array(idx)
|
|
integer, intent(in) :: idx
|
|
integer :: result
|
|
|
|
! CHECK: omp.map.info{{.*}}map_clauses(implicit, to){{.*}}{name = "int_array"}
|
|
!$omp target
|
|
! Access parameter array with dynamic index
|
|
result = int_array(idx)
|
|
!$omp end target
|
|
|
|
end subroutine test_int_param_array
|
|
|
|
! Verify scalar parameters are NOT mapped (can be inlined)
|
|
! CHECK-LABEL: func.func @_QMparam_array_modulePtest_scalar_param
|
|
subroutine test_scalar_param()
|
|
integer, parameter :: scalar_const = 42
|
|
integer :: result
|
|
|
|
! CHECK-NOT: omp.map.info{{.*}}{name = "scalar_const"}
|
|
!$omp target
|
|
result = scalar_const
|
|
!$omp end target
|
|
|
|
end subroutine test_scalar_param
|
|
|
|
! Test character scalar parameter with dynamic substring access
|
|
! CHECK-LABEL: func.func @_QMparam_array_modulePtest_char_substring
|
|
subroutine test_char_substring(start_idx, end_idx)
|
|
integer, intent(in) :: start_idx, end_idx
|
|
character(len=20), parameter :: char_scalar = "constant_string_data"
|
|
character(len=10) :: result
|
|
|
|
! CHECK: omp.map.info{{.*}}map_clauses(implicit, to){{.*}}{name = "char_scalar"}
|
|
!$omp target
|
|
! Dynamic substring access - character scalar must be mapped
|
|
result = char_scalar(start_idx:end_idx)
|
|
!$omp end target
|
|
|
|
end subroutine test_char_substring
|
|
|
|
! Verify character scalar with constant substring is NOT mapped
|
|
! CHECK-LABEL: func.func @_QMparam_array_modulePtest_char_const_substring
|
|
subroutine test_char_const_substring()
|
|
character(len=20), parameter :: char_const = "constant_string_data"
|
|
character(len=5) :: result
|
|
|
|
! CHECK-NOT: omp.map.info{{.*}}{name = "char_const"}
|
|
!$omp target
|
|
! Constant substring access - can be inlined, no mapping needed
|
|
result = char_const(1:5)
|
|
!$omp end target
|
|
|
|
end subroutine test_char_const_substring
|
|
|
|
end module param_array_module
|