diff options
author | Feng Liu <fengliuai@google.com> | 2019-09-09 15:29:30 -0700 |
---|---|---|
committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-09-09 15:29:59 -0700 |
commit | d3a6dbc0b895bdfdae3627c00d35066c4f51b032 (patch) | |
tree | ae3805be3d37dddacda7f4900e04bf510838e083 | |
parent | 27d776fa6d04e3ca47c42f5b9a90413c7243c35a (diff) | |
download | bcm5719-llvm-d3a6dbc0b895bdfdae3627c00d35066c4f51b032.tar.gz bcm5719-llvm-d3a6dbc0b895bdfdae3627c00d35066c4f51b032.zip |
[NFC] Rename ExpressedToUniformQuantizedType to ExpressedToQuantizedType
PiperOrigin-RevId: 268090906
-rw-r--r-- | mlir/include/mlir/Dialect/QuantOps/UniformSupport.h | 9 | ||||
-rw-r--r-- | mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp | 2 | ||||
-rw-r--r-- | mlir/lib/Dialect/QuantOps/Utils/UniformSupport.cpp | 15 |
3 files changed, 12 insertions, 14 deletions
diff --git a/mlir/include/mlir/Dialect/QuantOps/UniformSupport.h b/mlir/include/mlir/Dialect/QuantOps/UniformSupport.h index 5d11c769b8e..42366842ada 100644 --- a/mlir/include/mlir/Dialect/QuantOps/UniformSupport.h +++ b/mlir/include/mlir/Dialect/QuantOps/UniformSupport.h @@ -29,7 +29,7 @@ namespace mlir { namespace quant { /// Performs type conversion from an arbitrary input type to a type -/// that is expressed by a UniformQuantizedType. +/// that is expressed by a QuantizedType. /// /// This handles cases where the inputType is a supported primitive type /// (i.e. f32, bf16, etc) or a vector/tensor type based on a supported @@ -38,14 +38,13 @@ namespace quant { /// Since conversion often involves introspecting some attributes of the /// input type in order to determine how to represent it, this is a two step /// process. -struct ExpressedToUniformQuantizedConverter { +struct ExpressedToQuantizedConverter { /// Creates a converter for the given input type. - static const ExpressedToUniformQuantizedConverter - forInputType(Type inputType); + static const ExpressedToQuantizedConverter forInputType(Type inputType); /// Converts the inputType to be based on the given elemental type, /// returning the new type (or nullptr and emit an error on failure). - Type convert(UniformQuantizedType elementalType) const; + Type convert(QuantizedType elementalType) const; /// Whether the conversion is legal. explicit operator bool() const { return (bool)expressedType; } diff --git a/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp b/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp index 129671979ca..4f6eb8cb985 100644 --- a/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp +++ b/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp @@ -62,7 +62,7 @@ public: auto fqOp = cast<ConstFakeQuant>(op); auto converter = - ExpressedToUniformQuantizedConverter::forInputType(fqOp.getType()); + ExpressedToQuantizedConverter::forInputType(fqOp.getType()); if (!converter) { return (op->emitError("unsupported quantized type conversion"), true); } diff --git a/mlir/lib/Dialect/QuantOps/Utils/UniformSupport.cpp b/mlir/lib/Dialect/QuantOps/Utils/UniformSupport.cpp index db8a5848981..aec45d4076b 100644 --- a/mlir/lib/Dialect/QuantOps/Utils/UniformSupport.cpp +++ b/mlir/lib/Dialect/QuantOps/Utils/UniformSupport.cpp @@ -25,32 +25,31 @@ static bool isQuantizablePrimitiveType(Type inputType) { return inputType.isa<FloatType>(); } -const ExpressedToUniformQuantizedConverter -ExpressedToUniformQuantizedConverter::forInputType(Type inputType) { +const ExpressedToQuantizedConverter +ExpressedToQuantizedConverter::forInputType(Type inputType) { switch (inputType.getKind()) { default: if (isQuantizablePrimitiveType(inputType)) { // Supported primitive type (which just is the expressed type). - return ExpressedToUniformQuantizedConverter{inputType, inputType}; + return ExpressedToQuantizedConverter{inputType, inputType}; } // Unsupported. - return ExpressedToUniformQuantizedConverter{inputType, nullptr}; + return ExpressedToQuantizedConverter{inputType, nullptr}; case StandardTypes::RankedTensor: case StandardTypes::UnrankedTensor: case StandardTypes::Vector: { Type elementType = inputType.cast<ShapedType>().getElementType(); if (!isQuantizablePrimitiveType(elementType)) { // Unsupported. - return ExpressedToUniformQuantizedConverter{inputType, nullptr}; + return ExpressedToQuantizedConverter{inputType, nullptr}; } - return ExpressedToUniformQuantizedConverter{ + return ExpressedToQuantizedConverter{ inputType, inputType.cast<ShapedType>().getElementType()}; } } } -Type ExpressedToUniformQuantizedConverter::convert( - UniformQuantizedType elementalType) const { +Type ExpressedToQuantizedConverter::convert(QuantizedType elementalType) const { assert(expressedType && "convert() on unsupported conversion"); switch (inputType.getKind()) { |