[all-commits] [llvm/llvm-project] 6329c7: [mlir][spirv] Add support for fast math mode

Lei Zhang via All-commits all-commits at lists.llvm.org
Fri Sep 9 13:27:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6329c7387f6b5cad2e2f80136932a297974728c1
      https://github.com/llvm/llvm-project/commit/6329c7387f6b5cad2e2f80136932a297974728c1
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2022-09-09 (Fri, 09 Sep 2022)

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h
    M mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
    M mlir/test/Conversion/ArithmeticToSPIRV/arithmetic-to-spirv.mlir
    A mlir/test/Conversion/ArithmeticToSPIRV/fast-math.mlir

  Log Message:
  -----------
  [mlir][spirv] Add support for fast math mode

This commit introduces a new option to SPIRVConversionOptions
to allow enabling fast math mode. With it, various patterns
would assume no NaN/infinity for floating point values and
avoid guards to check them. This is particularly useful for
CodeGen towards WebGPU environment, where fast math is assumed.

Along the way, fixed the conversion for arith.minf/maxf to
handle the NaN cases properly for Shader cases.

Part of https://github.com/llvm/llvm-project/issues/57584.

Reviewed By: ThomasRaoux, hanchung

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




More information about the All-commits mailing list