[Mlir-commits] [mlir] f9806b3 - [mlir:OpenACC][NFC] Update OpenACC API to use prefixed accessors
River Riddle
llvmlistbot at llvm.org
Fri Sep 30 15:34:24 PDT 2022
Author: River Riddle
Date: 2022-09-30T15:27:10-07:00
New Revision: f9806b3e3e201a2345e10ce0061af8cb88f73c32
URL: https://github.com/llvm/llvm-project/commit/f9806b3e3e201a2345e10ce0061af8cb88f73c32
DIFF: https://github.com/llvm/llvm-project/commit/f9806b3e3e201a2345e10ce0061af8cb88f73c32.diff
LOG: [mlir:OpenACC][NFC] Update OpenACC API to use prefixed accessors
This doesn't flip the switch for prefix generation yet, that'll be
done in a followup.
Added:
Modified:
mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp b/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
index 525d12b7b8d7f..54f3e44f0c17a 100644
--- a/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
+++ b/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
@@ -183,56 +183,56 @@ void ConvertOpenACCToLLVMPass::runOnOperation() {
target.addDynamicallyLegalOp<acc::DataOp>(
[allDataOperandsAreConverted](acc::DataOp op) {
- return allDataOperandsAreConverted(op.copyOperands()) &&
- allDataOperandsAreConverted(op.copyinOperands()) &&
- allDataOperandsAreConverted(op.copyinReadonlyOperands()) &&
- allDataOperandsAreConverted(op.copyoutOperands()) &&
- allDataOperandsAreConverted(op.copyoutZeroOperands()) &&
- allDataOperandsAreConverted(op.createOperands()) &&
- allDataOperandsAreConverted(op.createZeroOperands()) &&
- allDataOperandsAreConverted(op.noCreateOperands()) &&
- allDataOperandsAreConverted(op.presentOperands()) &&
- allDataOperandsAreConverted(op.deviceptrOperands()) &&
- allDataOperandsAreConverted(op.attachOperands());
+ return allDataOperandsAreConverted(op.getCopyOperands()) &&
+ allDataOperandsAreConverted(op.getCopyinOperands()) &&
+ allDataOperandsAreConverted(op.getCopyinReadonlyOperands()) &&
+ allDataOperandsAreConverted(op.getCopyoutOperands()) &&
+ allDataOperandsAreConverted(op.getCopyoutZeroOperands()) &&
+ allDataOperandsAreConverted(op.getCreateOperands()) &&
+ allDataOperandsAreConverted(op.getCreateZeroOperands()) &&
+ allDataOperandsAreConverted(op.getNoCreateOperands()) &&
+ allDataOperandsAreConverted(op.getPresentOperands()) &&
+ allDataOperandsAreConverted(op.getDeviceptrOperands()) &&
+ allDataOperandsAreConverted(op.getAttachOperands());
});
target.addDynamicallyLegalOp<acc::EnterDataOp>(
[allDataOperandsAreConverted](acc::EnterDataOp op) {
- return allDataOperandsAreConverted(op.copyinOperands()) &&
- allDataOperandsAreConverted(op.createOperands()) &&
- allDataOperandsAreConverted(op.createZeroOperands()) &&
- allDataOperandsAreConverted(op.attachOperands());
+ return allDataOperandsAreConverted(op.getCopyinOperands()) &&
+ allDataOperandsAreConverted(op.getCreateOperands()) &&
+ allDataOperandsAreConverted(op.getCreateZeroOperands()) &&
+ allDataOperandsAreConverted(op.getAttachOperands());
});
target.addDynamicallyLegalOp<acc::ExitDataOp>(
[allDataOperandsAreConverted](acc::ExitDataOp op) {
- return allDataOperandsAreConverted(op.copyoutOperands()) &&
- allDataOperandsAreConverted(op.deleteOperands()) &&
- allDataOperandsAreConverted(op.detachOperands());
+ return allDataOperandsAreConverted(op.getCopyoutOperands()) &&
+ allDataOperandsAreConverted(op.getDeleteOperands()) &&
+ allDataOperandsAreConverted(op.getDetachOperands());
});
target.addDynamicallyLegalOp<acc::ParallelOp>(
[allDataOperandsAreConverted](acc::ParallelOp op) {
- return allDataOperandsAreConverted(op.reductionOperands()) &&
- allDataOperandsAreConverted(op.copyOperands()) &&
- allDataOperandsAreConverted(op.copyinOperands()) &&
- allDataOperandsAreConverted(op.copyinReadonlyOperands()) &&
- allDataOperandsAreConverted(op.copyoutOperands()) &&
- allDataOperandsAreConverted(op.copyoutZeroOperands()) &&
- allDataOperandsAreConverted(op.createOperands()) &&
- allDataOperandsAreConverted(op.createZeroOperands()) &&
- allDataOperandsAreConverted(op.noCreateOperands()) &&
- allDataOperandsAreConverted(op.presentOperands()) &&
- allDataOperandsAreConverted(op.devicePtrOperands()) &&
- allDataOperandsAreConverted(op.attachOperands()) &&
- allDataOperandsAreConverted(op.gangPrivateOperands()) &&
- allDataOperandsAreConverted(op.gangFirstPrivateOperands());
+ return allDataOperandsAreConverted(op.getReductionOperands()) &&
+ allDataOperandsAreConverted(op.getCopyOperands()) &&
+ allDataOperandsAreConverted(op.getCopyinOperands()) &&
+ allDataOperandsAreConverted(op.getCopyinReadonlyOperands()) &&
+ allDataOperandsAreConverted(op.getCopyoutOperands()) &&
+ allDataOperandsAreConverted(op.getCopyoutZeroOperands()) &&
+ allDataOperandsAreConverted(op.getCreateOperands()) &&
+ allDataOperandsAreConverted(op.getCreateZeroOperands()) &&
+ allDataOperandsAreConverted(op.getNoCreateOperands()) &&
+ allDataOperandsAreConverted(op.getPresentOperands()) &&
+ allDataOperandsAreConverted(op.getDevicePtrOperands()) &&
+ allDataOperandsAreConverted(op.getAttachOperands()) &&
+ allDataOperandsAreConverted(op.getGangPrivateOperands()) &&
+ allDataOperandsAreConverted(op.getGangFirstPrivateOperands());
});
target.addDynamicallyLegalOp<acc::UpdateOp>(
[allDataOperandsAreConverted](acc::UpdateOp op) {
- return allDataOperandsAreConverted(op.hostOperands()) &&
- allDataOperandsAreConverted(op.deviceOperands());
+ return allDataOperandsAreConverted(op.getHostOperands()) &&
+ allDataOperandsAreConverted(op.getDeviceOperands());
});
if (failed(applyPartialConversion(op, target, std::move(patterns))))
diff --git a/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp b/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
index dea9384d40943..c605f01de3aeb 100644
--- a/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
+++ b/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
@@ -26,8 +26,8 @@ using namespace mlir;
//===----------------------------------------------------------------------===//
namespace {
-/// Pattern to transform the `ifCond` on operation without region into a scf.if
-/// and move the operation into the `then` region.
+/// Pattern to transform the `getIfCond` on operation without region into a
+/// scf.if and move the operation into the `then` region.
template <typename OpTy>
class ExpandIfCondition : public OpRewritePattern<OpTy> {
using OpRewritePattern<OpTy>::OpRewritePattern;
@@ -35,14 +35,14 @@ class ExpandIfCondition : public OpRewritePattern<OpTy> {
LogicalResult matchAndRewrite(OpTy op,
PatternRewriter &rewriter) const override {
// Early exit if there is no condition.
- if (!op.ifCond())
+ if (!op.getIfCond())
return success();
// Condition is not a constant.
- if (!op.ifCond().template getDefiningOp<arith::ConstantOp>()) {
+ if (!op.getIfCond().template getDefiningOp<arith::ConstantOp>()) {
auto ifOp = rewriter.create<scf::IfOp>(op.getLoc(), TypeRange(),
- op.ifCond(), false);
- rewriter.updateRootInPlace(op, [&]() { op.ifCondMutable().erase(0); });
+ op.getIfCond(), false);
+ rewriter.updateRootInPlace(op, [&]() { op.getIfCondMutable().erase(0); });
auto thenBodyBuilder = ifOp.getThenBodyBuilder();
thenBodyBuilder.setListener(rewriter.getListener());
thenBodyBuilder.clone(*op.getOperation());
@@ -79,13 +79,13 @@ void ConvertOpenACCToSCFPass::runOnOperation() {
target.addLegalDialect<acc::OpenACCDialect>();
target.addDynamicallyLegalOp<acc::EnterDataOp>(
- [](acc::EnterDataOp op) { return !op.ifCond(); });
+ [](acc::EnterDataOp op) { return !op.getIfCond(); });
target.addDynamicallyLegalOp<acc::ExitDataOp>(
- [](acc::ExitDataOp op) { return !op.ifCond(); });
+ [](acc::ExitDataOp op) { return !op.getIfCond(); });
target.addDynamicallyLegalOp<acc::UpdateOp>(
- [](acc::UpdateOp op) { return !op.ifCond(); });
+ [](acc::UpdateOp op) { return !op.getIfCond(); });
if (failed(applyPartialConversion(op, target, std::move(patterns))))
signalPassFailure();
diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
index c7cb61ed3e289..b91920325bc10 100644
--- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
+++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
@@ -176,14 +176,15 @@ struct RemoveConstantIfCondition : public OpRewritePattern<OpTy> {
LogicalResult matchAndRewrite(OpTy op,
PatternRewriter &rewriter) const override {
// Early return if there is no condition.
- Value ifCond = op.ifCond();
+ Value ifCond = op.getIfCond();
if (!ifCond)
return success();
IntegerAttr constAttr;
if (matchPattern(ifCond, m_Constant(&constAttr))) {
if (constAttr.getInt())
- rewriter.updateRootInPlace(op, [&]() { op.ifCondMutable().erase(0); });
+ rewriter.updateRootInPlace(op,
+ [&]() { op.getIfCondMutable().erase(0); });
else
rewriter.eraseOp(op);
}
@@ -240,13 +241,13 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
OptionalParseResult async, numGangs, numWorkers, vectorLength;
Type i1Type = builder.getI1Type();
- // async()?
+ // getAsync()?
async = parseOptionalOperandAndType(parser, ParallelOp::getAsyncKeyword(),
result);
if (async.has_value() && failed(*async))
return failure();
- // wait()?
+ // getWait()?
if (failed(parseOperandList(parser, ParallelOp::getWaitKeyword(),
waitOperands, waitOperandTypes, result)))
return failure();
@@ -392,89 +393,94 @@ ParseResult ParallelOp::parse(OpAsmParser &parser, OperationState &result) {
}
void ParallelOp::print(OpAsmPrinter &printer) {
- // async()?
- if (Value async = this->async())
+ // getAsync()?
+ if (Value async = getAsync())
printer << " " << ParallelOp::getAsyncKeyword() << "(" << async << ": "
<< async.getType() << ")";
- // wait()?
- printOperandList(waitOperands(), ParallelOp::getWaitKeyword(), printer);
+ // getWait()?
+ printOperandList(getWaitOperands(), ParallelOp::getWaitKeyword(), printer);
// num_gangs()?
- if (Value numGangs = this->numGangs())
+ if (Value numGangs = getNumGangs())
printer << " " << ParallelOp::getNumGangsKeyword() << "(" << numGangs
<< ": " << numGangs.getType() << ")";
// num_workers()?
- if (Value numWorkers = this->numWorkers())
+ if (Value numWorkers = getNumWorkers())
printer << " " << ParallelOp::getNumWorkersKeyword() << "(" << numWorkers
<< ": " << numWorkers.getType() << ")";
// vector_length()?
- if (Value vectorLength = this->vectorLength())
+ if (Value vectorLength = getVectorLength())
printer << " " << ParallelOp::getVectorLengthKeyword() << "("
<< vectorLength << ": " << vectorLength.getType() << ")";
// if()?
- if (Value ifCond = this->ifCond())
+ if (Value ifCond = getIfCond())
printer << " " << ParallelOp::getIfKeyword() << "(" << ifCond << ")";
// self()?
- if (Value selfCond = this->selfCond())
+ if (Value selfCond = getSelfCond())
printer << " " << ParallelOp::getSelfKeyword() << "(" << selfCond << ")";
// reduction()?
- printOperandList(reductionOperands(), ParallelOp::getReductionKeyword(),
+ printOperandList(getReductionOperands(), ParallelOp::getReductionKeyword(),
printer);
// copy()?
- printOperandList(copyOperands(), ParallelOp::getCopyKeyword(), printer);
+ printOperandList(getCopyOperands(), ParallelOp::getCopyKeyword(), printer);
// copyin()?
- printOperandList(copyinOperands(), ParallelOp::getCopyinKeyword(), printer);
+ printOperandList(getCopyinOperands(), ParallelOp::getCopyinKeyword(),
+ printer);
// copyin_readonly()?
- printOperandList(copyinReadonlyOperands(),
+ printOperandList(getCopyinReadonlyOperands(),
ParallelOp::getCopyinReadonlyKeyword(), printer);
// copyout()?
- printOperandList(copyoutOperands(), ParallelOp::getCopyoutKeyword(), printer);
+ printOperandList(getCopyoutOperands(), ParallelOp::getCopyoutKeyword(),
+ printer);
// copyout_zero()?
- printOperandList(copyoutZeroOperands(), ParallelOp::getCopyoutZeroKeyword(),
- printer);
+ printOperandList(getCopyoutZeroOperands(),
+ ParallelOp::getCopyoutZeroKeyword(), printer);
// create()?
- printOperandList(createOperands(), ParallelOp::getCreateKeyword(), printer);
+ printOperandList(getCreateOperands(), ParallelOp::getCreateKeyword(),
+ printer);
// create_zero()?
- printOperandList(createZeroOperands(), ParallelOp::getCreateZeroKeyword(),
+ printOperandList(getCreateZeroOperands(), ParallelOp::getCreateZeroKeyword(),
printer);
// no_create()?
- printOperandList(noCreateOperands(), ParallelOp::getNoCreateKeyword(),
+ printOperandList(getNoCreateOperands(), ParallelOp::getNoCreateKeyword(),
printer);
// present()?
- printOperandList(presentOperands(), ParallelOp::getPresentKeyword(), printer);
+ printOperandList(getPresentOperands(), ParallelOp::getPresentKeyword(),
+ printer);
// deviceptr()?
- printOperandList(devicePtrOperands(), ParallelOp::getDevicePtrKeyword(),
+ printOperandList(getDevicePtrOperands(), ParallelOp::getDevicePtrKeyword(),
printer);
// attach()?
- printOperandList(attachOperands(), ParallelOp::getAttachKeyword(), printer);
+ printOperandList(getAttachOperands(), ParallelOp::getAttachKeyword(),
+ printer);
// private()?
- printOperandList(gangPrivateOperands(), ParallelOp::getPrivateKeyword(),
+ printOperandList(getGangPrivateOperands(), ParallelOp::getPrivateKeyword(),
printer);
// firstprivate()?
- printOperandList(gangFirstPrivateOperands(),
+ printOperandList(getGangFirstPrivateOperands(),
ParallelOp::getFirstPrivateKeyword(), printer);
printer << ' ';
- printer.printRegion(region(),
+ printer.printRegion(getRegion(),
/*printEntryBlockArgs=*/false,
/*printBlockTerminators=*/true);
printer.printOptionalAttrDictWithKeyword(
@@ -482,23 +488,23 @@ void ParallelOp::print(OpAsmPrinter &printer) {
}
unsigned ParallelOp::getNumDataOperands() {
- return reductionOperands().size() + copyOperands().size() +
- copyinOperands().size() + copyinReadonlyOperands().size() +
- copyoutOperands().size() + copyoutZeroOperands().size() +
- createOperands().size() + createZeroOperands().size() +
- noCreateOperands().size() + presentOperands().size() +
- devicePtrOperands().size() + attachOperands().size() +
- gangPrivateOperands().size() + gangFirstPrivateOperands().size();
+ return getReductionOperands().size() + getCopyOperands().size() +
+ getCopyinOperands().size() + getCopyinReadonlyOperands().size() +
+ getCopyoutOperands().size() + getCopyoutZeroOperands().size() +
+ getCreateOperands().size() + getCreateZeroOperands().size() +
+ getNoCreateOperands().size() + getPresentOperands().size() +
+ getDevicePtrOperands().size() + getAttachOperands().size() +
+ getGangPrivateOperands().size() + getGangFirstPrivateOperands().size();
}
Value ParallelOp::getDataOperand(unsigned i) {
- unsigned numOptional = async() ? 1 : 0;
- numOptional += numGangs() ? 1 : 0;
- numOptional += numWorkers() ? 1 : 0;
- numOptional += vectorLength() ? 1 : 0;
- numOptional += ifCond() ? 1 : 0;
- numOptional += selfCond() ? 1 : 0;
- return getOperand(waitOperands().size() + numOptional + i);
+ unsigned numOptional = getAsync() ? 1 : 0;
+ numOptional += getNumGangs() ? 1 : 0;
+ numOptional += getNumWorkers() ? 1 : 0;
+ numOptional += getVectorLength() ? 1 : 0;
+ numOptional += getIfCond() ? 1 : 0;
+ numOptional += getSelfCond() ? 1 : 0;
+ return getOperand(getWaitOperands().size() + numOptional + i);
}
//===----------------------------------------------------------------------===//
@@ -606,11 +612,11 @@ ParseResult LoopOp::parse(OpAsmParser &parser, OperationState &result) {
}
void LoopOp::print(OpAsmPrinter &printer) {
- unsigned execMapping = exec_mapping();
+ unsigned execMapping = getExecMapping();
if (execMapping & OpenACCExecMapping::GANG) {
printer << " " << LoopOp::getGangKeyword();
- Value gangNum = this->gangNum();
- Value gangStatic = this->gangStatic();
+ Value gangNum = getGangNum();
+ Value gangStatic = getGangStatic();
// Print optional gang operands
if (gangNum || gangStatic) {
@@ -632,7 +638,7 @@ void LoopOp::print(OpAsmPrinter &printer) {
printer << " " << LoopOp::getWorkerKeyword();
// Print optional worker operand if present
- if (Value workerNum = this->workerNum())
+ if (Value workerNum = getWorkerNum())
printer << "(" << workerNum << ": " << workerNum.getType() << ")";
}
@@ -640,24 +646,25 @@ void LoopOp::print(OpAsmPrinter &printer) {
printer << " " << LoopOp::getVectorKeyword();
// Print optional vector operand if present
- if (Value vectorLength = this->vectorLength())
+ if (Value vectorLength = this->getVectorLength())
printer << "(" << vectorLength << ": " << vectorLength.getType() << ")";
}
// tile()?
- printOperandList(tileOperands(), LoopOp::getTileKeyword(), printer);
+ printOperandList(getTileOperands(), LoopOp::getTileKeyword(), printer);
// private()?
- printOperandList(privateOperands(), LoopOp::getPrivateKeyword(), printer);
+ printOperandList(getPrivateOperands(), LoopOp::getPrivateKeyword(), printer);
// reduction()?
- printOperandList(reductionOperands(), LoopOp::getReductionKeyword(), printer);
+ printOperandList(getReductionOperands(), LoopOp::getReductionKeyword(),
+ printer);
if (getNumResults() > 0)
printer << " -> (" << getResultTypes() << ")";
printer << ' ';
- printer.printRegion(region(),
+ printer.printRegion(getRegion(),
/*printEntryBlockArgs=*/false,
/*printBlockTerminators=*/true);
@@ -668,7 +675,8 @@ void LoopOp::print(OpAsmPrinter &printer) {
LogicalResult acc::LoopOp::verify() {
// auto, independent and seq attribute are mutually exclusive.
- if ((auto_() && (independent() || seq())) || (independent() && seq())) {
+ if ((getAuto_() && (getIndependent() || getSeq())) ||
+ (getIndependent() && getSeq())) {
return emitError("only one of " + acc::LoopOp::getAutoAttrStrName() + ", " +
acc::LoopOp::getIndependentAttrStrName() + ", " +
acc::LoopOp::getSeqAttrStrName() +
@@ -676,11 +684,11 @@ LogicalResult acc::LoopOp::verify() {
}
// Gang, worker and vector are incompatible with seq.
- if (seq() && exec_mapping() != OpenACCExecMapping::NONE)
+ if (getSeq() && getExecMapping() != OpenACCExecMapping::NONE)
return emitError("gang, worker or vector cannot appear with the seq attr");
// Check non-empty body().
- if (region().empty())
+ if (getRegion().empty())
return emitError("expected non-empty body.");
return success();
@@ -694,23 +702,23 @@ LogicalResult acc::DataOp::verify() {
// 2.6.5. Data Construct restriction
// At least one copy, copyin, copyout, create, no_create, present, deviceptr,
// attach, or default clause must appear on a data construct.
- if (getOperands().empty() && !defaultAttr())
+ if (getOperands().empty() && !getDefaultAttr())
return emitError("at least one operand or the default attribute "
"must appear on the data operation");
return success();
}
unsigned DataOp::getNumDataOperands() {
- return copyOperands().size() + copyinOperands().size() +
- copyinReadonlyOperands().size() + copyoutOperands().size() +
- copyoutZeroOperands().size() + createOperands().size() +
- createZeroOperands().size() + noCreateOperands().size() +
- presentOperands().size() + deviceptrOperands().size() +
- attachOperands().size();
+ return getCopyOperands().size() + getCopyinOperands().size() +
+ getCopyinReadonlyOperands().size() + getCopyoutOperands().size() +
+ getCopyoutZeroOperands().size() + getCreateOperands().size() +
+ getCreateZeroOperands().size() + getNoCreateOperands().size() +
+ getPresentOperands().size() + getDeviceptrOperands().size() +
+ getAttachOperands().size();
}
Value DataOp::getDataOperand(unsigned i) {
- unsigned numOptional = ifCond() ? 1 : 0;
+ unsigned numOptional = getIfCond() ? 1 : 0;
return getOperand(numOptional + i);
}
@@ -722,38 +730,38 @@ LogicalResult acc::ExitDataOp::verify() {
// 2.6.6. Data Exit Directive restriction
// At least one copyout, delete, or detach clause must appear on an exit data
// directive.
- if (copyoutOperands().empty() && deleteOperands().empty() &&
- detachOperands().empty())
+ if (getCopyoutOperands().empty() && getDeleteOperands().empty() &&
+ getDetachOperands().empty())
return emitError(
"at least one operand in copyout, delete or detach must appear on the "
"exit data operation");
// The async attribute represent the async clause without value. Therefore the
// attribute and operand cannot appear at the same time.
- if (asyncOperand() && async())
+ if (getAsyncOperand() && getAsync())
return emitError("async attribute cannot appear with asyncOperand");
// The wait attribute represent the wait clause without values. Therefore the
// attribute and operands cannot appear at the same time.
- if (!waitOperands().empty() && wait())
+ if (!getWaitOperands().empty() && getWait())
return emitError("wait attribute cannot appear with waitOperands");
- if (waitDevnum() && waitOperands().empty())
+ if (getWaitDevnum() && getWaitOperands().empty())
return emitError("wait_devnum cannot appear without waitOperands");
return success();
}
unsigned ExitDataOp::getNumDataOperands() {
- return copyoutOperands().size() + deleteOperands().size() +
- detachOperands().size();
+ return getCopyoutOperands().size() + getDeleteOperands().size() +
+ getDetachOperands().size();
}
Value ExitDataOp::getDataOperand(unsigned i) {
- unsigned numOptional = ifCond() ? 1 : 0;
- numOptional += asyncOperand() ? 1 : 0;
- numOptional += waitDevnum() ? 1 : 0;
- return getOperand(waitOperands().size() + numOptional + i);
+ unsigned numOptional = getIfCond() ? 1 : 0;
+ numOptional += getAsyncOperand() ? 1 : 0;
+ numOptional += getWaitDevnum() ? 1 : 0;
+ return getOperand(getWaitOperands().size() + numOptional + i);
}
void ExitDataOp::getCanonicalizationPatterns(RewritePatternSet &results,
@@ -769,38 +777,38 @@ LogicalResult acc::EnterDataOp::verify() {
// 2.6.6. Data Enter Directive restriction
// At least one copyin, create, or attach clause must appear on an enter data
// directive.
- if (copyinOperands().empty() && createOperands().empty() &&
- createZeroOperands().empty() && attachOperands().empty())
+ if (getCopyinOperands().empty() && getCreateOperands().empty() &&
+ getCreateZeroOperands().empty() && getAttachOperands().empty())
return emitError(
"at least one operand in copyin, create, "
"create_zero or attach must appear on the enter data operation");
// The async attribute represent the async clause without value. Therefore the
// attribute and operand cannot appear at the same time.
- if (asyncOperand() && async())
+ if (getAsyncOperand() && getAsync())
return emitError("async attribute cannot appear with asyncOperand");
// The wait attribute represent the wait clause without values. Therefore the
// attribute and operands cannot appear at the same time.
- if (!waitOperands().empty() && wait())
+ if (!getWaitOperands().empty() && getWait())
return emitError("wait attribute cannot appear with waitOperands");
- if (waitDevnum() && waitOperands().empty())
+ if (getWaitDevnum() && getWaitOperands().empty())
return emitError("wait_devnum cannot appear without waitOperands");
return success();
}
unsigned EnterDataOp::getNumDataOperands() {
- return copyinOperands().size() + createOperands().size() +
- createZeroOperands().size() + attachOperands().size();
+ return getCopyinOperands().size() + getCreateOperands().size() +
+ getCreateZeroOperands().size() + getAttachOperands().size();
}
Value EnterDataOp::getDataOperand(unsigned i) {
- unsigned numOptional = ifCond() ? 1 : 0;
- numOptional += asyncOperand() ? 1 : 0;
- numOptional += waitDevnum() ? 1 : 0;
- return getOperand(waitOperands().size() + numOptional + i);
+ unsigned numOptional = getIfCond() ? 1 : 0;
+ numOptional += getAsyncOperand() ? 1 : 0;
+ numOptional += getWaitDevnum() ? 1 : 0;
+ return getOperand(getWaitOperands().size() + numOptional + i);
}
void EnterDataOp::getCanonicalizationPatterns(RewritePatternSet &results,
@@ -838,35 +846,35 @@ LogicalResult acc::ShutdownOp::verify() {
LogicalResult acc::UpdateOp::verify() {
// At least one of host or device should have a value.
- if (hostOperands().empty() && deviceOperands().empty())
+ if (getHostOperands().empty() && getDeviceOperands().empty())
return emitError(
"at least one value must be present in hostOperands or deviceOperands");
// The async attribute represent the async clause without value. Therefore the
// attribute and operand cannot appear at the same time.
- if (asyncOperand() && async())
+ if (getAsyncOperand() && getAsync())
return emitError("async attribute cannot appear with asyncOperand");
// The wait attribute represent the wait clause without values. Therefore the
// attribute and operands cannot appear at the same time.
- if (!waitOperands().empty() && wait())
+ if (!getWaitOperands().empty() && getWait())
return emitError("wait attribute cannot appear with waitOperands");
- if (waitDevnum() && waitOperands().empty())
+ if (getWaitDevnum() && getWaitOperands().empty())
return emitError("wait_devnum cannot appear without waitOperands");
return success();
}
unsigned UpdateOp::getNumDataOperands() {
- return hostOperands().size() + deviceOperands().size();
+ return getHostOperands().size() + getDeviceOperands().size();
}
Value UpdateOp::getDataOperand(unsigned i) {
- unsigned numOptional = asyncOperand() ? 1 : 0;
- numOptional += waitDevnum() ? 1 : 0;
- numOptional += ifCond() ? 1 : 0;
- return getOperand(waitOperands().size() + deviceTypeOperands().size() +
+ unsigned numOptional = getAsyncOperand() ? 1 : 0;
+ numOptional += getWaitDevnum() ? 1 : 0;
+ numOptional += getIfCond() ? 1 : 0;
+ return getOperand(getWaitOperands().size() + getDeviceTypeOperands().size() +
numOptional + i);
}
@@ -882,10 +890,10 @@ void UpdateOp::getCanonicalizationPatterns(RewritePatternSet &results,
LogicalResult acc::WaitOp::verify() {
// The async attribute represent the async clause without value. Therefore the
// attribute and operand cannot appear at the same time.
- if (asyncOperand() && async())
+ if (getAsyncOperand() && getAsync())
return emitError("async attribute cannot appear with asyncOperand");
- if (waitDevnum() && waitOperands().empty())
+ if (getWaitDevnum() && getWaitOperands().empty())
return emitError("wait_devnum cannot appear without waitOperands");
return success();
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp
index d8ce25f2e9a38..0a66ce956c950 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp
@@ -205,13 +205,13 @@ processDataOperands(llvm::IRBuilderBase &builder,
// Create operands are handled as `alloc` call.
if (failed(processOperands(builder, moduleTranslation, op,
- op.createOperands(), op.getNumDataOperands(),
+ op.getCreateOperands(), op.getNumDataOperands(),
kCreateFlag, flags, names, index, mapperAllocas)))
return failure();
// Copyin operands are handled as `to` call.
if (failed(processOperands(builder, moduleTranslation, op,
- op.copyinOperands(), op.getNumDataOperands(),
+ op.getCopyinOperands(), op.getNumDataOperands(),
kDeviceCopyinFlag, flags, names, index,
mapperAllocas)))
return failure();
@@ -232,13 +232,13 @@ processDataOperands(llvm::IRBuilderBase &builder,
// Delete operands are handled as `delete` call.
if (failed(processOperands(builder, moduleTranslation, op,
- op.deleteOperands(), op.getNumDataOperands(),
+ op.getDeleteOperands(), op.getNumDataOperands(),
kDeleteFlag, flags, names, index, mapperAllocas)))
return failure();
// Copyout operands are handled as `from` call.
if (failed(processOperands(builder, moduleTranslation, op,
- op.copyoutOperands(), op.getNumDataOperands(),
+ op.getCopyoutOperands(), op.getNumDataOperands(),
kHostCopyoutFlag, flags, names, index,
mapperAllocas)))
return failure();
@@ -256,14 +256,15 @@ processDataOperands(llvm::IRBuilderBase &builder,
unsigned index = 0;
// Host operands are handled as `from` call.
- if (failed(processOperands(builder, moduleTranslation, op, op.hostOperands(),
- op.getNumDataOperands(), kHostCopyoutFlag, flags,
- names, index, mapperAllocas)))
+ if (failed(processOperands(builder, moduleTranslation, op,
+ op.getHostOperands(), op.getNumDataOperands(),
+ kHostCopyoutFlag, flags, names, index,
+ mapperAllocas)))
return failure();
// Device operands are handled as `to` call.
if (failed(processOperands(builder, moduleTranslation, op,
- op.deviceOperands(), op.getNumDataOperands(),
+ op.getDeviceOperands(), op.getNumDataOperands(),
kDeviceCopyinFlag, flags, names, index,
mapperAllocas)))
return failure();
@@ -310,53 +311,57 @@ static LogicalResult convertDataOp(acc::DataOp &op,
// TODO handle no_create, deviceptr and attach operands.
- if (failed(processOperands(builder, moduleTranslation, op, op.copyOperands(),
- totalNbOperand, kCopyFlag | kHoldFlag, flags,
- names, index, mapperAllocas)))
+ if (failed(processOperands(
+ builder, moduleTranslation, op, op.getCopyOperands(), totalNbOperand,
+ kCopyFlag | kHoldFlag, flags, names, index, mapperAllocas)))
return failure();
- if (failed(processOperands(
- builder, moduleTranslation, op, op.copyinOperands(), totalNbOperand,
- kDeviceCopyinFlag | kHoldFlag, flags, names, index, mapperAllocas)))
+ if (failed(processOperands(builder, moduleTranslation, op,
+ op.getCopyinOperands(), totalNbOperand,
+ kDeviceCopyinFlag | kHoldFlag, flags, names, index,
+ mapperAllocas)))
return failure();
// TODO copyin readonly currenlty handled as copyin. Update when extension
// available.
if (failed(processOperands(builder, moduleTranslation, op,
- op.copyinReadonlyOperands(), totalNbOperand,
+ op.getCopyinReadonlyOperands(), totalNbOperand,
kDeviceCopyinFlag | kHoldFlag, flags, names, index,
mapperAllocas)))
return failure();
- if (failed(processOperands(
- builder, moduleTranslation, op, op.copyoutOperands(), totalNbOperand,
- kHostCopyoutFlag | kHoldFlag, flags, names, index, mapperAllocas)))
+ if (failed(processOperands(builder, moduleTranslation, op,
+ op.getCopyoutOperands(), totalNbOperand,
+ kHostCopyoutFlag | kHoldFlag, flags, names, index,
+ mapperAllocas)))
return failure();
// TODO copyout zero currenlty handled as copyout. Update when extension
// available.
if (failed(processOperands(builder, moduleTranslation, op,
- op.copyoutZeroOperands(), totalNbOperand,
+ op.getCopyoutZeroOperands(), totalNbOperand,
kHostCopyoutFlag | kHoldFlag, flags, names, index,
mapperAllocas)))
return failure();
- if (failed(processOperands(
- builder, moduleTranslation, op, op.createOperands(), totalNbOperand,
- kCreateFlag | kHoldFlag, flags, names, index, mapperAllocas)))
+ if (failed(processOperands(builder, moduleTranslation, op,
+ op.getCreateOperands(), totalNbOperand,
+ kCreateFlag | kHoldFlag, flags, names, index,
+ mapperAllocas)))
return failure();
// TODO create zero currenlty handled as create. Update when extension
// available.
if (failed(processOperands(builder, moduleTranslation, op,
- op.createZeroOperands(), totalNbOperand,
+ op.getCreateZeroOperands(), totalNbOperand,
kCreateFlag | kHoldFlag, flags, names, index,
mapperAllocas)))
return failure();
- if (failed(processOperands(
- builder, moduleTranslation, op, op.presentOperands(), totalNbOperand,
- kPresentFlag | kHoldFlag, flags, names, index, mapperAllocas)))
+ if (failed(processOperands(builder, moduleTranslation, op,
+ op.getPresentOperands(), totalNbOperand,
+ kPresentFlag | kHoldFlag, flags, names, index,
+ mapperAllocas)))
return failure();
llvm::GlobalVariable *maptypes =
@@ -379,7 +384,7 @@ static LogicalResult convertDataOp(acc::DataOp &op,
// Convert the region.
llvm::BasicBlock *entryBlock = nullptr;
- for (Block &bb : op.region()) {
+ for (Block &bb : op.getRegion()) {
llvm::BasicBlock *llvmBB = llvm::BasicBlock::Create(
ctx, "acc.data", builder.GetInsertBlock()->getParent());
if (entryBlock == nullptr)
@@ -396,7 +401,7 @@ static LogicalResult convertDataOp(acc::DataOp &op,
ctx, "acc.end_data", builder.GetInsertBlock()->getParent());
SetVector<Block *> blocks =
- LLVM::detail::getTopologicallySortedBlocks(op.region());
+ LLVM::detail::getTopologicallySortedBlocks(op.getRegion());
for (Block *bb : blocks) {
llvm::BasicBlock *llvmBB = moduleTranslation.lookupBlock(bb);
if (bb->isEntryBlock()) {
More information about the Mlir-commits
mailing list