Unify error messages to start with lower-case.
authorMLIR Team <no-reply@google.com>
Wed, 18 Sep 2019 14:44:39 +0000 (07:44 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 18 Sep 2019 14:45:17 +0000 (07:45 -0700)
PiperOrigin-RevId: 269803466

16 files changed:
mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
mlir/examples/toy/Ch3/mlir/ToyDialect.cpp
mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
mlir/examples/toy/Ch4/mlir/ToyDialect.cpp
mlir/examples/toy/Ch5/mlir/LateLowering.cpp
mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
mlir/examples/toy/Ch5/mlir/ToyDialect.cpp
mlir/lib/Analysis/SliceAnalysis.cpp
mlir/lib/Analysis/Utils.cpp
mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
mlir/lib/Transforms/MaterializeVectors.cpp
mlir/lib/Transforms/Utils/LoopUtils.cpp

index 6f29490..ab5a584 100644 (file)
@@ -84,7 +84,7 @@ public:
     // this won't do much, but it should at least check some structural
     // properties of the generated MLIR module.
     if (failed(mlir::verify(theModule))) {
-      theModule.emitError("Module verification error");
+      theModule.emitError("module verification error");
       return nullptr;
     }
 
@@ -224,7 +224,7 @@ private:
       op_name = "toy.mul";
       break;
     default:
-      emitError(location, "Error: invalid binary operator '")
+      emitError(location, "error: invalid binary operator '")
           << binop.getOp() << "'";
       return nullptr;
     }
@@ -244,7 +244,7 @@ private:
     if (auto *variable = symbolTable.lookup(expr.getName()))
       return variable;
 
-    emitError(loc(expr.loc()), "Error: unknown variable '")
+    emitError(loc(expr.loc()), "error: unknown variable '")
         << expr.getName() << "'";
     return nullptr;
   }
@@ -413,7 +413,7 @@ private:
     auto init = vardecl.getInitVal();
     if (!init) {
       emitError(loc(vardecl.loc()),
-                "Missing initializer in variable declaration");
+                "missing initializer in variable declaration");
       return nullptr;
     }
 
index 572f0ee..9bd3fa6 100644 (file)
@@ -85,7 +85,7 @@ public:
     // this won't do much, but it should at least check some structural
     // properties.
     if (failed(mlir::verify(*theModule))) {
-      emitError(mlir::UnknownLoc::get(&context), "Module verification error");
+      emitError(mlir::UnknownLoc::get(&context), "module verification error");
       return nullptr;
     }
 
@@ -223,7 +223,7 @@ private:
     case '*':
       return builder->create<MulOp>(location, L, R).getResult();
     default:
-      emitError(loc(binop.loc()), "Error: invalid binary operator '")
+      emitError(loc(binop.loc()), "error: invalid binary operator '")
           << binop.getOp() << "'";
       return nullptr;
     }
@@ -235,7 +235,7 @@ private:
   mlir::Value *mlirGen(VariableExprAST &expr) {
     if (symbolTable.count(expr.getName()))
       return symbolTable.lookup(expr.getName());
-    emitError(loc(expr.loc()), "Error: unknown variable '")
+    emitError(loc(expr.loc()), "error: unknown variable '")
         << expr.getName() << "'";
     return nullptr;
   }
@@ -413,7 +413,7 @@ private:
       }
     } else {
       emitError(loc(vardecl.loc()),
-                "Missing initializer in variable declaration");
+                "missing initializer in variable declaration");
       return nullptr;
     }
     // Register the value in the symbol table
index b682dbc..7272ea2 100644 (file)
@@ -104,7 +104,7 @@ ToyDialect::ToyDialect(mlir::MLIRContext *ctx) : mlir::Dialect("toy", ctx) {
 mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
   // Sanity check: we only support array or array<...>
   if (!tyData.startswith("array")) {
-    emitError(loc, "Invalid Toy type '" + tyData + "', array expected");
+    emitError(loc, "invalid Toy type '" + tyData + "', array expected");
     return nullptr;
   }
   // Drop the "array" prefix from the type name, we expect either an empty
@@ -119,7 +119,7 @@ mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
   SmallVector<StringRef, 4> matches;
   auto shapeRegex = llvm::Regex("^<([0-9]+)(, ([0-9]+))*>$");
   if (!shapeRegex.match(tyData, &matches)) {
-    emitError(loc, "Invalid toy array shape '" + tyData + "'");
+    emitError(loc, "invalid toy array shape '" + tyData + "'");
     return nullptr;
   }
   SmallVector<int64_t, 4> shape;
@@ -133,7 +133,7 @@ mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
     // Convert the capture to an integer
     unsigned long long dim;
     if (getAsUnsignedInteger(dimStr, /* Radix = */ 10, dim)) {
-      emitError(loc, "Couldn't parse dimension as integer, matched: " + dimStr);
+      emitError(loc, "couldn't parse dimension as integer, matched: " + dimStr);
       return mlir::Type();
     }
     shape.push_back(dim);
index bd0ad01..d0f3de1 100644 (file)
@@ -85,7 +85,7 @@ public:
     // this won't do much, but it should at least check some structural
     // properties.
     if (failed(mlir::verify(*theModule))) {
-      emitError(mlir::UnknownLoc::get(&context), "Module verification error");
+      emitError(mlir::UnknownLoc::get(&context), "module verification error");
       return nullptr;
     }
 
@@ -223,7 +223,7 @@ private:
     case '*':
       return builder->create<MulOp>(location, L, R).getResult();
     default:
-      emitError(location, "Error: invalid binary operator '")
+      emitError(location, "error: invalid binary operator '")
           << binop.getOp() << "'";
       return nullptr;
     }
@@ -235,7 +235,7 @@ private:
   mlir::Value *mlirGen(VariableExprAST &expr) {
     if (symbolTable.count(expr.getName()))
       return symbolTable.lookup(expr.getName());
-    emitError(loc(expr.loc()), "Error: unknown variable '")
+    emitError(loc(expr.loc()), "error: unknown variable '")
         << expr.getName() << "'";
     return nullptr;
   }
@@ -413,7 +413,7 @@ private:
       }
     } else {
       emitError(loc(vardecl.loc()),
-                "Missing initializer in variable declaration");
+                "missing initializer in variable declaration");
       return nullptr;
     }
     // Register the value in the symbol table
index 6c0d8df..1600b99 100644 (file)
@@ -124,7 +124,7 @@ public:
     auto main = module.lookupSymbol<mlir::FuncOp>("main");
     if (!main) {
       emitError(mlir::UnknownLoc::get(module.getContext()),
-                "Shape inference failed: can't find a main function\n");
+                "shape inference failed: can't find a main function\n");
       signalPassFailure();
       return;
     }
@@ -269,7 +269,7 @@ public:
         auto rhsRank = rhs.getShape().size();
         if (lhsRank != rhsRank) {
           return mulOp.emitOpError(
-              "Shape mismatch: LHS and RHS must have the same "
+              "shape mismatch: LHS and RHS must have the same "
               "rank for multiplication, got " +
               Twine(lhsRank) + " vs  " + Twine(lhsRank));
         }
@@ -279,7 +279,7 @@ public:
           dims.push_back(1);
         } else if (lhsRank != 2) {
           return op->emitOpError(
-              "Shape mismatch: expect rank 1 or 2 for mul operands, got " +
+              "shape mismatch: expect rank 1 or 2 for mul operands, got " +
               Twine(lhsRank));
         } else {
           dims.push_back(lhs.getShape()[0]);
@@ -298,7 +298,7 @@ public:
         auto calleeName = callOp.getCalleeName();
         auto callee = getModule().lookupSymbol<mlir::FuncOp>(calleeName);
         if (!callee) {
-          f.emitError("Shape inference failed, call to unknown '")
+          f.emitError("shape inference failed, call to unknown '")
               << calleeName << "'";
           signalPassFailure();
           return mlir::failure();
@@ -338,7 +338,7 @@ public:
     if (!opWorklist.empty()) {
       std::string str;
       llvm::raw_string_ostream errorMsg(str);
-      errorMsg << "Shape inference failed, " << opWorklist.size()
+      errorMsg << "shape inference failed, " << opWorklist.size()
                << " operations couldn't be inferred\n";
       for (auto *ope : opWorklist)
         errorMsg << " - " << *ope << "\n";
index dfab06d..db0deda 100644 (file)
@@ -104,7 +104,7 @@ ToyDialect::ToyDialect(mlir::MLIRContext *ctx) : mlir::Dialect("toy", ctx) {
 mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
   // Sanity check: we only support array or array<...>
   if (!tyData.startswith("array")) {
-    emitError(loc, "Invalid Toy type '" + tyData + "', array expected");
+    emitError(loc, "invalid Toy type '" + tyData + "', array expected");
     return nullptr;
   }
   // Drop the "array" prefix from the type name, we expect either an empty
@@ -119,7 +119,7 @@ mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
   SmallVector<StringRef, 4> matches;
   auto shapeRegex = llvm::Regex("^<([0-9]+)(, ([0-9]+))*>$");
   if (!shapeRegex.match(tyData, &matches)) {
-    emitError(loc, "Invalid toy array shape '" + tyData + "'");
+    emitError(loc, "invalid toy array shape '" + tyData + "'");
     return nullptr;
   }
   SmallVector<int64_t, 4> shape;
@@ -133,7 +133,7 @@ mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
     // Convert the capture to an integer
     unsigned long long dim;
     if (getAsUnsignedInteger(dimStr, /* Radix = */ 10, dim)) {
-      emitError(loc, "Couldn't parse dimension as integer, matched: " + dimStr);
+      emitError(loc, "couldn't parse dimension as integer, matched: " + dimStr);
       return mlir::Type();
     }
     shape.push_back(dim);
index cbcf149..95585f9 100644 (file)
@@ -365,7 +365,7 @@ struct LateLoweringPass : public ModulePass<LateLoweringPass> {
     if (failed(applyPartialConversion(getModule(), target, toyPatterns,
                                       &typeConverter))) {
       emitError(UnknownLoc::get(getModule().getContext()),
-                "Error lowering Toy\n");
+                "error lowering Toy\n");
       signalPassFailure();
     }
 
index eba2933..8f80da9 100644 (file)
@@ -85,7 +85,7 @@ public:
     // this won't do much, but it should at least check some structural
     // properties.
     if (failed(mlir::verify(*theModule))) {
-      emitError(mlir::UnknownLoc::get(&context), "Module verification error");
+      emitError(mlir::UnknownLoc::get(&context), "module verification error");
       return nullptr;
     }
 
@@ -223,7 +223,7 @@ private:
     case '*':
       return builder->create<MulOp>(location, L, R).getResult();
     default:
-      emitError(loc(binop.loc()), "Error: invalid binary operator '")
+      emitError(loc(binop.loc()), "error: invalid binary operator '")
           << binop.getOp() << "'";
       return nullptr;
     }
@@ -235,7 +235,7 @@ private:
   mlir::Value *mlirGen(VariableExprAST &expr) {
     if (symbolTable.count(expr.getName()))
       return symbolTable.lookup(expr.getName());
-    emitError(loc(expr.loc()), "Error: unknown variable '")
+    emitError(loc(expr.loc()), "error: unknown variable '")
         << expr.getName() << "'";
     return nullptr;
   }
@@ -413,7 +413,7 @@ private:
       }
     } else {
       emitError(loc(vardecl.loc()),
-                "Missing initializer in variable declaration");
+                "missing initializer in variable declaration");
       return nullptr;
     }
     // Register the value in the symbol table
index 057c7ec..e85d1af 100644 (file)
@@ -125,7 +125,7 @@ public:
     auto main = moduleManager.lookupSymbol<mlir::FuncOp>("main");
     if (!main) {
       emitError(mlir::UnknownLoc::get(module.getContext()),
-                "Shape inference failed: can't find a main function\n");
+                "shape inference failed: can't find a main function\n");
       signalPassFailure();
       return;
     }
@@ -271,7 +271,7 @@ public:
         auto lhsRank = lhs.getShape().size();
         auto rhsRank = rhs.getShape().size();
         if (lhsRank != rhsRank) {
-          return op->emitError("Shape mismatch: LHS and RHS must have the same "
+          return op->emitError("shape mismatch: LHS and RHS must have the same "
                                "rank for multiplication, got ")
                  << lhsRank << " vs  " << lhsRank;
         }
@@ -281,7 +281,7 @@ public:
           dims.push_back(1);
         } else {
           if (lhsRank != 2) {
-            return op->emitError("Shape mismatch: expect rank 1 or 2 for mul "
+            return op->emitError("shape mismatch: expect rank 1 or 2 for mul "
                                  "operands, got ")
                    << lhsRank;
           }
@@ -302,7 +302,7 @@ public:
         auto callee = moduleManager.lookupSymbol<mlir::FuncOp>(calleeName);
         if (!callee) {
           signalPassFailure();
-          return f.emitError("Shape inference failed, call to unknown '")
+          return f.emitError("shape inference failed, call to unknown '")
                  << calleeName << "'";
         }
         auto mangledName = mangle(calleeName, op->getOpOperands());
@@ -340,7 +340,7 @@ public:
     // If the operation worklist isn't empty, this indicates a failure.
     if (!opWorklist.empty()) {
       signalPassFailure();
-      auto diag = f.emitError("Shape inference failed, ")
+      auto diag = f.emitError("shape inference failed, ")
                   << opWorklist.size() << " operations couldn't be inferred\n";
       for (auto *ope : opWorklist)
         diag << " - " << *ope << "\n";
index 5e06323..4b471a6 100644 (file)
@@ -109,7 +109,7 @@ ToyDialect::ToyDialect(mlir::MLIRContext *ctx) : mlir::Dialect("toy", ctx) {
 mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
   // Sanity check: we only support array or array<...>
   if (!tyData.startswith("array")) {
-    emitError(loc, "Invalid Toy type '" + tyData + "', array expected");
+    emitError(loc, "invalid Toy type '" + tyData + "', array expected");
     return nullptr;
   }
   // Drop the "array" prefix from the type name, we expect either an empty
@@ -124,7 +124,7 @@ mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
   SmallVector<StringRef, 4> matches;
   auto shapeRegex = llvm::Regex("^<([0-9]+)(, ([0-9]+))*>$");
   if (!shapeRegex.match(tyData, &matches)) {
-    emitError(loc, "Invalid toy array shape '" + tyData + "'");
+    emitError(loc, "invalid toy array shape '" + tyData + "'");
     return nullptr;
   }
   SmallVector<int64_t, 4> shape;
@@ -138,7 +138,7 @@ mlir::Type ToyDialect::parseType(StringRef tyData, mlir::Location loc) const {
     // Convert the capture to an integer
     unsigned long long dim;
     if (getAsUnsignedInteger(dimStr, /* Radix = */ 10, dim)) {
-      emitError(loc, "Couldn't parse dimension as integer, matched: " + dimStr);
+      emitError(loc, "couldn't parse dimension as integer, matched: " + dimStr);
       return mlir::Type();
     }
     shape.push_back(dim);
index 2f7eddf..718db0e 100644 (file)
@@ -117,7 +117,7 @@ static void getBackwardSliceImpl(Operation *op,
           getBackwardSliceImpl(loopOp, backwardSlice, filter);
       } else if (blockArg->getOwner() !=
                  &op->getParentOfType<FuncOp>().getBody().front()) {
-        op->emitError("Unsupported CF for operand ") << en.index();
+        op->emitError("unsupported CF for operand ") << en.index();
         llvm_unreachable("Unsupported control flow");
       }
       continue;
index 3f94aa8..59bc5b3 100644 (file)
@@ -916,7 +916,7 @@ static Optional<int64_t> getMemoryFootprintBytes(Block &block,
     if (failed(
             region->compute(opInst,
                             /*loopDepth=*/getNestingDepth(*block.begin())))) {
-      return opInst->emitError("Error obtaining memory region\n");
+      return opInst->emitError("error obtaining memory region\n");
     }
 
     auto it = regions.find(region->memref);
index 2cefa78..a69fe81 100644 (file)
@@ -120,7 +120,7 @@ OwnedCubin GpuKernelToCubinPass::convertModuleToCubin(llvm::Module &llvmModule,
     const llvm::Target *target =
         llvm::TargetRegistry::lookupTarget("", triple, error);
     if (target == nullptr) {
-      function.emitError("Cannot initialize target triple");
+      function.emitError("cannot initialize target triple");
       return {};
     }
     targetMachine.reset(
@@ -148,7 +148,7 @@ GpuKernelToCubinPass::translateGpuKernelToCubinAnnotation(FuncOp &function) {
   auto cubin = convertModuleToCubin(*llvmModule, function);
 
   if (!cubin) {
-    return function.emitError("Translation to CUDA binary failed.");
+    return function.emitError("translation to CUDA binary failed.");
   }
 
   function.setAttr(kCubinAnnotation,
index 29e9d28..c53a52d 100644 (file)
@@ -317,7 +317,7 @@ void GpuLaunchFuncToCudaCallsPass::translateGpuLaunchCalls(
   auto cubinGetter =
       kernelFunction.getAttrOfType<SymbolRefAttr>(kCubinGetterAnnotation);
   if (!cubinGetter) {
-    kernelFunction.emitError("Missing ")
+    kernelFunction.emitError("missing ")
         << kCubinGetterAnnotation << " attribute.";
     return signalPassFailure();
   }
index 737af70..08bd664 100644 (file)
@@ -264,7 +264,7 @@ static Value *substitute(Value *v, VectorType hwVectorType,
       assert(res.second && "Insertion failed");
       return res.first->second;
     }
-    v->getDefiningOp()->emitError("Missing substitution");
+    v->getDefiningOp()->emitError("missing substitution");
     return nullptr;
   }
   return it->second;
@@ -578,7 +578,7 @@ static bool instantiateMaterialization(Operation *op,
     return op->emitError("NYI: ops with != 1 results"), true;
   }
   if (op->getResult(0)->getType() != state->superVectorType) {
-    return op->emitError("Op does not return a supervector."), true;
+    return op->emitError("op does not return a supervector."), true;
   }
   auto *clone =
       instantiate(b, op, state->hwVectorType, state->substitutionsMap);
@@ -630,7 +630,7 @@ static bool emitSlice(MaterializationState *state,
     for (auto *op : *slice) {
       auto fail = instantiateMaterialization(op, &scopedState);
       if (fail) {
-        op->emitError("Unhandled super-vector materialization failure");
+        op->emitError("unhandled super-vector materialization failure");
         return true;
       }
     }
index 15da55b..e038512 100644 (file)
@@ -1667,7 +1667,7 @@ uint64_t mlir::affineDataCopyGenerate(Block::iterator begin,
       LLVM_DEBUG(llvm::dbgs() << "over-approximating to the entire memref\n");
       if (!getFullMemRefAsRegion(opInst, copyDepth, region.get())) {
         LLVM_DEBUG(
-            opInst->emitError("Non-constant memref sizes not yet supported"));
+            opInst->emitError("non-constant memref sizes not yet supported"));
         error = true;
         return;
       }
@@ -1702,7 +1702,7 @@ uint64_t mlir::affineDataCopyGenerate(Block::iterator begin,
             // If the union fails, we will overapproximate.
             if (!getFullMemRefAsRegion(opInst, copyDepth, region.get())) {
               LLVM_DEBUG(opInst->emitError(
-                  "Non-constant memref sizes not yet supported"));
+                  "non-constant memref sizes not yet supported"));
               error = true;
               return true;
             }