[Mlir-commits] [mlir] Quantile Type and Low FP Support (PR #190321)
Javed Absar
llvmlistbot at llvm.org
Sun May 31 16:31:46 PDT 2026
================
@@ -552,3 +554,139 @@ LogicalResult CalibratedQuantizedType::verifyInvariants(
double CalibratedQuantizedType::getMin() const { return getImpl()->min; }
double CalibratedQuantizedType::getMax() const { return getImpl()->max; }
+
+QuantileType QuantileType::get(mlir::MLIRContext *ctx, mlir::Type storageType,
+ mlir::Type quantileType,
+ ArrayRef<double> quantiles,
+ std::optional<int64_t> storageMin,
+ std::optional<int64_t> storageMax) {
+ return Base::get(ctx, storageType, quantileType, quantiles, storageMin,
+ storageMax);
+}
+
+QuantileType QuantileType::getChecked(
+ function_ref<InFlightDiagnostic()> emitError, mlir::MLIRContext *ctx,
+ mlir::Type storageType, mlir::Type quantileType, ArrayRef<double> quantiles,
+ std::optional<int64_t> storageMin, std::optional<int64_t> storageMax) {
+ return Base::getChecked(emitError, ctx, storageType, quantileType, quantiles,
+ storageMin, storageMax);
+}
+
+LogicalResult QuantileType::verifyInvariants(
+ function_ref<InFlightDiagnostic()> emitError, Type storageType,
+ Type quantileType, ArrayRef<double> quantiles,
+ std::optional<int64_t> storageMin, std::optional<int64_t> storageMax) {
+ if (!storageType.isIntOrFloat())
+ return emitError() << "storage type must be an integer or float type";
+ if (!llvm::isa<mlir::FloatType>(quantileType))
+ return emitError() << "quantile type must be a float type";
+ if (quantiles.empty())
+ return emitError() << "quantile values must not be empty";
+ if (storageMin.has_value() != storageMax.has_value())
+ return emitError()
+ << "storage min and max must both be specified or both omitted";
+ if (storageMin && storageMax && *storageMin >= *storageMax)
+ return emitError() << "storage min must be less than storage max";
----------------
javedabsar1 wrote:
But thats not what '*storageMin >= *storageMax' seems to be checking?
https://github.com/llvm/llvm-project/pull/190321
More information about the Mlir-commits
mailing list