Skip to content

[OpenMP][MLIR] Use opaque pointers in OpenMP translation tests 1/2 #70057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions mlir/test/Target/LLVMIR/openmp-llvm-invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// Checking translation when the update is carried out by using more than one op
// in the region.
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32) {
omp.atomic.update %x : !llvm.ptr<i32> {
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr, %expr: i32) {
omp.atomic.update %x : !llvm.ptr {
^bb0(%xval: i32):
%t1 = llvm.mul %xval, %expr : i32
%t2 = llvm.sdiv %t1, %expr : i32
Expand All @@ -17,10 +17,10 @@ llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32

// Checking translation when the captured variable is not used in the inner
// update operation
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32) {
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr, %expr: i32) {
// expected-error @+2 {{no atomic update operation with region argument as operand found inside atomic.update region}}
// expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.update}}
omp.atomic.update %x : !llvm.ptr<i32> {
omp.atomic.update %x : !llvm.ptr {
^bb0(%xval: i32):
%newval = llvm.mul %expr, %expr : i32
omp.yield(%newval : i32)
Expand All @@ -32,12 +32,12 @@ llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %expr: i32

// Checking translation when the update is carried out by using more than one
// operations in the atomic capture region.
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.ptr<i32>, %expr: i32) {
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr, %v: !llvm.ptr, %expr: i32) {
// expected-error @+1 {{LLVM Translation failed for operation: omp.atomic.capture}}
omp.atomic.capture memory_order(seq_cst) {
omp.atomic.read %v = %x : !llvm.ptr<i32>, i32
omp.atomic.read %v = %x : !llvm.ptr, i32
// expected-error @+1 {{no atomic update operation with region argument as operand found inside atomic.update region}}
omp.atomic.update %x : !llvm.ptr<i32> {
omp.atomic.update %x : !llvm.ptr {
^bb0(%xval: i32):
%newval = llvm.mul %expr, %expr : i32
omp.yield(%newval : i32)
Expand All @@ -50,10 +50,10 @@ llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.

// Checking translation when the captured variable is not used in the inner
// update operation
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr<i32>, %v: !llvm.ptr<i32>, %expr: i32) {
llvm.func @omp_atomic_update_multiple_step_update(%x: !llvm.ptr, %v: !llvm.ptr, %expr: i32) {
omp.atomic.capture memory_order(seq_cst) {
omp.atomic.read %v = %x : !llvm.ptr<i32>, i32
omp.atomic.update %x : !llvm.ptr<i32> {
omp.atomic.read %v = %x : !llvm.ptr, i32
omp.atomic.update %x : !llvm.ptr {
^bb0(%xval: i32):
%t1 = llvm.mul %xval, %expr : i32
%t2 = llvm.sdiv %t1, %expr : i32
Expand All @@ -72,20 +72,20 @@ llvm.func @omp_threadprivate() {
%2 = llvm.mlir.constant(2 : i32) : i32
%3 = llvm.mlir.constant(3 : i32) : i32

%4 = llvm.alloca %0 x i32 {in_type = i32, name = "a"} : (i64) -> !llvm.ptr<i32>
%4 = llvm.alloca %0 x i32 {in_type = i32, name = "a"} : (i64) -> !llvm.ptr

// expected-error @below {{Addressing symbol not found}}
// expected-error @below {{LLVM Translation failed for operation: omp.threadprivate}}
%5 = omp.threadprivate %4 : !llvm.ptr<i32> -> !llvm.ptr<i32>
%5 = omp.threadprivate %4 : !llvm.ptr -> !llvm.ptr

llvm.store %1, %5 : !llvm.ptr<i32>
llvm.store %1, %5 : i32, !llvm.ptr

omp.parallel {
%6 = omp.threadprivate %4 : !llvm.ptr<i32> -> !llvm.ptr<i32>
llvm.store %2, %6 : !llvm.ptr<i32>
%6 = omp.threadprivate %4 : !llvm.ptr -> !llvm.ptr
llvm.store %2, %6 : i32, !llvm.ptr
omp.terminator
}

llvm.store %3, %5 : !llvm.ptr<i32>
llvm.store %3, %5 : i32, !llvm.ptr
llvm.return
}
Loading