Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
MegoHam21 committed Nov 18, 2024
1 parent e198ed9 commit d13fc9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/Builder/FrontendDialectTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1629,12 +1629,12 @@ int ImportFrontendModelFile(StringRef model_fname, MLIRContext &context,
if (ret != CompilerSuccess)
return ret;

auto status = google::protobuf::util::JsonStringToMessage(json, &model);
if (!status.ok()) {
*errorMessage = "Json Model Parsing Failed on " + model_fname.str() +
" with error '" + status.ToString() + "'";
return InvalidOnnxFormat;
}
// auto status = google::protobuf::util::JsonStringToMessage(json, &model);
// if (!status.ok()) {
// *errorMessage = "Json Model Parsing Failed on " + model_fname.str() +
// " with error '" + status.ToString() + "'";
// return InvalidOnnxFormat;
// }
} else {
bool parse_success;
if (model_fname.str() == "-")
Expand Down
13 changes: 8 additions & 5 deletions src/Dialect/Mlir/DialectBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,14 @@ Value MathBuilder::constant(Type type, double val) const {
// If unsigned, create a signless constant, then cast it to unsigned.
if (elementType.isUnsignedInteger()) {
Type signlessTy = b().getIntegerType(width);
constant = b().create<arith::ConstantOp>(loc(),
b().getIntegerAttr(signlessTy, APInt(width, (int64_t)val, false, true)));
constant = b().create<arith::ConstantOp>(
loc(), b().getIntegerAttr(signlessTy,
APInt(width, (int64_t)val, false, true)));
constant = castToUnsigned(constant, width);
} else {
constant = b().create<arith::ConstantOp>(loc(),
b().getIntegerAttr(elementType, APInt(width, (int64_t)val, false, true)));
constant = b().create<arith::ConstantOp>(
loc(), b().getIntegerAttr(elementType,
APInt(width, (int64_t)val, false, true)));
}
}
})
Expand Down Expand Up @@ -2263,7 +2265,8 @@ Value LLVMBuilder::constant(Type type, int64_t val) const {
assert(type.isSignless() &&
"LLVM::ConstantOp requires a signless type.");
constant = b().create<LLVM::ConstantOp>(loc(), type,
b().getIntegerAttr(type, APInt(width, (int64_t)val, false, true)));
b().getIntegerAttr(
type, APInt(width, (int64_t)val, false, true)));
}
})
.Case<IndexType>([&](Type) {
Expand Down

0 comments on commit d13fc9e

Please sign in to comment.