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
99 lines
3.9 KiB
Plaintext
99 lines
3.9 KiB
Plaintext
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
|
|
|
|
! Check if do concurrent works inside cuf kernel directive
|
|
|
|
subroutine doconc1
|
|
integer :: i, n
|
|
integer, managed :: a(3)
|
|
a(:) = -1
|
|
n = 3
|
|
n = n - 1
|
|
!$cuf kernel do
|
|
do concurrent(i=1:n)
|
|
a(i) = 1
|
|
end do
|
|
end
|
|
|
|
! CHECK-LABEL: func.func @_QPdoconc1()
|
|
! CHECK: %[[IMEM:.*]] = fir.alloca i32 {bindc_name = "i"}
|
|
! CHECK: %[[IV:.*]]:2 = hlfir.declare %[[IMEM]] {uniq_name = "_QFdoconc1Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
! CHECK: cuf.kernel<<<*, *>>> (%[[ARG0:[^ ]*]] : index) =
|
|
! CHECK: %[[CONV:.*]] = fir.convert %[[ARG0]] : (index) -> i32
|
|
! CHECK: fir.store %[[CONV]] to %[[IV]]#0 : !fir.ref<i32>
|
|
! CHECK: fir.load %[[IV]]#0 : !fir.ref<i32>
|
|
|
|
subroutine doconc2
|
|
integer :: i, j, m, n
|
|
integer, managed :: a(2, 4)
|
|
m = 2
|
|
n = 4
|
|
a(:,:) = -1
|
|
!$cuf kernel do
|
|
do concurrent(i=1:m,j=1:n)
|
|
a(i,j) = i+j
|
|
end do
|
|
end
|
|
|
|
! CHECK-LABEL: func.func @_QPdoconc2()
|
|
! CHECK: %[[JMEM:.*]] = fir.alloca i32 {bindc_name = "j"}
|
|
! CHECK: %[[IMEM:.*]] = fir.alloca i32 {bindc_name = "i"}
|
|
! CHECK: %[[IDECL:.*]]:2 = hlfir.declare %[[IMEM]] {uniq_name = "_QFdoconc2Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
! CHECK: %[[JDECL:.*]]:2 = hlfir.declare %[[JMEM]] {uniq_name = "_QFdoconc2Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
! CHECK: cuf.kernel<<<*, *>>> (%[[ARG0:[^ ]*]] : index, %[[ARG1:[^ ]*]] : index) =
|
|
! CHECK: %[[CONVI:.*]] = fir.convert %[[ARG0]] : (index) -> i32
|
|
! CHECK: fir.store %[[CONVI]] to %[[IDECL]]#0 : !fir.ref<i32>
|
|
! CHECK: %[[CONVJ:.*]] = fir.convert %[[ARG1]] : (index) -> i32
|
|
! CHECK: fir.store %[[CONVJ]] to %[[JDECL]]#0 : !fir.ref<i32>
|
|
! CHECK: fir.load %[[IDECL]]#0 : !fir.ref<i32>
|
|
! CHECK: fir.load %[[JDECL]]#0 : !fir.ref<i32>
|
|
|
|
! Test that do concurrent index variables in a cuf.kernel are allocated with
|
|
! their declared Fortran integer type (i32), not the loop index type (index).
|
|
! Previously the allocation used index, which prevented type conversions such
|
|
! as real(i) from compiling correctly.
|
|
subroutine doconc_real
|
|
integer :: i, n
|
|
real, managed :: a(4)
|
|
n = 4
|
|
!$cuf kernel do
|
|
do concurrent(i=1:n)
|
|
a(i) = real(i)
|
|
end do
|
|
end
|
|
|
|
! CHECK-LABEL: func.func @_QPdoconc_real()
|
|
! CHECK: %[[IMEM:.*]] = fir.alloca i32 {bindc_name = "i"}
|
|
! CHECK: %[[IV:.*]]:2 = hlfir.declare %[[IMEM]] {uniq_name = "_QFdoconc_realEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
! CHECK: cuf.kernel<<<*, *>>> (%[[ARG0:[^ ]*]] : index) =
|
|
! CHECK: %[[CONV:.*]] = fir.convert %[[ARG0]] : (index) -> i32
|
|
! CHECK: fir.store %[[CONV]] to %[[IV]]#0 : !fir.ref<i32>
|
|
! CHECK: %[[LOADED:.*]] = fir.load %[[IV]]#0 : !fir.ref<i32>
|
|
! CHECK: fir.convert %[[LOADED]] : (i32) -> f32
|
|
|
|
! Test that do concurrent with multiple index variables and an explicit loop
|
|
! count (do(2)) generates correct IR. Previously the PFT navigation loop
|
|
! assumed nested regular do-loops and asserted when it encountered the flat
|
|
! do concurrent structure.
|
|
subroutine doconc_do2
|
|
integer :: i, j, k, n
|
|
real, managed :: a(4, 2)
|
|
k = 2
|
|
n = 4
|
|
!$cuf kernel do(2) <<<k, n>>>
|
|
do concurrent(i=1:k, j=1:n)
|
|
a(j,i) = 1.0
|
|
end do
|
|
end
|
|
|
|
! CHECK-LABEL: func.func @_QPdoconc_do2()
|
|
! j is allocated before i in the alloca block (loop control order).
|
|
! CHECK: %[[JMEM:.*]] = fir.alloca i32 {bindc_name = "j"}
|
|
! CHECK: %[[IMEM:.*]] = fir.alloca i32 {bindc_name = "i"}
|
|
! CHECK: %[[IDECL:.*]]:2 = hlfir.declare %[[IMEM]] {uniq_name = "_QFdoconc_do2Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
! CHECK: %[[JDECL:.*]]:2 = hlfir.declare %[[JMEM]] {uniq_name = "_QFdoconc_do2Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
|
|
! CHECK: cuf.kernel{{.*}} (%[[ARG0:[^ ]*]] : index, %[[ARG1:[^ ]*]] : index) =
|
|
! CHECK: %[[CONVI:.*]] = fir.convert %[[ARG0]] : (index) -> i32
|
|
! CHECK: fir.store %[[CONVI]] to %[[IDECL]]#0 : !fir.ref<i32>
|
|
! CHECK: %[[CONVJ:.*]] = fir.convert %[[ARG1]] : (index) -> i32
|
|
! CHECK: fir.store %[[CONVJ]] to %[[JDECL]]#0 : !fir.ref<i32>
|