[all-commits] [llvm/llvm-project] 004f29: [mlir][spirv] Timely fail type conversion

Lei Zhang via All-commits all-commits at lists.llvm.org
Thu Apr 8 05:20:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 004f29c0bb3cad623bfd147f73bf6f8ab293ed53
      https://github.com/llvm/llvm-project/commit/004f29c0bb3cad623bfd147f73bf6f8ab293ed53
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2021-04-08 (Thu, 08 Apr 2021)

  Changed paths:
    M mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp

  Log Message:
  -----------
  [mlir][spirv] Timely fail type conversion

Per the TypeConverter API contract, returning `llvm:None` means
other conversion rules should be tried. But we only have one
rule per input type. So there is no need to try others and we can
just directly fail, which should return `nullptr`. This avoids
unnecessary checks.

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


  Commit: 5299843c31468ab73d63242eaa79bedfc885b877
      https://github.com/llvm/llvm-project/commit/5299843c31468ab73d63242eaa79bedfc885b877
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2021-04-08 (Thu, 08 Apr 2021)

  Changed paths:
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h
    M mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp
    M mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
    M mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir

  Log Message:
  -----------
  [mlir][spirv] Add control for non-32-bit scalar type emulation

Non-32-bit scalar types require special hardware support that may not
exist on all GPUs. This is reflected in SPIR-V as that non-32-bit scalar
types require special capabilities or extensions.

Previously when there is a non-32-bit type and no native support, we
unconditionally emulate it with 32-bit ones. This isn't good given that
it can have implications over ABI and data layout consistency.

This commit introduces an option to control whether to use 32-bit
types to emulate.

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


Compare: https://github.com/llvm/llvm-project/compare/94a6fe43de45...5299843c3146


More information about the All-commits mailing list