[all-commits] [llvm/llvm-project] da0730: [mlir][arith] Add initial integer bitwidth narrowi...

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Tue Apr 25 19:34:06 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: da0730b908a43e490430717beda8486598667ab8
  Author: Jakub Kuderski <kubak at google.com>
  Date:   2023-04-25 (Tue, 25 Apr 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
    M mlir/include/mlir/Dialect/Arith/Transforms/Passes.td
    M mlir/lib/Dialect/Arith/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
    A mlir/test/Dialect/Arith/int-narrowing.mlir

  Log Message:
  [mlir][arith] Add initial integer bitwidth narrowing pass

This pass reduces the logical complexity of arith ops by choosing
narrowest supported operand bitwidth. On some targets like mobile GPUs,
narrower bitwidths also bring better runtime performance.

The first batch of rewrites handles a simple case of `arith.sitofp`
and `arith.uitofp` with zero/sign-extended inputs. In future revisions,
I plan to extend it with the following:
-  Propagating sign/zero-extensions through bit-pattern-preserving ops,
   e.g., vector transpose, broadcast, insertions/extractions.
-  Handling `linalg.index` using the `ValueBounds` interface.
-  Handling more arith ops.

Reviewed By: springerm, antiagainst

Differential Revision: https://reviews.llvm.org/D149118

More information about the All-commits mailing list