Address some build warnings.
authorJacques Pienaar <jpienaar@google.com>
Sat, 25 May 2019 17:55:20 +0000 (10:55 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 03:02:52 +0000 (20:02 -0700)
--

PiperOrigin-RevId: 249986120

mlir/include/mlir/Quantizer/Support/Configuration.h
mlir/lib/Analysis/AffineStructures.cpp
mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp
mlir/lib/Linalg/Transforms/Tiling.cpp
mlir/lib/Quantizer/Support/Configuration.cpp
mlir/lib/Quantizer/Support/UniformConstraints.cpp
mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp

index 2b67712..a260824 100644 (file)
@@ -135,8 +135,6 @@ protected:
 private:
   void addRequireStatsOpByName(StringRef opName);
 
-  SolverContext &context;
-
   /// Vector of all candidate type constraints, indexed by ordinal.
   std::vector<CandidateQuantizedType> candidateTypes;
 
index 986337c..3b7d5a0 100644 (file)
@@ -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<Value *, 8> uniqueIds;
   for (auto id : cst.getIds()) {
     if (id.hasValue() && !uniqueIds.insert(id.getValue()).second)
index f51c25a..d4be38e 100644 (file)
@@ -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));
     };
index 6e72ecf..22090ca 100644 (file)
@@ -50,22 +50,6 @@ static bool isZero(Value *v) {
          cast<ConstantIndexOp>(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<Value *> tileSizes) {
-  SmallVector<AffineExpr, 4> 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
index 0efded0..78a7451 100644 (file)
@@ -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;
index ab1ced1..2ea081a 100644 (file)
@@ -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(
index a2cfe72..94bac98 100644 (file)
@@ -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<DequantizeCastOp>(