[all-commits] [llvm/llvm-project] 7f0850: Introduce `arith.scaling_extf` and `arith.scaling_...
Umang Yadav via All-commits
all-commits at lists.llvm.org
Mon Jun 9 11:13:52 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7f08503a3bf3acdd2a58ac712d5e95682ce583dd
https://github.com/llvm/llvm-project/commit/7f08503a3bf3acdd2a58ac712d5e95682ce583dd
Author: Umang Yadav <29876643+umangyadav at users.noreply.github.com>
Date: 2025-06-09 (Mon, 09 Jun 2025)
Changed paths:
M mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
M mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
M mlir/include/mlir/IR/Builders.h
M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
M mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp
M mlir/lib/IR/Builders.cpp
M mlir/test/Dialect/Arith/expand-ops.mlir
Log Message:
-----------
Introduce `arith.scaling_extf` and `arith.scaling_truncf` (#141965)
This PR adds `arith.scaling_truncf` and `arith.scaling_extf` operations
which supports the block quantization following OCP MXFP specs listed
here
https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf
OCP MXFP Spec comes with reference implementation here
https://github.com/microsoft/microxcaling/tree/main
Interesting piece of reference code is this method `_quantize_mx`
https://github.com/microsoft/microxcaling/blob/7bc41952de394f5cc5e782baf132e7c7542eb4e4/mx/mx_ops.py#L173.
Both `arith.scaling_truncf` and `arith.scaling_extf` are designed to be
an elementwise operation. Please see description about them in
`ArithOps.td` file for more details.
Internally,
`arith.scaling_truncf` does the
`arith.truncf(arith.divf(input/(2^scale)))`. `scale` should have
necessary broadcast, clamping, normalization and NaN propagation done
before callling into `arith.scaling_truncf`.
`arith.scaling_extf` does the `arith.mulf(2^scale, input)` after taking
care of necessary data type conversions.
CC: @krzysz00 @dhernandez0 @bjacob @pashu123 @MaheshRavishankar
@tgymnich
---------
Co-authored-by: Prashant Kumar <pk5561 at gmail.com>
Co-authored-by: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list