Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mlir/include/mlir/Dialect/Quant/IR/QuantTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Dialect/Quant/IR/TypeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -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;

Expand Down
9 changes: 7 additions & 2 deletions mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Loading