Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
fix some more mlir tests for new map, only one final test to go
Browse files Browse the repository at this point in the history
  • Loading branch information
agozillon committed Aug 22, 2023
1 parent 2b72ffc commit 9f0aa18
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
5 changes: 4 additions & 1 deletion mlir/test/Target/LLVMIR/omptarget-region-device-llvm.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ module attributes {omp.is_target_device = true} {
%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>
omp.target map((ByRef, tofrom -> %3 : !llvm.ptr<i32>), (ByRef, tofrom -> %5 : !llvm.ptr<i32>), (ByRef, tofrom -> %7 : !llvm.ptr<i32>)) {
%map1 = omp.map_entry var_ptr(%3 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%map2 = omp.map_entry var_ptr(%5 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%map3 = omp.map_entry var_ptr(%7 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
omp.target map_entries((tofrom -> %map1 : !llvm.ptr<i32>), (tofrom -> %map2 : !llvm.ptr<i32>), (tofrom -> %map3 : !llvm.ptr<i32>)) {
%8 = llvm.load %3 : !llvm.ptr<i32>
%9 = llvm.load %5 : !llvm.ptr<i32>
%10 = llvm.add %8, %9 : i32
Expand Down
14 changes: 8 additions & 6 deletions mlir/test/Target/LLVMIR/omptarget-region-llvm-target-device.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

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_"} {
omp.target map((ByRef, from -> %arg0 : !llvm.ptr<i32>), (ByRef, implicit -> %arg1: !llvm.ptr<i32>)) {
%0 = llvm.mlir.constant(20 : i32) : i32
%1 = llvm.mlir.constant(10 : i32) : i32
llvm.store %1, %arg0 : !llvm.ptr<i32>
llvm.store %0, %arg1 : !llvm.ptr<i32>
%0 = omp.map_entry var_ptr(%arg0 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%1 = omp.map_entry var_ptr(%arg1 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
omp.target map_entries((tofrom -> %0 : !llvm.ptr<i32>), (tofrom -> %1: !llvm.ptr<i32>)) {
%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>
omp.terminator
}
llvm.return
}
}

// CHECK: define {{.*}} void @__omp_offloading_{{.*}}_{{.*}}_writeindex__l7(ptr {{.*}}, ptr {{.*}}) {
// CHECK: define {{.*}} void @__omp_offloading_{{.*}}_{{.*}}_writeindex__l{{.*}}(ptr {{.*}}, ptr {{.*}}) {
5 changes: 4 additions & 1 deletion mlir/test/Target/LLVMIR/omptarget-region-llvm.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ module attributes {omp.is_target_device = false} {
%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>
omp.target map((ByRef, tofrom -> %3 : !llvm.ptr<i32>), (ByRef, tofrom -> %5 : !llvm.ptr<i32>), (ByRef, tofrom -> %7 : !llvm.ptr<i32>)) {
%map1 = omp.map_entry var_ptr(%3 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%map2 = omp.map_entry var_ptr(%5 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%map3 = omp.map_entry var_ptr(%7 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
omp.target map_entries((tofrom -> %map1 : !llvm.ptr<i32>), (tofrom -> %map2 : !llvm.ptr<i32>), (tofrom -> %map3 : !llvm.ptr<i32>)) {
%8 = llvm.load %3 : !llvm.ptr<i32>
%9 = llvm.load %5 : !llvm.ptr<i32>
%10 = llvm.add %8, %9 : i32
Expand Down
5 changes: 4 additions & 1 deletion mlir/test/Target/LLVMIR/omptarget-region-parallel-llvm.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ module attributes {omp.is_target_device = false} {
%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>
omp.target map((ByRef, tofrom -> %3 : !llvm.ptr<i32>), (ByRef, tofrom -> %5 : !llvm.ptr<i32>), (ByRef, tofrom -> %7 : !llvm.ptr<i32>)) {
%map1 = omp.map_entry var_ptr(%3 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%map2 = omp.map_entry var_ptr(%5 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
%map3 = omp.map_entry var_ptr(%7 : !llvm.ptr<i32>) map_type_value(35) capture(ByRef) -> !llvm.ptr<i32> {name = ""}
omp.target map_entries((tofrom -> %map1 : !llvm.ptr<i32>), (tofrom -> %map2 : !llvm.ptr<i32>), (tofrom -> %map3 : !llvm.ptr<i32>)) {
omp.parallel {
%8 = llvm.load %3 : !llvm.ptr<i32>
%9 = llvm.load %5 : !llvm.ptr<i32>
Expand Down

0 comments on commit 9f0aa18

Please sign in to comment.