summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Quantizer/Support
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-06-25 21:31:54 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-06-25 21:32:23 -0700
commita4c3a6455c404ef4e56a73be9457affb53536873 (patch)
tree98c799b972d8e5eaec881d1c1ef524a35e0394ab /mlir/lib/Quantizer/Support
parent679a3b41911457ef0f4a79a3135bb7ecca6d2f97 (diff)
downloadbcm5719-llvm-a4c3a6455c404ef4e56a73be9457affb53536873.tar.gz
bcm5719-llvm-a4c3a6455c404ef4e56a73be9457affb53536873.zip
Move the emitError/Warning/Remark utility methods out of MLIRContext and into the mlir namespace.
Now that Locations are attributes, they have direct access to the MLIR context. This allows for simplifying error emission by removing unnecessary context lookups. PiperOrigin-RevId: 255112791
Diffstat (limited to 'mlir/lib/Quantizer/Support')
-rw-r--r--mlir/lib/Quantizer/Support/UniformConstraints.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/mlir/lib/Quantizer/Support/UniformConstraints.cpp b/mlir/lib/Quantizer/Support/UniformConstraints.cpp
index 2ea081a7e7a..c43ecdfb5c2 100644
--- a/mlir/lib/Quantizer/Support/UniformConstraints.cpp
+++ b/mlir/lib/Quantizer/Support/UniformConstraints.cpp
@@ -48,8 +48,7 @@ static QuantizedType solveUniformType(SolverContext &solverContext,
Type originalElementType, Location loc) {
switch (ct.scheme) {
default:
- solverContext.getMlirContext().emitError(
- loc, "unsupported scheme for uniform type conversion");
+ emitError(loc, "unsupported scheme for uniform type conversion");
return nullptr;
case CandidateQuantizedType::Scheme::UniformPerLayer: {
@@ -66,9 +65,8 @@ static QuantizedType solveUniformType(SolverContext &solverContext,
params, clusteredFacts.requiredRange.getValue().first,
clusteredFacts.requiredRange.getValue().second);
if (!solver.compute()) {
- solverContext.getMlirContext().emitWarning(loc)
- << "unable to solve uniform type with "
- << "UniformParamsFromMinMaxSolver";
+ emitWarning(loc) << "unable to solve uniform type with "
+ << "UniformParamsFromMinMaxSolver";
return nullptr;
}
@@ -80,7 +78,7 @@ static QuantizedType solveUniformType(SolverContext &solverContext,
}
case CandidateQuantizedType::Scheme::UniformExplicitFixedPointScale: {
if (!clusteredFacts.explicitScaleZeroPoint.hasValue()) {
- solverContext.getMlirContext().emitRemark(loc)
+ emitRemark(loc)
<< "unable to solve uniform type with UniformExplicitFixedPointScale "
<< "(no explicitScaleZeroPoint)";
return nullptr;
@@ -90,7 +88,7 @@ static QuantizedType solveUniformType(SolverContext &solverContext,
assert(scaleZp.value && "optional value not set on fact");
if (scaleZp.conflict) {
- solverContext.getMlirContext().emitWarning(loc)
+ emitWarning(loc)
<< "conflicting explicit scale/zeroPoint on node cluster: "
<< "an arbitrary scale/zeroPoint will be used";
}
@@ -216,7 +214,7 @@ private:
}
if (!bestCandidateType || !originalElementType) {
- solverContext.getMlirContext().emitRemark(fusedLoc)
+ emitRemark(fusedLoc)
<< "not solving uniform type (no viable candidate type)";
return;
}
OpenPOWER on IntegriCloud