[all-commits] [llvm/llvm-project] 641124: [mlir][spirv] Add conversions for Arith's `maxnumf...

Daniil Dudkin via All-commits all-commits at lists.llvm.org
Tue Sep 19 12:50:02 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 641124a9b98eef668d8bb3bd3b6da5105a17284e
  Author: Daniil Dudkin <unterumarmung at yandex.ru>
  Date:   2023-09-19 (Tue, 19 Sep 2023)

  Changed paths:
    M mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
    M mlir/test/Conversion/ArithToSPIRV/arith-to-spirv.mlir
    M mlir/test/Conversion/ArithToSPIRV/fast-math.mlir

  Log Message:
  [mlir][spirv] Add conversions for Arith's `maxnumf` and `minnumf` (#66696)

This patch is part of a larger initiative aimed at fixing floating-point
`max` and `min` operations in MLIR:

In this commit, we add conversion patterns for the newly introduced
operations `arith.minnumf` and `arith.maxnumf`. When converting to
`spirv.CL`, there is no need to insert additional guards to propagate
non-NaN values when one of the arguments is NaN because `CL` ops do
exactly the same. However, `GL` ops have undefined behavior when one of
the arguments is NaN, so we should insert additional guards to enforce
the semantics of Arith's ops.

This patch addresses the 1.5 task of the mentioned RFC.

More information about the All-commits mailing list