Skip to content

[MLIR][OpenMP] Simplify OpenMP to LLVM dialect conversion #132009

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 2 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
92 changes: 0 additions & 92 deletions mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -891,17 +891,6 @@ def FlushOp : OpenMP_Op<"flush", clauses = [

// Override inherited assembly format to include `varList`.
let assemblyFormat = "( `(` $varList^ `:` type($varList) `)` )? attr-dict";

let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
return getOperation()->getNumOperands();
}
/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
return getOperand(i);
}
}] # clausesExtraClassDeclaration;
}

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -1001,18 +990,6 @@ def MapBoundsOp : OpenMP_Op<"map.bounds",
) attr-dict
}];

let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
return getNumOperands();
}

/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
return getOperands()[i];
}
}];

let hasVerifier = 1;
}

Expand Down Expand Up @@ -1098,18 +1075,6 @@ def MapInfoOp : OpenMP_Op<"map.info", [AttrSizedOperandSegments]> {
| `bounds` `(` $bounds `)`
) `->` type($omp_ptr) attr-dict
}];

let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
return getNumOperands();
}

/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
return getOperands()[i];
}
}];
}

//===---------------------------------------------------------------------===//
Expand Down Expand Up @@ -1515,21 +1480,6 @@ def AtomicReadOp : OpenMP_Op<"atomic.read", traits = [
clausesOptAssemblyFormat #
") `:` type($v) `,` type($x) `,` $element_type attr-dict";

let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
assert(getX() && "expected 'x' operand");
assert(getV() && "expected 'v' operand");
return 2;
}

/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
assert(i < 2 && "invalid index position for an operand");
return i == 0 ? getX() : getV();
}
}] # clausesExtraClassDeclaration;

let hasVerifier = 1;
}

Expand All @@ -1555,21 +1505,6 @@ def AtomicWriteOp : OpenMP_Op<"atomic.write", traits = [
let assemblyFormat = "$x `=` $expr" # clausesReqAssemblyFormat # " oilist(" #
clausesOptAssemblyFormat # ") `:` type($x) `,` type($expr) attr-dict";

let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
assert(getX() && "expected address operand");
assert(getExpr() && "expected value operand");
return 2;
}

/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
assert(i < 2 && "invalid index position for an operand");
return i == 0 ? getX() : getExpr();
}
}] # clausesExtraClassDeclaration;

let hasVerifier = 1;
}

Expand Down Expand Up @@ -1614,20 +1549,6 @@ def AtomicUpdateOp : OpenMP_Op<"atomic.update", traits = [
let assemblyFormat = clausesAssemblyFormat #
"$x `:` type($x) $region attr-dict";

let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
assert(getX() && "expected 'x' operand");
return 1;
}

/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
assert(i == 0 && "invalid index position for an operand");
return getX();
}
}] # clausesExtraClassDeclaration;

let hasVerifier = 1;
let hasRegionVerifier = 1;
let hasCanonicalizeMethod = 1;
Expand Down Expand Up @@ -1715,19 +1636,6 @@ def ThreadprivateOp : OpenMP_Op<"threadprivate",
let assemblyFormat = [{
$sym_addr `:` type($sym_addr) `->` type($tls_addr) attr-dict
}];
let extraClassDeclaration = [{
/// The number of variable operands.
unsigned getNumVariableOperands() {
assert(getSymAddr() && "expected one variable operand");
return 1;
}

/// The i-th variable operand passed.
Value getVariableOperand(unsigned i) {
assert(i == 0 && "invalid index position for an operand");
return getSymAddr();
}
}];
}

//===----------------------------------------------------------------------===//
Expand Down
Loading