diff --git a/mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h b/mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h index 9733efb6d83f..a0121e8e7864 100644 --- a/mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h +++ b/mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h @@ -3,7 +3,7 @@ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// Modifications (c) Copyright 2025 Advanced Micro Devices, Inc. or its +// Modifications (c) Copyright 2025-2026 Advanced Micro Devices, Inc. or its // affiliates // //===----------------------------------------------------------------------===// @@ -36,6 +36,7 @@ struct BlockFloatQuantizedTypeStorage; /// Enumeration of bit-mapped flags related to quantized types. namespace QuantizationFlags { enum FlagValue { + None = 0, // Indicates that the storage type should be interpreted as a signed // integer. The default is to interpret it as an unsigned value. Signed = 1, diff --git a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp index d81cfc226724..09187b13bd53 100644 --- a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp +++ b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp @@ -3,7 +3,7 @@ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// Modifications (c) Copyright 2025 Advanced Micro Devices, Inc. or its +// Modifications (c) Copyright 2025-2026 Advanced Micro Devices, Inc. or its // affiliates // //===----------------------------------------------------------------------===// @@ -123,7 +123,7 @@ static FloatType parseExpressedTypeAndRange(DialectAsmParser &parser, static Type parseAnyType(DialectAsmParser &parser) { IntegerType storageType; FloatType expressedType; - unsigned typeFlags = 0; + unsigned typeFlags = QuantizationFlags::None; int64_t storageTypeMin; int64_t storageTypeMax; diff --git a/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp b/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp index fb27640bfd27..beca2b1f5fb7 100644 --- a/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp +++ b/mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp @@ -4,6 +4,9 @@ // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// Modifications (c) Copyright 2026 Advanced Micro Devices, Inc. or its +// affiliates +// //===----------------------------------------------------------------------===// #include "mlir/Dialect/Quant/IR/QuantTypes.h" @@ -109,7 +112,8 @@ mlir::quant::fakeQuantAttrsToType(Location loc, unsigned numBits, double rmin, double rmax, bool narrowRange, Type expressedType, bool isSigned) { MLIRContext *ctx = expressedType.getContext(); - unsigned flags = isSigned ? QuantizationFlags::Signed : 0; + unsigned flags = + isSigned ? QuantizationFlags::Signed : QuantizationFlags::None; Type storageType; int64_t qmin; int64_t qmax; @@ -177,7 +181,8 @@ UniformQuantizedPerAxisType mlir::quant::fakeQuantAttrsToType( zeroPoints.push_back(nudgedZeroPoint); } - unsigned flags = isSigned ? QuantizationFlags::Signed : 0; + unsigned flags = + isSigned ? QuantizationFlags::Signed : QuantizationFlags::None; return UniformQuantizedPerAxisType::getChecked( loc, flags, storageType, expressedType, scales, zeroPoints, quantizedDimension, qmin, qmax);