[mlir][spirv] Add control for non-32-bit scalar type emulation
authorLei Zhang <antiagainst@google.com>
Wed, 7 Apr 2021 18:52:16 +0000 (14:52 -0400)
committerLei Zhang <antiagainst@google.com>
Thu, 8 Apr 2021 12:19:47 +0000 (08:19 -0400)
commit5299843c31468ab73d63242eaa79bedfc885b877
treec54f985e9e7b6c583a2e83cceb591108ccd66138
parent004f29c0bb3cad623bfd147f73bf6f8ab293ed53
[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
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h
mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir