[all-commits] [llvm/llvm-project] bb6f5c: [mlir][spirv] Convert tensor.extract for very smal...

Lei Zhang via All-commits all-commits at lists.llvm.org
Sat Mar 6 05:07:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb6f5c8314799a6553829b724c649e825a558caf
      https://github.com/llvm/llvm-project/commit/bb6f5c8314799a6553829b724c649e825a558caf
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2021-03-06 (Sat, 06 Mar 2021)

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

  Log Message:
  -----------
  [mlir][spirv] Convert tensor.extract for very small tensors

Normally tensors will be stored in buffers before converting to SPIR-V,
given that is how a large amount of data is sent to the GPU. However,
SPIR-V supports converting from tensors directly too. This is for the
cases where the tensor just contains a small amount of elements and it
makes sense to directly inline them as a small data array in the shader.
To handle this, internally the conversion might create new local
variables. SPIR-V consumers in GPU drivers may or may not optimize that
away. So this has implications over register pressure. Therefore, a
threshold is used to control when the patterns should kick in.

Reviewed By: ThomasRaoux

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




More information about the All-commits mailing list