Skip to content
Merged
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
17 changes: 11 additions & 6 deletions include/torch-mlir/Conversion/Utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ namespace mlir {
namespace torch {
namespace Torch {

// Define constants
// Float 16 limits
constexpr float Float16Max = 65504.0f;
constexpr float Float16Lowest = -65504.0f;

// BFloat 16 limits
constexpr float BFloat16Max = 3.38953139e38f;
constexpr float BFloat16Lowest = -3.38953139e38f;

// Define utility methods
LogicalResult verifyLinalgCompatibleTypes(Operation *op,
PatternRewriter &rewriter);

Expand Down Expand Up @@ -107,13 +117,8 @@ FailureOr<Value> unsqueezeTensor(PatternRewriter &rewriter, Operation *op,
FailureOr<Value> squeezeTensor(PatternRewriter &rewriter, Operation *op,
Value input, int64_t dim);

// Float 16 limits
constexpr float Float16Max = 65504.0f;
constexpr float Float16Lowest = -65504.0f;
void getZeroPoint(Value value, Value &zeropoint);

// BFloat 16 limits
constexpr float BFloat16Max = 3.38953139e38f;
constexpr float BFloat16Lowest = -3.38953139e38f;
} // namespace Torch
} // namespace torch
} // namespace mlir
Expand Down
6 changes: 0 additions & 6 deletions lib/Conversion/TorchToLinalg/Linear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ using namespace mlir::torch::Torch;

namespace {

static void getZeroPoint(Value value, Value &zeropoint) {
if (auto make = value.getDefiningOp<Aten_MakePerTensorQuantizedTensorOp>()) {
zeropoint = make.getZeroPoint();
}
}

// for uint8 types, we shift down by 128 so that we can faithfully
// represent the quantization with signed i8 types.
static void signShift(PatternRewriter &rewriter, Location loc, Value &arg,
Expand Down
Loading
Loading