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
86 lines
3.6 KiB
Plaintext
86 lines
3.6 KiB
Plaintext
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
|
|
|
|
subroutine associated_stream
|
|
use cuda_runtime_api
|
|
integer(kind=cuda_stream_kind) :: strm, strmout
|
|
integer, managed, allocatable :: v(:)
|
|
integer :: istat
|
|
|
|
istat = cudaforSetDefaultStream(v, strm)
|
|
strmout = cudaforGetDefaultStream(v)
|
|
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func.func @_QPassociated_stream()
|
|
! CHECK: %[[ADDR:.*]] = fir.box_addr %{{.*}} : (!fir.box<!fir.heap<!fir.array<?xi32>>>) -> !fir.heap<!fir.array<?xi32>>
|
|
! CHECK: %[[STREAM:.*]] = fir.load %{{.*}}#0 : !fir.ref<i64>
|
|
! CHECK: %[[VOIDPTR:.*]] = fir.convert %[[ADDR]] : (!fir.heap<!fir.array<?xi32>>) -> !fir.llvm_ptr<i8>
|
|
! CHECK: %[[STAT:.*]] = fir.call @_FortranACUFSetAssociatedStream(%[[VOIDPTR]], %[[STREAM]]) fastmath<contract> : (!fir.llvm_ptr<i8>, i64) -> i32
|
|
! CHECK: hlfir.assign %[[STAT]] to %{{.*}}#0 : i32, !fir.ref<i32>
|
|
|
|
! CHECK: %[[ADDR:.*]] = fir.box_addr %{{.*}} : (!fir.box<!fir.heap<!fir.array<?xi32>>>) -> !fir.heap<!fir.array<?xi32>>
|
|
! CHECK: %[[VOIDPTR:.*]] = fir.convert %[[ADDR]] : (!fir.heap<!fir.array<?xi32>>) -> !fir.llvm_ptr<i8>
|
|
! CHECK: %[[STREAM:.*]] = fir.call @_FortranACUFGetAssociatedStream(%[[VOIDPTR]]) fastmath<contract> : (!fir.llvm_ptr<i8>) -> i64
|
|
! CHECK: hlfir.assign %[[STREAM]] to %{{.*}}#0 : i64, !fir.ref<i64>
|
|
|
|
subroutine default_stream
|
|
use cuda_runtime_api
|
|
|
|
integer(kind=cuda_stream_kind) :: strm, strm2
|
|
integer :: istat
|
|
istat = cudaStreamCreate(strm2)
|
|
istat = cudaforSetDefaultStream(strm2)
|
|
strm = cudaforGetDefaultStream()
|
|
istat = cudaStreamSynchronize(cudaforGetDefaultStream())
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func.func @_QPdefault_stream()
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFSetDefaultStream(%{{.*}}) fastmath<contract> : (i64) -> i32
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFGetDefaultStream() fastmath<contract> : () -> i64
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFGetDefaultStream() fastmath<contract> : () -> i64
|
|
|
|
subroutine stream_destroy
|
|
use cuda_runtime_api
|
|
integer(kind=cuda_stream_kind) :: strm
|
|
integer :: istat
|
|
istat = cudaStreamCreate(strm)
|
|
istat = cudaStreamDestroy(strm)
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func.func @_QPstream_destroy()
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFStreamDestroy(%{{.*}}) fastmath<contract> : (i64) -> i32
|
|
|
|
! A default-kind (i32) actual argument must be widened to i64 before
|
|
! reaching the runtime stream call.
|
|
subroutine default_stream_i32_literal
|
|
use cuda_runtime_api
|
|
integer :: istat
|
|
istat = cudaforSetDefaultStream(0)
|
|
istat = cudaStreamDestroy(0)
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func.func @_QPdefault_stream_i32_literal()
|
|
! CHECK: %[[ZERO1:.*]] = arith.constant 0 : i32
|
|
! CHECK: %[[STRM1:.*]] = fir.convert %[[ZERO1]] : (i32) -> i64
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFSetDefaultStream(%[[STRM1]]) fastmath<contract> : (i64) -> i32
|
|
! CHECK: %[[ZERO2:.*]] = arith.constant 0 : i32
|
|
! CHECK: %[[STRM2:.*]] = fir.convert %[[ZERO2]] : (i32) -> i64
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFStreamDestroy(%[[STRM2]]) fastmath<contract> : (i64) -> i32
|
|
|
|
subroutine default_stream_i32_var
|
|
use cuda_runtime_api
|
|
integer :: istat
|
|
integer(4) :: s
|
|
s = 0
|
|
istat = cudaforSetDefaultStream(s)
|
|
istat = cudaStreamDestroy(s)
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func.func @_QPdefault_stream_i32_var()
|
|
! CHECK: %[[L1:.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
|
! CHECK: %[[V1:.*]] = fir.convert %[[L1]] : (i32) -> i64
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFSetDefaultStream(%[[V1]]) fastmath<contract> : (i64) -> i32
|
|
! CHECK: %[[L2:.*]] = fir.load %{{.*}} : !fir.ref<i32>
|
|
! CHECK: %[[V2:.*]] = fir.convert %[[L2]] : (i32) -> i64
|
|
! CHECK: %{{.*}} = fir.call @_FortranACUFStreamDestroy(%[[V2]]) fastmath<contract> : (i64) -> i32
|