Files
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

118 lines
4.2 KiB
Fortran

! RUN: bbc -emit-hlfir -fopenmp %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! --- Check that with shared(i) the variable outside the parallel section
! --- is updated.
! CHECK-LABEL: func.func @_QPomploop()
! CHECK: %[[ALLOC_I:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomploopEi"}
! CHECK: %[[DECL_I:.*]]:2 = hlfir.declare %[[ALLOC_I]] {uniq_name = "_QFomploopEi"} :
! CHECK: omp.parallel {
! CHECK: omp.sections {
! CHECK: omp.section {
! CHECK: %[[RES:.*]] = fir.do_loop %[[ARG0:.*]] = %{{.*}} to %{{.*}} step %{{.*}} iter_args(%[[ARG1:.*]] =
! CHECK: fir.store %[[ARG1]] to %[[DECL_I]]#0
! CHECK: hlfir.assign
! CHECK: %[[LOAD_I:.*]] = fir.load %[[DECL_I]]#0
! CHECK: %[[RES_I:.*]] = arith.addi %[[LOAD_I]], %{{.*}}
! CHECK: fir.result %[[RES_I]]
! CHECK: }
! CHECK: fir.store %[[RES]] to %[[DECL_I]]#0
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: return
! CHECK: }
subroutine omploop
implicit none
integer :: i, j
i = 1
j = 0
!$omp parallel shared(i)
!$omp sections
do i=1,10
j = j + i
end do
!$omp end sections
!$omp end parallel
end subroutine
! --- Check that with default(shared) the variable outside the parallel section
! --- is NOT updated (i is private to the omp.parallel code)
! CHECK-LABEL: func.func @_QPomploop2()
! CHECK: %[[ALLOC_I:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomploop2Ei"}
! CHECK: %[[DECL_I:.*]]:2 = hlfir.declare %[[ALLOC_I]] {uniq_name = "_QFomploop2Ei"} :
! CHECK: omp.parallel {
! CHECK: %[[ALLOC_PRIV_I:.*]] = fir.alloca i32 {bindc_name = "i", pinned}
! CHECK: %[[DECL_PRIV_I:.*]]:2 = hlfir.declare %[[ALLOC_PRIV_I]]
! CHECK: omp.sections {
! CHECK: omp.section {
! CHECK: %[[RES:.*]] = fir.do_loop %[[ARG0:.*]] = %{{.*}} to %{{.*}} step %{{.*}} iter_args(%[[ARG1:.*]] =
! CHECK-NOT: fir.store %[[ARG1]] to %[[DECL_I]]#1
! CHECK: fir.store %[[ARG1]] to %[[DECL_PRIV_I]]#0
! CHECK: hlfir.assign
! CHECK: %[[LOAD_I:.*]] = fir.load %[[DECL_PRIV_I]]#0
! CHECK: %[[RES_I:.*]] = arith.addi %[[LOAD_I]], %{{.*}}
! CHECK: fir.result %[[RES_I]]
! CHECK: }
! CHECK: fir.store %[[RES]] to %[[DECL_PRIV_I]]#0
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: return
! CHECK: }
subroutine omploop2
implicit none
integer :: i, j
i = 1
j = 0
!$omp parallel default(shared)
!$omp sections
do i=1,10
j = j + i
end do
!$omp end sections
!$omp end parallel
end subroutine
! --- Check that with no data-sharing the variable outside the parallel section
! --- is NOT updated (i is private to the omp.parallel code)
! CHECK-LABEL: func.func @_QPomploop3()
! CHECK: %[[ALLOC_I:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFomploop3Ei"}
! CHECK: %[[DECL_I:.*]]:2 = hlfir.declare %[[ALLOC_I]] {uniq_name = "_QFomploop3Ei"} :
! CHECK: omp.parallel {
! CHECK: %[[ALLOC_PRIV_I:.*]] = fir.alloca i32 {bindc_name = "i", pinned}
! CHECK: %[[DECL_PRIV_I:.*]]:2 = hlfir.declare %[[ALLOC_PRIV_I]]
! CHECK: omp.sections {
! CHECK: omp.section {
! CHECK: %[[RES:.*]] = fir.do_loop %[[ARG0:.*]] = %{{.*}} to %{{.*}} step %{{.*}} iter_args(%[[ARG1:.*]] =
! CHECK-NOT: fir.store %[[ARG1]] to %[[DECL_I]]#1
! CHECK: fir.store %[[ARG1]] to %[[DECL_PRIV_I]]#0
! CHECK: hlfir.assign
! CHECK: %[[LOAD_I:.*]] = fir.load %[[DECL_PRIV_I]]#0
! CHECK: %[[RES_I:.*]] = arith.addi %[[LOAD_I]], %{{.*}}
! CHECK: fir.result %[[RES_I]]
! CHECK: }
! CHECK: fir.store %[[RES]] to %[[DECL_PRIV_I]]#0
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: return
! CHECK: }
subroutine omploop3
implicit none
integer :: i, j
i = 1
j = 0
!$omp parallel
!$omp sections
do i=1,10
j = j + i
end do
!$omp end sections
!$omp end parallel
end subroutine