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
155 lines
6.2 KiB
MLIR
155 lines
6.2 KiB
MLIR
// RUN: fir-opt %s --split-input-file --pass-pipeline="builtin.module(test-acc-recipe-populate{recipe-type=firstprivate})" | FileCheck %s
|
|
|
|
// The tests here use a synthetic hlfir.declare in order to ensure that the hlfir dialect is
|
|
// loaded. This is required because the pass used is part of OpenACC test passes outside of
|
|
// flang and the APIs being test may generate hlfir even when it does not appear.
|
|
|
|
// Test scalar type (f32)
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_scalar : !fir.ref<f32> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<f32>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca f32
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<f32>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<f32>, %[[DST:.*]]: !fir.ref<f32>):
|
|
// CHECK: %[[LOAD:.*]] = fir.load %[[SRC]] : !fir.ref<f32>
|
|
// CHECK: hlfir.assign %[[LOAD]] to %[[DST]] temporary_lhs : f32, !fir.ref<f32>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_scalar() {
|
|
%0 = fir.alloca f32 {test.var = "scalar"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Test integer scalar
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_int : !fir.ref<i32> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<i32>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca i32
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<i32>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<i32>, %[[DST:.*]]: !fir.ref<i32>):
|
|
// CHECK: %[[LOAD:.*]] = fir.load %[[SRC]] : !fir.ref<i32>
|
|
// CHECK: hlfir.assign %[[LOAD]] to %[[DST]] temporary_lhs : i32, !fir.ref<i32>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_int() {
|
|
%0 = fir.alloca i32 {test.var = "int"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Test logical type
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_logical : !fir.ref<!fir.logical<4>> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.logical<4>>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca !fir.logical<4>
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<!fir.logical<4>>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<!fir.logical<4>>, %[[DST:.*]]: !fir.ref<!fir.logical<4>>):
|
|
// CHECK: %[[LOAD:.*]] = fir.load %[[SRC]] : !fir.ref<!fir.logical<4>>
|
|
// CHECK: hlfir.assign %[[LOAD]] to %[[DST]] temporary_lhs : !fir.logical<4>, !fir.ref<!fir.logical<4>>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_logical() {
|
|
%0 = fir.alloca !fir.logical<4> {test.var = "logical"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Test complex type
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_complex : !fir.ref<complex<f32>> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<complex<f32>>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca complex<f32>
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<complex<f32>>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<complex<f32>>, %[[DST:.*]]: !fir.ref<complex<f32>>):
|
|
// CHECK: %[[LOAD:.*]] = fir.load %[[SRC]] : !fir.ref<complex<f32>>
|
|
// CHECK: hlfir.assign %[[LOAD]] to %[[DST]] temporary_lhs : complex<f32>, !fir.ref<complex<f32>>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_complex() {
|
|
%0 = fir.alloca complex<f32> {test.var = "complex"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Test 1D static array
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_array_1d : !fir.ref<!fir.array<100xf32>> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<100xf32>>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca !fir.array<100xf32>
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<!fir.array<100xf32>>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<!fir.array<100xf32>>, %[[DST:.*]]: !fir.ref<!fir.array<100xf32>>):
|
|
// CHECK: hlfir.assign %[[SRC]] to %[[DST]] temporary_lhs : !fir.ref<!fir.array<100xf32>>, !fir.ref<!fir.array<100xf32>>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_array_1d() {
|
|
%0 = fir.alloca !fir.array<100xf32> {test.var = "array_1d"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Test 2D static array
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_array_2d : !fir.ref<!fir.array<10x20xi32>> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.array<10x20xi32>>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca !fir.array<10x20xi32>
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<!fir.array<10x20xi32>>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<!fir.array<10x20xi32>>, %[[DST:.*]]: !fir.ref<!fir.array<10x20xi32>>):
|
|
// CHECK: hlfir.assign %[[SRC]] to %[[DST]] temporary_lhs : !fir.ref<!fir.array<10x20xi32>>, !fir.ref<!fir.array<10x20xi32>>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_array_2d() {
|
|
%0 = fir.alloca !fir.array<10x20xi32> {test.var = "array_2d"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// Test derived type with multiple fields
|
|
// CHECK: acc.firstprivate.recipe @firstprivate_derived : !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>> init {
|
|
// CHECK: ^bb0(%{{.*}}: !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>>):
|
|
// CHECK: %[[ALLOC:.*]] = fir.alloca !fir.type<_QTpoint{x:f32,y:f32,z:f32}>
|
|
// CHECK: acc.yield %[[ALLOC]] : !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>>
|
|
// CHECK: } copy {
|
|
// CHECK: ^bb0(%[[SRC:.*]]: !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>>, %[[DST:.*]]: !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>>):
|
|
// CHECK: hlfir.assign %[[SRC]] to %[[DST]] temporary_lhs : !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>>, !fir.ref<!fir.type<_QTpoint{x:f32,y:f32,z:f32}>>
|
|
// CHECK: acc.terminator
|
|
// CHECK: }
|
|
// CHECK-NOT: destroy
|
|
|
|
func.func @test_derived() {
|
|
%0 = fir.alloca !fir.type<_QTpoint{x:f32,y:f32,z:f32}> {test.var = "derived"}
|
|
%var = fir.alloca f32
|
|
%1:2 = hlfir.declare %var {uniq_name = "load_hlfir"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
|
return
|
|
}
|