[Mlir-commits] [mlir] [MLIR][OpenMP] Use opaque pointers in OpenMP translation tests 2/2 (PR #70138)
Kiran Chandramohan
llvmlistbot at llvm.org
Tue Oct 24 15:48:40 PDT 2023
https://github.com/kiranchandramohan created https://github.com/llvm/llvm-project/pull/70138
Second half of the tests switching to opaque pointers. All are the target related tests.
Removes mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir, since this seems to be added to test the typed pointers and probably not needed anymore.
>From e30f80e3a1399d1d410b102b6fb3f1a460a45165 Mon Sep 17 00:00:00 2001
From: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: Tue, 24 Oct 2023 22:42:21 +0000
Subject: [PATCH] [MLIR][OpenMP] Use opaque pointers in OpenMP translation
tests 2/2
Second half of the tests switching to opaque pointers. All are the
target related tests.
Removes mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir,
since this seems to be added to test the typed pointers and probably
not needed anymore.
---
.../omptarget-declare-target-llvm-device.mlir | 8 +-
.../omptarget-declare-target-llvm-host.mlir | 30 ++---
mlir/test/Target/LLVMIR/omptarget-llvm.mlir | 120 +++++++++---------
.../LLVMIR/omptarget-region-device-llvm.mlir | 24 ++--
.../omptarget-region-llvm-target-device.mlir | 12 +-
.../Target/LLVMIR/omptarget-region-llvm.mlir | 24 ++--
.../omptarget-region-parallel-llvm.mlir | 24 ++--
.../openmp-reduction-typed-pointers.mlir | 75 -----------
8 files changed, 121 insertions(+), 196 deletions(-)
delete mode 100644 mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
index 98a0a34d907f24a..af776b89b3ae6f6 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-device.mlir
@@ -15,16 +15,16 @@ module attributes {omp.is_target_device = true} {
}
llvm.func @_QQmain() attributes {} {
- %0 = llvm.mlir.addressof @_QMtest_0Esp : !llvm.ptr<i32>
+ %0 = llvm.mlir.addressof @_QMtest_0Esp : !llvm.ptr
// CHECK-DAG: omp.target: ; preds = %user_code.entry
// CHECK-DAG: %1 = load ptr, ptr @_QMtest_0Esp_decl_tgt_ref_ptr, align 8
// CHECK-DAG: store i32 1, ptr %1, align 4
// CHECK-DAG: br label %omp.region.cont
- %map = omp.map_info var_ptr(%0 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target map_entries(%map : !llvm.ptr<i32>) {
+ %map = omp.map_info var_ptr(%0 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target map_entries(%map : !llvm.ptr) {
%1 = llvm.mlir.constant(1 : i32) : i32
- llvm.store %1, %0 : !llvm.ptr<i32>
+ llvm.store %1, %0 : i32, !llvm.ptr
omp.terminator
}
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
index 82aff6f131ef1d4..9a9fe29db0e5da1 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
@@ -102,30 +102,30 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
// CHECK-DAG: @.omp_offloading.entry_name{{.*}} = internal unnamed_addr constant [31 x i8] c"_QMtest_0Ept1_decl_tgt_ref_ptr\00"
// CHECK-DAG: @.omp_offloading.entry._QMtest_0Ept1_decl_tgt_ref_ptr = weak constant %struct.__tgt_offload_entry { ptr @_QMtest_0Ept1_decl_tgt_ref_ptr, ptr @.omp_offloading.entry_name{{.*}}, i64 8, i32 1, i32 0 }, section "omp_offloading_entries", align 1
// CHECK-DAG: !{{.*}} = !{i32 {{.*}}, !"_QMtest_0Ept1_decl_tgt_ref_ptr", i32 {{.*}}, i32 {{.*}}}
- llvm.mlir.global external @_QMtest_0Ept1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)> {
- %0 = llvm.mlir.zero : !llvm.ptr<i32>
+ llvm.mlir.global external @_QMtest_0Ept1() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> {
+ %0 = llvm.mlir.zero : !llvm.ptr
%1 = llvm.mlir.constant(9 : i32) : i32
- %2 = llvm.mlir.zero : !llvm.ptr<i32>
- %3 = llvm.getelementptr %2[1] : (!llvm.ptr<i32>) -> !llvm.ptr<i32>
- %4 = llvm.ptrtoint %3 : !llvm.ptr<i32> to i64
- %5 = llvm.mlir.undef : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
- %6 = llvm.insertvalue %4, %5[1] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
+ %2 = llvm.mlir.zero : !llvm.ptr
+ %3 = llvm.getelementptr %2[1] : (!llvm.ptr) -> !llvm.ptr, i32
+ %4 = llvm.ptrtoint %3 : !llvm.ptr to i64
+ %5 = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
+ %6 = llvm.insertvalue %4, %5[1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
%7 = llvm.mlir.constant(20180515 : i32) : i32
- %8 = llvm.insertvalue %7, %6[2] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
+ %8 = llvm.insertvalue %7, %6[2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
%9 = llvm.mlir.constant(0 : i32) : i32
%10 = llvm.trunc %9 : i32 to i8
- %11 = llvm.insertvalue %10, %8[3] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
+ %11 = llvm.insertvalue %10, %8[3] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
%12 = llvm.trunc %1 : i32 to i8
- %13 = llvm.insertvalue %12, %11[4] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
+ %13 = llvm.insertvalue %12, %11[4] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
%14 = llvm.mlir.constant(1 : i32) : i32
%15 = llvm.trunc %14 : i32 to i8
- %16 = llvm.insertvalue %15, %13[5] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
+ %16 = llvm.insertvalue %15, %13[5] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
%17 = llvm.mlir.constant(0 : i32) : i32
%18 = llvm.trunc %17 : i32 to i8
- %19 = llvm.insertvalue %18, %16[6] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
- %20 = llvm.bitcast %0 : !llvm.ptr<i32> to !llvm.ptr<i32>
- %21 = llvm.insertvalue %20, %19[0] : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
- llvm.return %21 : !llvm.struct<(ptr<i32>, i64, i32, i8, i8, i8, i8)>
+ %19 = llvm.insertvalue %18, %16[6] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
+ %20 = llvm.bitcast %0 : !llvm.ptr to !llvm.ptr
+ %21 = llvm.insertvalue %20, %19[0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
+ llvm.return %21 : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
}
// CHECK-DAG: @_QMtest_0Ept2_tar = global i32 5
diff --git a/mlir/test/Target/LLVMIR/omptarget-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-llvm.mlir
index 6d4076feca15679..f2431ec87933f95 100644
--- a/mlir/test/Target/LLVMIR/omptarget-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-llvm.mlir
@@ -2,11 +2,11 @@
llvm.func @_QPopenmp_target_data() {
%0 = llvm.mlir.constant(1 : i64) : i64
- %1 = llvm.alloca %0 x i32 {bindc_name = "i", in_type = i32, operand_segment_sizes = array<i32: 0, 0>, uniq_name = "_QFopenmp_target_dataEi"} : (i64) -> !llvm.ptr<i32>
- %2 = omp.map_info var_ptr(%1 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target_data map_entries(%2 : !llvm.ptr<i32>) {
+ %1 = llvm.alloca %0 x i32 {bindc_name = "i", in_type = i32, operand_segment_sizes = array<i32: 0, 0>, uniq_name = "_QFopenmp_target_dataEi"} : (i64) -> !llvm.ptr
+ %2 = omp.map_info var_ptr(%1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%2 : !llvm.ptr) {
%3 = llvm.mlir.constant(99 : i32) : i32
- llvm.store %3, %1 : !llvm.ptr<i32>
+ llvm.store %3, %1 : i32, !llvm.ptr
omp.terminator
}
llvm.return
@@ -38,15 +38,15 @@ llvm.func @_QPopenmp_target_data() {
// -----
-llvm.func @_QPopenmp_target_data_region(%1 : !llvm.ptr<array<1024 x i32>>) {
- %2 = omp.map_info var_ptr(%1 : !llvm.ptr<array<1024 x i32>>, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr<array<1024 x i32>> {name = ""}
- omp.target_data map_entries(%2 : !llvm.ptr<array<1024 x i32>>) {
+llvm.func @_QPopenmp_target_data_region(%1 : !llvm.ptr) {
+ %2 = omp.map_info var_ptr(%1 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%2 : !llvm.ptr) {
%3 = llvm.mlir.constant(99 : i32) : i32
%4 = llvm.mlir.constant(1 : i64) : i64
%5 = llvm.mlir.constant(1 : i64) : i64
%6 = llvm.mlir.constant(0 : i64) : i64
- %7 = llvm.getelementptr %1[0, %6] : (!llvm.ptr<array<1024 x i32>>, i64) -> !llvm.ptr<i32>
- llvm.store %3, %7 : !llvm.ptr<i32>
+ %7 = llvm.getelementptr %1[0, %6] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1024 x i32>
+ llvm.store %3, %7 : i32, !llvm.ptr
omp.terminator
}
llvm.return
@@ -79,29 +79,29 @@ llvm.func @_QPopenmp_target_data_region(%1 : !llvm.ptr<array<1024 x i32>>) {
// -----
-llvm.func @_QPomp_target_enter_exit(%1 : !llvm.ptr<array<1024 x i32>>, %3 : !llvm.ptr<array<512 x i32>>) {
+llvm.func @_QPomp_target_enter_exit(%1 : !llvm.ptr, %3 : !llvm.ptr) {
%4 = llvm.mlir.constant(1 : i64) : i64
- %5 = llvm.alloca %4 x i32 {bindc_name = "dvc", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_enter_exitEdvc"} : (i64) -> !llvm.ptr<i32>
+ %5 = llvm.alloca %4 x i32 {bindc_name = "dvc", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_enter_exitEdvc"} : (i64) -> !llvm.ptr
%6 = llvm.mlir.constant(1 : i64) : i64
- %7 = llvm.alloca %6 x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_enter_exitEi"} : (i64) -> !llvm.ptr<i32>
+ %7 = llvm.alloca %6 x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_enter_exitEi"} : (i64) -> !llvm.ptr
%8 = llvm.mlir.constant(5 : i32) : i32
- llvm.store %8, %7 : !llvm.ptr<i32>
+ llvm.store %8, %7 : i32, !llvm.ptr
%9 = llvm.mlir.constant(2 : i32) : i32
- llvm.store %9, %5 : !llvm.ptr<i32>
- %10 = llvm.load %7 : !llvm.ptr<i32>
+ llvm.store %9, %5 : i32, !llvm.ptr
+ %10 = llvm.load %7 : !llvm.ptr -> i32
%11 = llvm.mlir.constant(10 : i32) : i32
%12 = llvm.icmp "slt" %10, %11 : i32
- %13 = llvm.load %5 : !llvm.ptr<i32>
- %map1 = omp.map_info var_ptr(%1 : !llvm.ptr<array<1024 x i32>>, !llvm.array<1024 x i32>) map_clauses(to) capture(ByRef) -> !llvm.ptr<array<1024 x i32>> {name = ""}
- %map2 = omp.map_info var_ptr(%3 : !llvm.ptr<array<512 x i32>>, !llvm.array<512 x i32>) map_clauses(exit_release_or_enter_alloc) capture(ByRef) -> !llvm.ptr<array<512 x i32>> {name = ""}
- omp.target_enter_data if(%12 : i1) device(%13 : i32) map_entries(%map1, %map2 : !llvm.ptr<array<1024 x i32>>, !llvm.ptr<array<512 x i32>>)
- %14 = llvm.load %7 : !llvm.ptr<i32>
+ %13 = llvm.load %5 : !llvm.ptr -> i32
+ %map1 = omp.map_info var_ptr(%1 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(to) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map2 = omp.map_info var_ptr(%3 : !llvm.ptr, !llvm.array<512 x i32>) map_clauses(exit_release_or_enter_alloc) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_enter_data if(%12 : i1) device(%13 : i32) map_entries(%map1, %map2 : !llvm.ptr, !llvm.ptr)
+ %14 = llvm.load %7 : !llvm.ptr -> i32
%15 = llvm.mlir.constant(10 : i32) : i32
%16 = llvm.icmp "sgt" %14, %15 : i32
- %17 = llvm.load %5 : !llvm.ptr<i32>
- %map3 = omp.map_info var_ptr(%1 : !llvm.ptr<array<1024 x i32>>, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr<array<1024 x i32>> {name = ""}
- %map4 = omp.map_info var_ptr(%3 : !llvm.ptr<array<512 x i32>>, !llvm.array<512 x i32>) map_clauses(exit_release_or_enter_alloc) capture(ByRef) -> !llvm.ptr<array<512 x i32>> {name = ""}
- omp.target_exit_data if(%16 : i1) device(%17 : i32) map_entries(%map3, %map4 : !llvm.ptr<array<1024 x i32>>, !llvm.ptr<array<512 x i32>>)
+ %17 = llvm.load %5 : !llvm.ptr -> i32
+ %map3 = omp.map_info var_ptr(%1 : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map4 = omp.map_info var_ptr(%3 : !llvm.ptr, !llvm.array<512 x i32>) map_clauses(exit_release_or_enter_alloc) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_exit_data if(%16 : i1) device(%17 : i32) map_entries(%map3, %map4 : !llvm.ptr, !llvm.ptr)
llvm.return
}
@@ -177,13 +177,13 @@ llvm.func @_QPomp_target_enter_exit(%1 : !llvm.ptr<array<1024 x i32>>, %3 : !llv
llvm.func @_QPopenmp_target_use_dev_ptr() {
%0 = llvm.mlir.constant(1 : i64) : i64
- %a = llvm.alloca %0 x !llvm.ptr<!llvm.ptr<i32>> : (i64) -> !llvm.ptr<!llvm.ptr<i32>>
- %map1 = omp.map_info var_ptr(%a : !llvm.ptr<!llvm.ptr<i32>>, !llvm.ptr<i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr<!llvm.ptr<i32>> {name = ""}
- omp.target_data map_entries(%map1 : !llvm.ptr<!llvm.ptr<i32>>) use_device_ptr(%a : !llvm.ptr<!llvm.ptr<i32>>) {
- ^bb0(%arg0: !llvm.ptr<!llvm.ptr<i32>>):
+ %a = llvm.alloca %0 x !llvm.ptr : (i64) -> !llvm.ptr
+ %map1 = omp.map_info var_ptr(%a : !llvm.ptr, !llvm.ptr) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%map1 : !llvm.ptr) use_device_ptr(%a : !llvm.ptr) {
+ ^bb0(%arg0: !llvm.ptr):
%1 = llvm.mlir.constant(10 : i32) : i32
- %2 = llvm.load %arg0 : !llvm.ptr<!llvm.ptr<i32>>
- llvm.store %1, %2 : !llvm.ptr<i32>
+ %2 = llvm.load %arg0 : !llvm.ptr -> !llvm.ptr
+ llvm.store %1, %2 : i32, !llvm.ptr
omp.terminator
}
llvm.return
@@ -221,13 +221,13 @@ llvm.func @_QPopenmp_target_use_dev_ptr() {
llvm.func @_QPopenmp_target_use_dev_addr() {
%0 = llvm.mlir.constant(1 : i64) : i64
- %a = llvm.alloca %0 x !llvm.ptr<!llvm.ptr<i32>> : (i64) -> !llvm.ptr<!llvm.ptr<i32>>
- %map = omp.map_info var_ptr(%a : !llvm.ptr<!llvm.ptr<i32>>, !llvm.ptr<i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr<!llvm.ptr<i32>> {name = ""}
- omp.target_data map_entries(%map : !llvm.ptr<!llvm.ptr<i32>>) use_device_addr(%a : !llvm.ptr<!llvm.ptr<i32>>) {
- ^bb0(%arg0: !llvm.ptr<!llvm.ptr<i32>>):
+ %a = llvm.alloca %0 x !llvm.ptr : (i64) -> !llvm.ptr
+ %map = omp.map_info var_ptr(%a : !llvm.ptr, !llvm.ptr) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%map : !llvm.ptr) use_device_addr(%a : !llvm.ptr) {
+ ^bb0(%arg0: !llvm.ptr):
%1 = llvm.mlir.constant(10 : i32) : i32
- %2 = llvm.load %arg0 : !llvm.ptr<!llvm.ptr<i32>>
- llvm.store %1, %2 : !llvm.ptr<i32>
+ %2 = llvm.load %arg0 : !llvm.ptr -> !llvm.ptr
+ llvm.store %1, %2 : i32, !llvm.ptr
omp.terminator
}
llvm.return
@@ -263,12 +263,12 @@ llvm.func @_QPopenmp_target_use_dev_addr() {
llvm.func @_QPopenmp_target_use_dev_addr_no_ptr() {
%0 = llvm.mlir.constant(1 : i64) : i64
- %a = llvm.alloca %0 x !llvm.ptr<i32> : (i64) -> !llvm.ptr<i32>
- %map = omp.map_info var_ptr(%a : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target_data map_entries(%map : !llvm.ptr<i32>) use_device_addr(%a : !llvm.ptr<i32>) {
- ^bb0(%arg0: !llvm.ptr<i32>):
+ %a = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr
+ %map = omp.map_info var_ptr(%a : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%map : !llvm.ptr) use_device_addr(%a : !llvm.ptr) {
+ ^bb0(%arg0: !llvm.ptr):
%1 = llvm.mlir.constant(10 : i32) : i32
- llvm.store %1, %arg0 : !llvm.ptr<i32>
+ llvm.store %1, %arg0 : i32, !llvm.ptr
omp.terminator
}
llvm.return
@@ -303,18 +303,18 @@ llvm.func @_QPopenmp_target_use_dev_addr_no_ptr() {
llvm.func @_QPopenmp_target_use_dev_addr_nomap() {
%0 = llvm.mlir.constant(1 : i64) : i64
- %a = llvm.alloca %0 x !llvm.ptr<!llvm.ptr<i32>> : (i64) -> !llvm.ptr<!llvm.ptr<i32>>
+ %a = llvm.alloca %0 x !llvm.ptr : (i64) -> !llvm.ptr
%1 = llvm.mlir.constant(1 : i64) : i64
- %b = llvm.alloca %0 x !llvm.ptr<!llvm.ptr<i32>> : (i64) -> !llvm.ptr<!llvm.ptr<i32>>
- %map = omp.map_info var_ptr(%b : !llvm.ptr<!llvm.ptr<i32>>, !llvm.ptr<i32>) map_clauses(from) capture(ByRef) -> !llvm.ptr<!llvm.ptr<i32>> {name = ""}
- omp.target_data map_entries(%map : !llvm.ptr<!llvm.ptr<i32>>) use_device_addr(%a : !llvm.ptr<!llvm.ptr<i32>>) {
- ^bb0(%arg0: !llvm.ptr<!llvm.ptr<i32>>):
+ %b = llvm.alloca %0 x !llvm.ptr : (i64) -> !llvm.ptr
+ %map = omp.map_info var_ptr(%b : !llvm.ptr, !llvm.ptr) map_clauses(from) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%map : !llvm.ptr) use_device_addr(%a : !llvm.ptr) {
+ ^bb0(%arg0: !llvm.ptr):
%2 = llvm.mlir.constant(10 : i32) : i32
- %3 = llvm.load %arg0 : !llvm.ptr<!llvm.ptr<i32>>
- llvm.store %2, %3 : !llvm.ptr<i32>
+ %3 = llvm.load %arg0 : !llvm.ptr -> !llvm.ptr
+ llvm.store %2, %3 : i32, !llvm.ptr
%4 = llvm.mlir.constant(20 : i32) : i32
- %5 = llvm.load %b : !llvm.ptr<!llvm.ptr<i32>>
- llvm.store %4, %5 : !llvm.ptr<i32>
+ %5 = llvm.load %b : !llvm.ptr -> !llvm.ptr
+ llvm.store %4, %5 : i32, !llvm.ptr
omp.terminator
}
llvm.return
@@ -359,19 +359,19 @@ llvm.func @_QPopenmp_target_use_dev_addr_nomap() {
llvm.func @_QPopenmp_target_use_dev_both() {
%0 = llvm.mlir.constant(1 : i64) : i64
- %a = llvm.alloca %0 x !llvm.ptr<!llvm.ptr<i32>> : (i64) -> !llvm.ptr<!llvm.ptr<i32>>
+ %a = llvm.alloca %0 x !llvm.ptr : (i64) -> !llvm.ptr
%1 = llvm.mlir.constant(1 : i64) : i64
- %b = llvm.alloca %0 x !llvm.ptr<!llvm.ptr<i32>> : (i64) -> !llvm.ptr<!llvm.ptr<i32>>
- %map = omp.map_info var_ptr(%a : !llvm.ptr<!llvm.ptr<i32>>, !llvm.ptr<i32>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<!llvm.ptr<i32>> {name = ""}
- %map1 = omp.map_info var_ptr(%b : !llvm.ptr<!llvm.ptr<i32>>, !llvm.ptr<i32>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<!llvm.ptr<i32>> {name = ""}
- omp.target_data map_entries(%map, %map1 : !llvm.ptr<!llvm.ptr<i32>>, !llvm.ptr<!llvm.ptr<i32>>) use_device_ptr(%a : !llvm.ptr<!llvm.ptr<i32>>) use_device_addr(%b : !llvm.ptr<!llvm.ptr<i32>>) {
- ^bb0(%arg0: !llvm.ptr<!llvm.ptr<i32>>, %arg1: !llvm.ptr<!llvm.ptr<i32>>):
+ %b = llvm.alloca %0 x !llvm.ptr : (i64) -> !llvm.ptr
+ %map = omp.map_info var_ptr(%a : !llvm.ptr, !llvm.ptr) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map1 = omp.map_info var_ptr(%b : !llvm.ptr, !llvm.ptr) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target_data map_entries(%map, %map1 : !llvm.ptr, !llvm.ptr) use_device_ptr(%a : !llvm.ptr) use_device_addr(%b : !llvm.ptr) {
+ ^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):
%2 = llvm.mlir.constant(10 : i32) : i32
- %3 = llvm.load %arg0 : !llvm.ptr<!llvm.ptr<i32>>
- llvm.store %2, %3 : !llvm.ptr<i32>
+ %3 = llvm.load %arg0 : !llvm.ptr -> !llvm.ptr
+ llvm.store %2, %3 : i32, !llvm.ptr
%4 = llvm.mlir.constant(20 : i32) : i32
- %5 = llvm.load %arg1 : !llvm.ptr<!llvm.ptr<i32>>
- llvm.store %4, %5 : !llvm.ptr<i32>
+ %5 = llvm.load %arg1 : !llvm.ptr -> !llvm.ptr
+ llvm.store %4, %5 : i32, !llvm.ptr
omp.terminator
}
llvm.return
diff --git a/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir
index 198913b26964f46..f907e013d8f26c9 100644
--- a/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir
@@ -5,21 +5,21 @@ module attributes {omp.is_target_device = true} {
%0 = llvm.mlir.constant(20 : i32) : i32
%1 = llvm.mlir.constant(10 : i32) : i32
%2 = llvm.mlir.constant(1 : i64) : i64
- %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr<i32>
+ %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr
%4 = llvm.mlir.constant(1 : i64) : i64
- %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr<i32>
+ %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr
%6 = llvm.mlir.constant(1 : i64) : i64
- %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr<i32>
- llvm.store %1, %3 : !llvm.ptr<i32>
- llvm.store %0, %5 : !llvm.ptr<i32>
- %map1 = omp.map_info var_ptr(%3 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %map2 = omp.map_info var_ptr(%5 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %map3 = omp.map_info var_ptr(%7 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target map_entries(%map1, %map2, %map3 : !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>) {
- %8 = llvm.load %3 : !llvm.ptr<i32>
- %9 = llvm.load %5 : !llvm.ptr<i32>
+ %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr
+ llvm.store %1, %3 : i32, !llvm.ptr
+ llvm.store %0, %5 : i32, !llvm.ptr
+ %map1 = omp.map_info var_ptr(%3 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map2 = omp.map_info var_ptr(%5 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map3 = omp.map_info var_ptr(%7 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target map_entries(%map1, %map2, %map3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {
+ %8 = llvm.load %3 : !llvm.ptr -> i32
+ %9 = llvm.load %5 : !llvm.ptr -> i32
%10 = llvm.add %8, %9 : i32
- llvm.store %10, %7 : !llvm.ptr<i32>
+ llvm.store %10, %7 : i32, !llvm.ptr
omp.terminator
}
llvm.return
diff --git a/mlir/test/Target/LLVMIR/omptarget-region-llvm-target-device.mlir b/mlir/test/Target/LLVMIR/omptarget-region-llvm-target-device.mlir
index db7986c3f39b3c5..2cd0331087ec01c 100644
--- a/mlir/test/Target/LLVMIR/omptarget-region-llvm-target-device.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-region-llvm-target-device.mlir
@@ -3,14 +3,14 @@
// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
module attributes {omp.is_target_device = true} {
- llvm.func @writeindex_omp_outline_0_(%arg0: !llvm.ptr<i32>, %arg1: !llvm.ptr<i32>) attributes {omp.outline_parent_name = "writeindex_"} {
- %0 = omp.map_info var_ptr(%arg0 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %1 = omp.map_info var_ptr(%arg1 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target map_entries(%0, %1 : !llvm.ptr<i32>, !llvm.ptr<i32>) {
+ llvm.func @writeindex_omp_outline_0_(%arg0: !llvm.ptr, %arg1: !llvm.ptr) attributes {omp.outline_parent_name = "writeindex_"} {
+ %0 = omp.map_info var_ptr(%arg0 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %1 = omp.map_info var_ptr(%arg1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target map_entries(%0, %1 : !llvm.ptr, !llvm.ptr) {
%2 = llvm.mlir.constant(20 : i32) : i32
%3 = llvm.mlir.constant(10 : i32) : i32
- llvm.store %3, %arg0 : !llvm.ptr<i32>
- llvm.store %2, %arg1 : !llvm.ptr<i32>
+ llvm.store %3, %arg0 : i32, !llvm.ptr
+ llvm.store %2, %arg1 : i32, !llvm.ptr
omp.terminator
}
llvm.return
diff --git a/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir
index 4e5606422cecf1d..4e89b8585c75254 100644
--- a/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir
@@ -5,21 +5,21 @@ module attributes {omp.is_target_device = false} {
%0 = llvm.mlir.constant(20 : i32) : i32
%1 = llvm.mlir.constant(10 : i32) : i32
%2 = llvm.mlir.constant(1 : i64) : i64
- %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr<i32>
+ %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr
%4 = llvm.mlir.constant(1 : i64) : i64
- %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr<i32>
+ %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr
%6 = llvm.mlir.constant(1 : i64) : i64
- %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr<i32>
- llvm.store %1, %3 : !llvm.ptr<i32>
- llvm.store %0, %5 : !llvm.ptr<i32>
- %map1 = omp.map_info var_ptr(%3 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %map2 = omp.map_info var_ptr(%5 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %map3 = omp.map_info var_ptr(%7 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target map_entries(%map1, %map2, %map3 : !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>) {
- %8 = llvm.load %3 : !llvm.ptr<i32>
- %9 = llvm.load %5 : !llvm.ptr<i32>
+ %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr
+ llvm.store %1, %3 : i32, !llvm.ptr
+ llvm.store %0, %5 : i32, !llvm.ptr
+ %map1 = omp.map_info var_ptr(%3 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map2 = omp.map_info var_ptr(%5 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map3 = omp.map_info var_ptr(%7 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target map_entries(%map1, %map2, %map3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {
+ %8 = llvm.load %3 : !llvm.ptr -> i32
+ %9 = llvm.load %5 : !llvm.ptr -> i32
%10 = llvm.add %8, %9 : i32
- llvm.store %10, %7 : !llvm.ptr<i32>
+ llvm.store %10, %7 : i32, !llvm.ptr
omp.terminator
}
llvm.return
diff --git a/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir
index dae193f194d3e25..20ad6d30c2f52ef 100644
--- a/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir
@@ -5,22 +5,22 @@ module attributes {omp.is_target_device = false} {
%0 = llvm.mlir.constant(20 : i32) : i32
%1 = llvm.mlir.constant(10 : i32) : i32
%2 = llvm.mlir.constant(1 : i64) : i64
- %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr<i32>
+ %3 = llvm.alloca %2 x i32 {bindc_name = "a", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEa"} : (i64) -> !llvm.ptr
%4 = llvm.mlir.constant(1 : i64) : i64
- %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr<i32>
+ %5 = llvm.alloca %4 x i32 {bindc_name = "b", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEb"} : (i64) -> !llvm.ptr
%6 = llvm.mlir.constant(1 : i64) : i64
- %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr<i32>
- llvm.store %1, %3 : !llvm.ptr<i32>
- llvm.store %0, %5 : !llvm.ptr<i32>
- %map1 = omp.map_info var_ptr(%3 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %map2 = omp.map_info var_ptr(%5 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- %map3 = omp.map_info var_ptr(%7 : !llvm.ptr<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
- omp.target map_entries( %map1, %map2, %map3 : !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>) {
+ %7 = llvm.alloca %6 x i32 {bindc_name = "c", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFomp_target_regionEc"} : (i64) -> !llvm.ptr
+ llvm.store %1, %3 : i32, !llvm.ptr
+ llvm.store %0, %5 : i32, !llvm.ptr
+ %map1 = omp.map_info var_ptr(%3 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map2 = omp.map_info var_ptr(%5 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ %map3 = omp.map_info var_ptr(%7 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+ omp.target map_entries( %map1, %map2, %map3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {
omp.parallel {
- %8 = llvm.load %3 : !llvm.ptr<i32>
- %9 = llvm.load %5 : !llvm.ptr<i32>
+ %8 = llvm.load %3 : !llvm.ptr -> i32
+ %9 = llvm.load %5 : !llvm.ptr -> i32
%10 = llvm.add %8, %9 : i32
- llvm.store %10, %7 : !llvm.ptr<i32>
+ llvm.store %10, %7 : i32, !llvm.ptr
omp.terminator
}
omp.terminator
diff --git a/mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir b/mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir
deleted file mode 100644
index 64d345fb1f1d8f8..000000000000000
--- a/mlir/test/Target/LLVMIR/openmp-reduction-typed-pointers.mlir
+++ /dev/null
@@ -1,75 +0,0 @@
-// RUN: mlir-translate -mlir-to-llvmir -split-input-file %s | FileCheck %s
-
-// Only check the overall shape of the code and the presence of relevant
-// runtime calls. Actual IR checking is done at the OpenMPIRBuilder level.
-
-omp.reduction.declare @add_f32 : f32
-init {
-^bb0(%arg: f32):
- %0 = llvm.mlir.constant(0.0 : f32) : f32
- omp.yield (%0 : f32)
-}
-combiner {
-^bb1(%arg0: f32, %arg1: f32):
- %1 = llvm.fadd %arg0, %arg1 : f32
- omp.yield (%1 : f32)
-}
-atomic {
-^bb2(%arg2: !llvm.ptr<f32>, %arg3: !llvm.ptr<f32>):
- %2 = llvm.load %arg3 : !llvm.ptr<f32>
- llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr<f32>, f32
- omp.yield
-}
-
-// CHECK-LABEL: @simple_reduction
-llvm.func @simple_reduction(%lb : i64, %ub : i64, %step : i64) {
- %c1 = llvm.mlir.constant(1 : i32) : i32
- %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr<f32>
- omp.parallel {
- omp.wsloop reduction(@add_f32 -> %0 : !llvm.ptr<f32>)
- for (%iv) : i64 = (%lb) to (%ub) step (%step) {
- %1 = llvm.mlir.constant(2.0 : f32) : f32
- omp.reduction %1, %0 : f32, !llvm.ptr<f32>
- omp.yield
- }
- omp.terminator
- }
- llvm.return
-}
-
-// Call to the outlined function.
-// CHECK: call void {{.*}} @__kmpc_fork_call
-// CHECK-SAME: @[[OUTLINED:[A-Za-z_.][A-Za-z0-9_.]*]]
-
-// Outlined function.
-// CHECK: define internal void @[[OUTLINED]]
-
-// Private reduction variable and its initialization.
-// CHECK: %[[PRIVATE:.+]] = alloca float
-// CHECK: store float 0.000000e+00, ptr %[[PRIVATE]]
-
-// Call to the reduction function.
-// CHECK: call i32 @__kmpc_reduce
-// CHECK-SAME: @[[REDFUNC:[A-Za-z_.][A-Za-z0-9_.]*]]
-
-// Atomic reduction.
-// CHECK: %[[PARTIAL:.+]] = load float, ptr %[[PRIVATE]]
-// CHECK: atomicrmw fadd ptr %{{.*}}, float %[[PARTIAL]]
-
-// Non-atomic reduction:
-// CHECK: fadd float
-// CHECK: call void @__kmpc_end_reduce
-// CHECK: br label %[[FINALIZE:.+]]
-
-// CHECK: [[FINALIZE]]:
-// CHECK: call void @__kmpc_barrier
-
-// Update of the private variable using the reduction region
-// (the body block currently comes after all the other blocks).
-// CHECK: %[[PARTIAL:.+]] = load float, ptr %[[PRIVATE]]
-// CHECK: %[[UPDATED:.+]] = fadd float %[[PARTIAL]], 2.000000e+00
-// CHECK: store float %[[UPDATED]], ptr %[[PRIVATE]]
-
-// Reduction function.
-// CHECK: define internal void @[[REDFUNC]]
-// CHECK: fadd float
More information about the Mlir-commits
mailing list