// 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;
}
op_name = "toy.mul";
break;
default:
- emitError(location, "Error: invalid binary operator '")
+ emitError(location, "error: invalid binary operator '")
<< binop.getOp() << "'";
return nullptr;
}
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;
}
auto init = vardecl.getInitVal();
if (!init) {
emitError(loc(vardecl.loc()),
- "Missing initializer in variable declaration");
+ "missing initializer in variable declaration");
return nullptr;
}
// 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;
}
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;
}
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;
}
}
} else {
emitError(loc(vardecl.loc()),
- "Missing initializer in variable declaration");
+ "missing initializer in variable declaration");
return nullptr;
}
// Register the value in the symbol table
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
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;
// 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);
// 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;
}
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;
}
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;
}
}
} else {
emitError(loc(vardecl.loc()),
- "Missing initializer in variable declaration");
+ "missing initializer in variable declaration");
return nullptr;
}
// Register the value in the symbol table
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;
}
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));
}
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]);
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();
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";
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
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;
// 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);
if (failed(applyPartialConversion(getModule(), target, toyPatterns,
&typeConverter))) {
emitError(UnknownLoc::get(getModule().getContext()),
- "Error lowering Toy\n");
+ "error lowering Toy\n");
signalPassFailure();
}
// 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;
}
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;
}
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;
}
}
} else {
emitError(loc(vardecl.loc()),
- "Missing initializer in variable declaration");
+ "missing initializer in variable declaration");
return nullptr;
}
// Register the value in the symbol table
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;
}
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;
}
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;
}
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());
// 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";
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
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;
// 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);
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;
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);
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(
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,
auto cubinGetter =
kernelFunction.getAttrOfType<SymbolRefAttr>(kCubinGetterAnnotation);
if (!cubinGetter) {
- kernelFunction.emitError("Missing ")
+ kernelFunction.emitError("missing ")
<< kCubinGetterAnnotation << " attribute.";
return signalPassFailure();
}
assert(res.second && "Insertion failed");
return res.first->second;
}
- v->getDefiningOp()->emitError("Missing substitution");
+ v->getDefiningOp()->emitError("missing substitution");
return nullptr;
}
return it->second;
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);
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;
}
}
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;
}
// 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;
}