From 9edcd99feb4cab8bbf0c052d35d797d713b20336 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Sat, 25 May 2019 10:55:20 -0700 Subject: [PATCH] Address some build warnings. -- PiperOrigin-RevId: 249986120 --- mlir/include/mlir/Quantizer/Support/Configuration.h | 2 -- mlir/lib/Analysis/AffineStructures.cpp | 3 ++- mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp | 3 +-- mlir/lib/Linalg/Transforms/Tiling.cpp | 16 ---------------- mlir/lib/Quantizer/Support/Configuration.cpp | 3 +-- mlir/lib/Quantizer/Support/UniformConstraints.cpp | 4 ++-- .../lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp | 6 ------ 7 files changed, 6 insertions(+), 31 deletions(-) diff --git a/mlir/include/mlir/Quantizer/Support/Configuration.h b/mlir/include/mlir/Quantizer/Support/Configuration.h index 2b67712..a260824 100644 --- a/mlir/include/mlir/Quantizer/Support/Configuration.h +++ b/mlir/include/mlir/Quantizer/Support/Configuration.h @@ -135,8 +135,6 @@ protected: private: void addRequireStatsOpByName(StringRef opName); - SolverContext &context; - /// Vector of all candidate type constraints, indexed by ordinal. std::vector candidateTypes; diff --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Analysis/AffineStructures.cpp index 986337c..3b7d5a0 100644 --- a/mlir/lib/Analysis/AffineStructures.cpp +++ b/mlir/lib/Analysis/AffineStructures.cpp @@ -490,7 +490,8 @@ bool areIdsAligned(const FlatAffineConstraints &A, } /// Checks if the SSA values associated with `cst''s identifiers are unique. -static bool areIdsUnique(const FlatAffineConstraints &cst) { +static bool LLVM_ATTRIBUTE_UNUSED +areIdsUnique(const FlatAffineConstraints &cst) { SmallPtrSet uniqueIds; for (auto id : cst.getIds()) { if (id.hasValue() && !uniqueIds.insert(id.getValue()).second) diff --git a/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp b/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp index f51c25a..d4be38e 100644 --- a/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp +++ b/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp @@ -415,8 +415,7 @@ public: return positionAttr(rewriter, values); }; // Helper function to obtain the ptr of the given `view`. - auto getViewPtr = [pos, &rewriter, this](ViewType type, - Value *view) -> Value * { + auto getViewPtr = [pos, this](ViewType type, Value *view) -> Value * { auto elementPtrTy = getPtrToElementType(type, lowering); return extractvalue(elementPtrTy, view, pos(0)); }; diff --git a/mlir/lib/Linalg/Transforms/Tiling.cpp b/mlir/lib/Linalg/Transforms/Tiling.cpp index 6e72ecf8..22090ca 100644 --- a/mlir/lib/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Linalg/Transforms/Tiling.cpp @@ -50,22 +50,6 @@ static bool isZero(Value *v) { cast(v->getDefiningOp()).getValue() == 0; } -/// Returns a map that can be used to filter the zero values out of tileSizes. -/// For example, if tileSizes contains `{v1, 0, v2}`, the returned map is: -/// -/// ```{.mlir} -/// (d0, d1, d2) -> (d0, d2) -/// ``` -static AffineMap nonZeroMap(ArrayRef tileSizes) { - SmallVector exprs; - for (auto en : llvm::enumerate(tileSizes)) - if (!isZero(en.value())) - exprs.push_back(getAffineDimExpr(en.index(), en.value()->getContext())); - assert(!exprs.empty() && - "unexpected zero-only tile sizes, should have been handled earlier"); - return AffineMap::get(tileSizes.size(), 0, exprs, {}); -} - // Creates a number of ranges equal to the number of non-zero in `tileSizes`. // One for each loop of the LinalgOp that is tiled. The `tileSizes` argument has // one entry per surrounding loop. It uses zero as the convention that a diff --git a/mlir/lib/Quantizer/Support/Configuration.cpp b/mlir/lib/Quantizer/Support/Configuration.cpp index 0efded0..78a7451 100644 --- a/mlir/lib/Quantizer/Support/Configuration.cpp +++ b/mlir/lib/Quantizer/Support/Configuration.cpp @@ -26,8 +26,7 @@ using namespace mlir; using namespace mlir::quantizer; -TargetConfiguration::TargetConfiguration(SolverContext &context) - : context(context) {} +TargetConfiguration::TargetConfiguration(SolverContext &context) {} void TargetConfiguration::addOpHandlerByName(StringRef name, OpHandlerFn fn) { opHandlers[name] = fn; diff --git a/mlir/lib/Quantizer/Support/UniformConstraints.cpp b/mlir/lib/Quantizer/Support/UniformConstraints.cpp index ab1ced1..2ea081a 100644 --- a/mlir/lib/Quantizer/Support/UniformConstraints.cpp +++ b/mlir/lib/Quantizer/Support/UniformConstraints.cpp @@ -124,7 +124,7 @@ private: os << "PropagateExplicitScale"; } void propagate(SolverContext &solverContext, - const TargetConfiguration &config) { + const TargetConfiguration &config) override { DiscreteScaleZeroPointFact scaleZp; // Get scale/zp from all parents. @@ -170,7 +170,7 @@ private: } void propagate(SolverContext &solverContext, - const TargetConfiguration &config) { + const TargetConfiguration &config) override { // First determine the required min/max range and type constraints. Location fusedLoc = UnknownLoc::get(&solverContext.getMlirContext()); llvm::SmallBitVector enabledCandidateTypesMask( diff --git a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp index a2cfe72..94bac98 100644 --- a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp +++ b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp @@ -206,9 +206,6 @@ void InferQuantizedTypesPass::transformOperandType(CAGOperandAnchor *anchor, } switch (anchor->getTypeTransformRule()) { - default: - op->emitOpError("unsupported type transform rule"); - break; case CAGAnchorNode::TypeTransformRule::Direct: anchor->getOp()->setOperand(anchor->getOperandIdx(), newTypedInputValue); break; @@ -248,9 +245,6 @@ void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor, Value *replacedResultValue = nullptr; Value *newResultValue = nullptr; switch (anchor->getTypeTransformRule()) { - default: - op->emitOpError("unsupported type transform rule"); - return; case CAGAnchorNode::TypeTransformRule::Direct: origResultValue->setType(newType); replacedResultValue = newResultValue = b.create( -- 2.7.4