[all-commits] [llvm/llvm-project] d625ea: [mlir][spirv] Split codegen for float min/max redu...

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Fri Nov 24 12:24:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d625ea12c71813db0da4c2e5867e907da22e22f2
      https://github.com/llvm/llvm-project/commit/d625ea12c71813db0da4c2e5867e907da22e22f2
  Author: Jakub Kuderski <jakub at nod-labs.com>
  Date:   2023-11-24 (Fri, 24 Nov 2023)

  Changed paths:
    M mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp

  Log Message:
  -----------
  [mlir][spirv] Split codegen for float min/max reductions and others v2. [NFC] (#73363)

This is https://github.com/llvm/llvm-project/pull/69023 but with
cleanups.
Reduced complexity by avoiding CRTP and preprocessor defines in favor of
free functions

Original description by @unterumarmung:

---

This patch is part of a larger initiative aimed at fixing floating-point
`max` and `min` operations in MLIR:
https://discourse.llvm.org/t/rfc-fix-floating-point-max-and-min-operations-in-mlir/72671.

There are two types of min/max operations for floating-point numbers:
`minf`/`maxf` and `minimumf`/`maximumf`. The code generation for these
operations should differ from that of other vector reduction kinds. This
difference arises because CL and GL operations for floating-point min
and max do not have the same semantics when handling NaNs. Therefore, we
must enforce the desired semantics with additional ops.

~~However, since the code generation for floating-point min/max
operations shares the same functionality as extracting values for the
vector, we have decided to refactor the existing code using the CRTP
pattern.~~ This change does not alter the actual behavior of the code
and is necessary for future fixes to the codegen for floating-point
min/max operations.

---------

Co-authored-by: Daniil Dudkin <unterumarmung at yandex.ru>




More information about the All-commits mailing list