From 3e632c265c5498e53e851b49f34717dd47f7b949 Mon Sep 17 00:00:00 2001 From: Hanchen Ye Date: Wed, 19 Jul 2023 02:12:00 -0500 Subject: [PATCH] Bump LLVM version to the latest --- .../scalehls/Dialect/HLS/IR/HLSInterfaces.td | 2 +- include/scalehls/Utils/Utils.h | 10 +++++----- lib/Dialect/HLS/IR/HLSUBUFOps.cpp | 8 +++++--- lib/Utils/Utils.cpp | 18 +++++++++--------- llvm-project | 2 +- python/scalehls/dialects/HLSOps.td | 1 - tools/scalehls-opt/scalehls-opt.cpp | 4 ++-- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/scalehls/Dialect/HLS/IR/HLSInterfaces.td b/include/scalehls/Dialect/HLS/IR/HLSInterfaces.td index 2a9be351..b4c634ce 100644 --- a/include/scalehls/Dialect/HLS/IR/HLSInterfaces.td +++ b/include/scalehls/Dialect/HLS/IR/HLSInterfaces.td @@ -61,7 +61,7 @@ def BufferLikeInterface : OpInterface<"BufferLikeInterface"> { InterfaceMethod<"Return the depth of the buffer", "int32_t", "getBufferDepth">, InterfaceMethod<"Return the initial value of the buffer", - "llvm::Optional", "getBufferInitValue">, + "std::optional", "getBufferInitValue">, ]; } diff --git a/include/scalehls/Utils/Utils.h b/include/scalehls/Utils/Utils.h index 4c87e3d0..f840e387 100644 --- a/include/scalehls/Utils/Utils.h +++ b/include/scalehls/Utils/Utils.h @@ -78,15 +78,15 @@ bool crossRegionDominates(Operation *a, Operation *b); /// Check if the lhsOp and rhsOp are in the same block. If so, return their /// ancestors that are located at the same block. Note that in this check, /// AffineIfOp is transparent. -Optional> checkSameLevel(Operation *lhsOp, - Operation *rhsOp); +std::optional> +checkSameLevel(Operation *lhsOp, Operation *rhsOp); unsigned getCommonSurroundingLoops(Operation *A, Operation *B, AffineLoopBand *band); /// Calculate the upper and lower bound of the affine map if possible. -Optional> getBoundOfAffineMap(AffineMap map, - ValueRange operands); +std::optional> +getBoundOfAffineMap(AffineMap map, ValueRange operands); /// Calculate partition factors through analyzing the "memrefType" and return /// them in "factors". Meanwhile, the overall partition number is calculated and @@ -128,7 +128,7 @@ void getLoopBands(Block &block, AffineLoopBands &bands, void getArrays(Block &block, SmallVectorImpl &arrays, bool allowArguments = true); -Optional getAverageTripCount(affine::AffineForOp forOp); +std::optional getAverageTripCount(affine::AffineForOp forOp); bool checkDependence(Operation *A, Operation *B); diff --git a/lib/Dialect/HLS/IR/HLSUBUFOps.cpp b/lib/Dialect/HLS/IR/HLSUBUFOps.cpp index 594de484..27aa3f25 100644 --- a/lib/Dialect/HLS/IR/HLSUBUFOps.cpp +++ b/lib/Dialect/HLS/IR/HLSUBUFOps.cpp @@ -159,7 +159,9 @@ LogicalResult BufferOp::verify() { } int32_t BufferOp::getBufferDepth() { return getDepth(); } -Optional BufferOp::getBufferInitValue() { return getInitValue(); } +std::optional BufferOp::getBufferInitValue() { + return getInitValue(); +} void BufferOp::getEffects( SmallVectorImpl> @@ -169,8 +171,8 @@ void BufferOp::getEffects( } int32_t ConstBufferOp::getBufferDepth() { return 1; } -Optional ConstBufferOp::getBufferInitValue() { - return Optional(); +std::optional ConstBufferOp::getBufferInitValue() { + return std::optional(); } LogicalResult ConstBufferOp::verify() { diff --git a/lib/Utils/Utils.cpp b/lib/Utils/Utils.cpp index 2a13ef5b..1e64f9ba 100644 --- a/lib/Utils/Utils.cpp +++ b/lib/Utils/Utils.cpp @@ -404,7 +404,7 @@ bool scalehls::crossRegionDominates(Operation *a, Operation *b) { // Check if the lhsOp and rhsOp are in the same block. If so, return their // ancestors that are located at the same block. Note that in this check, // AffineIfOp is transparent. -Optional> +std::optional> scalehls::checkSameLevel(Operation *lhsOp, Operation *rhsOp) { // If lhsOp and rhsOp are already at the same level, return true. if (lhsOp->getBlock() == rhsOp->getBlock()) @@ -438,7 +438,7 @@ scalehls::checkSameLevel(Operation *lhsOp, Operation *rhsOp) { if (lhs->getBlock() == rhs->getBlock()) return std::pair(lhs, rhs); - return Optional>(); + return std::optional>(); } /// Returns the number of surrounding loops common to 'loopsA' and 'loopsB', @@ -462,7 +462,7 @@ unsigned scalehls::getCommonSurroundingLoops(Operation *A, Operation *B, } /// Calculate the lower and upper bound of the affine map if possible. -Optional> +std::optional> scalehls::getBoundOfAffineMap(AffineMap map, ValueRange operands) { if (map.isSingleConstant()) { auto constBound = map.getSingleConstantResult(); @@ -471,7 +471,7 @@ scalehls::getBoundOfAffineMap(AffineMap map, ValueRange operands) { // For now, we can only handle one result value map. if (map.getNumResults() != 1) - return Optional>(); + return std::optional>(); auto context = map.getContext(); SmallVector lbs; @@ -480,13 +480,13 @@ scalehls::getBoundOfAffineMap(AffineMap map, ValueRange operands) { // Only if the affine map operands are induction variable, the calculation // is possible. if (!isAffineForInductionVar(operand)) - return Optional>(); + return std::optional>(); // Only if the owner for op of the induction variable has constant bound, // the calculation is possible. auto forOp = getForInductionVarOwner(operand); if (!forOp.hasConstantBounds()) - return Optional>(); + return std::optional>(); auto lb = forOp.getConstantLowerBound(); auto ub = forOp.getConstantUpperBound(); @@ -512,7 +512,7 @@ scalehls::getBoundOfAffineMap(AffineMap map, ValueRange operands) { if (auto constExpr = newExpr.dyn_cast()) results.push_back(constExpr.getValue()); else - return Optional>(); + return std::optional>(); } auto minmax = std::minmax_element(results.begin(), results.end()); @@ -697,7 +697,7 @@ void scalehls::getArrays(Block &block, SmallVectorImpl &arrays, } } -Optional scalehls::getAverageTripCount(AffineForOp forOp) { +std::optional scalehls::getAverageTripCount(AffineForOp forOp) { if (auto optionalTripCount = getConstantTripCount(forOp)) return optionalTripCount.value(); else { @@ -716,7 +716,7 @@ Optional scalehls::getAverageTripCount(AffineForOp forOp) { upperBound.value().first - lowerBound.value().second; return (lowerTripCount + upperTripCount + 1) / 2; } else - return Optional(); + return std::optional(); } } diff --git a/llvm-project b/llvm-project index fcb71186..7e125f83 160000 --- a/llvm-project +++ b/llvm-project @@ -1 +1 @@ -Subproject commit fcb71186d6ae36fe3022753aba17a63c5c3efcc9 +Subproject commit 7e125f8382c0124f4375a3a94b08d7eb78ea0ff2 diff --git a/python/scalehls/dialects/HLSOps.td b/python/scalehls/dialects/HLSOps.td index 1ca92c5d..3775fbbb 100644 --- a/python/scalehls/dialects/HLSOps.td +++ b/python/scalehls/dialects/HLSOps.td @@ -7,7 +7,6 @@ #ifndef PYTHON_SCALEHLS_DIALECTS_HLSOPS_TD #define PYTHON_SCALEHLS_DIALECTS_HLSOPS_TD -include "mlir/Bindings/Python/Attributes.td" include "scalehls/Dialect/HLS/IR/HLSOps.td" #endif // PYTHON_SCALEHLS_DIALECTS_HLSOPS_TD diff --git a/tools/scalehls-opt/scalehls-opt.cpp b/tools/scalehls-opt/scalehls-opt.cpp index 6519070c..038569a3 100644 --- a/tools/scalehls-opt/scalehls-opt.cpp +++ b/tools/scalehls-opt/scalehls-opt.cpp @@ -14,6 +14,6 @@ int main(int argc, char **argv) { mlir::scalehls::registerAllInterfaceExternalModels(registry); mlir::scalehls::registerAllPasses(); - return mlir::failed(mlir::MlirOptMain( - argc, argv, "ScaleHLS Optimization Tool", registry, true)); + return mlir::failed( + mlir::MlirOptMain(argc, argv, "ScaleHLS Optimization Tool", registry)); }