[all-commits] [llvm/llvm-project] b4dff4: [mlir][spirv] Fix math.ctlz for full zero bit cases

Lei Zhang via All-commits all-commits at lists.llvm.org
Tue Jun 14 16:41:48 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b4dff404f37afa1fcad4a96c05462928eb0b89b1
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2022-06-14 (Tue, 14 Jun 2022)

  Changed paths:
    M mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp
    M mlir/test/Conversion/MathToSPIRV/math-to-glsl-spirv.mlir

  Log Message:
  [mlir][spirv] Fix math.ctlz for full zero bit cases

If the integer has all zero bits, GLSL FindUMsb would return -1.
So theoretically (31 - FindUMsb) should still give use the correct
result.  However, Adreno GPUshave issues with this:
This looks like a driver bug. So handle the corner case explicity
to workaround it.

Reviewed By: mravishankar

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

More information about the All-commits mailing list