[all-commits] [llvm/llvm-project] bddaa7: [MLIR][SPIRV] Support identified and recursive str...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Tue Oct 13 07:32:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bddaa7a84868cf91d35b896ff773a269bae640df
      https://github.com/llvm/llvm-project/commit/bddaa7a84868cf91d35b896ff773a269bae640df
  Author: ergawy <kareem.ergawy at gmail.com>
  Date:   2020-10-13 (Tue, 13 Oct 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h
    M mlir/lib/Dialect/SPIRV/LayoutUtils.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVDialect.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp
    M mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp
    M mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
    M mlir/lib/Dialect/SPIRV/Transforms/DecorateSPIRVCompositeTypeLayoutPass.cpp
    M mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
    M mlir/test/Conversion/GPUToSPIRV/if.mlir
    M mlir/test/Conversion/GPUToSPIRV/load-store.mlir
    M mlir/test/Conversion/GPUToSPIRV/module-structure-opencl.mlir
    M mlir/test/Conversion/GPUToSPIRV/simple.mlir
    M mlir/test/Conversion/GPUToVulkan/lower-gpu-launch-vulkan-launch.mlir
    M mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir
    M mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm.mlir
    M mlir/test/Conversion/StandardToSPIRV/alloc.mlir
    M mlir/test/Conversion/StandardToSPIRV/std-ops-to-spirv.mlir
    M mlir/test/Conversion/StandardToSPIRV/std-types-to-spirv.mlir
    M mlir/test/Dialect/SPIRV/Serialization/composite-op.mlir
    M mlir/test/Dialect/SPIRV/Serialization/debug.mlir
    M mlir/test/Dialect/SPIRV/Serialization/loop.mlir
    M mlir/test/Dialect/SPIRV/Serialization/memory-ops.mlir
    M mlir/test/Dialect/SPIRV/Serialization/spec-constant.mlir
    M mlir/test/Dialect/SPIRV/Serialization/struct.mlir
    M mlir/test/Dialect/SPIRV/Serialization/undef.mlir
    M mlir/test/Dialect/SPIRV/Transforms/abi-interface-opencl.mlir
    M mlir/test/Dialect/SPIRV/Transforms/abi-interface.mlir
    M mlir/test/Dialect/SPIRV/Transforms/abi-load-store.mlir
    M mlir/test/Dialect/SPIRV/Transforms/inlining.mlir
    M mlir/test/Dialect/SPIRV/Transforms/layout-decoration.mlir
    M mlir/test/Dialect/SPIRV/Transforms/rewrite-inserts.mlir
    M mlir/test/Dialect/SPIRV/Transforms/vce-deduction.mlir
    M mlir/test/Dialect/SPIRV/canonicalize.mlir
    M mlir/test/Dialect/SPIRV/composite-ops.mlir
    M mlir/test/Dialect/SPIRV/cooperative-matrix.mlir
    M mlir/test/Dialect/SPIRV/ops.mlir
    M mlir/test/Dialect/SPIRV/structure-ops.mlir
    M mlir/test/Dialect/SPIRV/types.mlir

  Log Message:
  -----------
  [MLIR][SPIRV] Support identified and recursive structs.

This PR adds support for identified and recursive structs.
This includes: parsing, printing, serializing, and
deserializing such structs.

The following C struct:

```C
struct A {
  A* next;
};
```

which is translated to the following MLIR code as:

```mlir
!spv.struct<A, (!spv.ptr<!spv.struct<A>, Generic>)>
```

would be represented in the SPIR-V module as:

```spirv
OpName %A "A"
OpTypeForwardPointer %APtr Generic
%A = OpTypeStruct %APtr
%APtr = OpTypePointer Generic %A
```

In particular the following changes are included:
- SPIR-V structs can now be either identified or literal
  (i.e. non-identified).
- All structs now have their members surrounded by a ()-pair.
- For recursive references,
  (1) an OpTypeForwardPointer instruction is emitted before
  the OpTypeStruct instruction defining the recursive struct
  (2) an OpTypePointer instruction is emitted after the
  OpTypeStruct instruction which actually defines the recursive
  pointer to struct type.

Reviewed By: antiagainst, rriddle, ftynse

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




More information about the All-commits mailing list