diff --git a/mlir/docs/Dialects/SPIR-V.md b/mlir/docs/Dialects/SPIR-V.md --- a/mlir/docs/Dialects/SPIR-V.md +++ b/mlir/docs/Dialects/SPIR-V.md @@ -1,4 +1,4 @@ -# SPIR-V Dialect +# `spv` Dialect This document describes the design of the SPIR-V dialect in MLIR. It lists various design choices we made for modeling different SPIR-V mechanisms, and @@ -459,8 +459,10 @@ ``` Operation documentation is written in each op's Op Definition Spec using -TableGen. A markdown version of the doc can be found at -[mlir.llvm.org][LlvmMlirSpirvDoc] or generated using `mlir-tblgen -gen-doc`. +TableGen. A markdown version of the doc can be generated using `mlir-tblgen +-gen-doc`. + +[include "Dialects/SPIRVOps.md"] ### Ops from extended instruction sets @@ -1270,7 +1272,6 @@ [GitHubDialectTracking]: https://github.com/tensorflow/mlir/issues/302 [GitHubLoweringTracking]: https://github.com/tensorflow/mlir/issues/303 [GenSpirvUtilsPy]: https://github.com/llvm/llvm-project/blob/master/mlir/utils/spirv/gen_spirv_dialect.py -[LlvmMlirSpirvDoc]: ../Dialects/SPIRVOps/ [CustomTypeAttrTutorial]: ../DefiningAttributesAndTypes/ [VulkanSpirv]: https://renderdoc.org/vkspec_chunked/chap40.html#spirvenv [VulkanShaderInterface]: https://renderdoc.org/vkspec_chunked/chap14.html#interfaces-resources diff --git a/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt b/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt --- a/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt @@ -1,5 +1,5 @@ add_mlir_dialect(SPIRVOps spv) -add_mlir_doc(SPIRVOps -gen-dialect-doc SPIRVDialect Dialects/) +add_mlir_doc(SPIRVOps -gen-op-doc SPIRVOps Dialects/) set(LLVM_TARGET_DEFINITIONS SPIRVBase.td) mlir_tablegen(SPIRVEnums.h.inc -gen-enum-decls) diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVArithmeticOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVArithmeticOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVArithmeticOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVArithmeticOps.td @@ -39,21 +39,22 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The types of Operand 1 and Operand 2 both must be the same as Result - Type. + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` fadd-op ::= ssa-id `=` `spv.FAdd` ssa-use, ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.FAdd %0, %1 : f32 %5 = spv.FAdd %2, %3 : vector<4xf32> ``` @@ -68,13 +69,13 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The types of Operand 1 and Operand 2 both must be the same as Result - Type. + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. The resulting value is undefined - if Operand 2 is 0. + Results are computed per component. The resulting value is undefined if + Operand 2 is 0. ### Custom assembly form + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` @@ -82,9 +83,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.FDiv %0, %1 : f32 %5 = spv.FDiv %2, %3 : vector<4xf32> ``` @@ -101,24 +102,25 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The types of Operand 1 and Operand 2 both must be the same as Result - Type. + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. Otherwise, the result is the remainder r of Operand 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the sign of Operand 2. ### Custom assembly form + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` fmod-op ::= ssa-id `=` `spv.FMod` ssa-use, ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.FMod %0, %1 : f32 %5 = spv.FMod %2, %3 : vector<4xf32> ``` @@ -133,10 +135,9 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The types of Operand 1 and Operand 2 both must be the same as Result - Type. + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -147,9 +148,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.FMul %0, %1 : f32 %5 = spv.FMul %2, %3 : vector<4xf32> ``` @@ -164,9 +165,9 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The type of Operand must be the same as Result Type. + The type of Operand must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -176,9 +177,9 @@ fmul-op ::= `spv.FNegate` ssa-use `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.FNegate %0 : f32 %3 = spv.FNegate %2 : vector<4xf32> ``` @@ -195,15 +196,16 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The types of Operand 1 and Operand 2 both must be the same as Result + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. Otherwise, the result is the remainder r of Operand 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the sign of Operand 1. ### Custom assembly form + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` @@ -211,9 +213,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.FRemOp %0, %1 : f32 %5 = spv.FRemOp %2, %3 : vector<4xf32> ``` @@ -228,12 +230,13 @@ let description = [{ Result Type must be a scalar or vector of floating-point type. - The types of Operand 1 and Operand 2 both must be the same as Result + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` @@ -241,9 +244,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.FRemOp %0, %1 : f32 %5 = spv.FRemOp %2, %3 : vector<4xf32> ``` @@ -258,7 +261,7 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same number of components as Result Type. They must have the same component width as Result Type. @@ -266,9 +269,10 @@ result R, where N is the component width and R is computed with enough precision to avoid overflow and underflow. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` @@ -276,12 +280,11 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.IAdd %0, %1 : i32 %5 = spv.IAdd %2, %3 : vector<4xi32> - ``` }]; @@ -296,7 +299,7 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same number of components as Result Type. They must have the same component width as Result Type. @@ -304,9 +307,10 @@ result R, where N is the component width and R is computed with enough precision to avoid overflow and underflow. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` @@ -314,12 +318,11 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.IMul %0, %1 : i32 %5 = spv.IMul %2, %3 : vector<4xi32> - ``` }]; @@ -334,7 +337,7 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same number of components as Result Type. They must have the same component width as Result Type. @@ -342,9 +345,10 @@ result R, where N is the component width and R is computed with enough precision to avoid overflow and underflow. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` @@ -352,12 +356,11 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.ISub %0, %1 : i32 %5 = spv.ISub %2, %3 : vector<4xi32> - ``` }]; @@ -372,14 +375,15 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same number of components as Result Type. They must have the same component width as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` @@ -387,12 +391,11 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %4 = spv.SDiv %0, %1 : i32 %5 = spv.SDiv %2, %3 : vector<4xi32> - ``` }]; } @@ -408,28 +411,29 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same number of components as Result Type. They must have the same component width as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. Otherwise, the result is the remainder r of Operand 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the sign of Operand 2. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` smod-op ::= ssa-id `=` `spv.SMod` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.SMod %0, %1 : i32 %5 = spv.SMod %2, %3 : vector<4xi32> - ``` }]; } @@ -445,25 +449,27 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same number of components as Result Type. They must have the same component width as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. Otherwise, the result is the remainder r of Operand 1 divided by Operand 2 where if r ≠ 0, the sign of r is the same as the sign of Operand 1. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` srem-op ::= ssa-id `=` `spv.SRem` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.SRem %0, %1 : i32 %5 = spv.SRem %2, %3 : vector<4xi32> @@ -480,20 +486,21 @@ Result Type must be a scalar or vector of integer type, whose Signedness operand is 0. - The types of Operand 1 and Operand 2 both must be the same as Result - Type. + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` udiv-op ::= ssa-id `=` `spv.UDiv` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: + + Example: ``` %4 = spv.UDiv %0, %1 : i32 @@ -512,25 +519,25 @@ Result Type must be a scalar or vector of integer type, whose Signedness operand is 0. - The types of Operand 1 and Operand 2 both must be the same as Result - Type. + The types of Operand 1 and Operand 2 both must be the same as Result Type. - Results are computed per component. The resulting value is undefined + Results are computed per component. The resulting value is undefined if Operand 2 is 0. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` umod-op ::= ssa-id `=` `spv.UMod` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: + + Example: ``` %4 = spv.UMod %0, %1 : i32 %5 = spv.UMod %2, %3 : vector<4xi32> - ``` }]; } diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td @@ -77,7 +77,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -94,9 +94,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicAnd "Device" "None" %pointer, %value : !spv.ptr ``` @@ -122,9 +122,9 @@ `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicCompareExchangeWeak "Workgroup" "Acquire" "None" %pointer, %value, %comparator : !spv.ptr @@ -171,7 +171,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -184,9 +184,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicIAdd "Device" "None" %pointer, %value : !spv.ptr ``` @@ -224,9 +224,9 @@ `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicIDecrement "Device" "None" %pointer : !spv.ptr ``` @@ -263,9 +263,9 @@ `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicIncrement "Device" "None" %pointer : !spv.ptr ``` @@ -292,8 +292,8 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the - value pointed to by Pointer must be the same as Result Type. + The type of Value must be the same as Result Type. The type of the value + pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -305,9 +305,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicISub "Device" "None" %pointer, %value : !spv.ptr ``` @@ -333,7 +333,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -346,9 +346,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicOr "Device" "None" %pointer, %value : !spv.ptr ``` @@ -375,7 +375,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -388,9 +388,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicSMax "Device" "None" %pointer, %value : !spv.ptr ``` @@ -417,7 +417,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -430,9 +430,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicSMin "Device" "None" %pointer, %value : !spv.ptr ``` @@ -459,7 +459,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -472,9 +472,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicUMax "Device" "None" %pointer, %value : !spv.ptr ``` @@ -501,7 +501,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -514,9 +514,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicUMin "Device" "None" %pointer, %value : !spv.ptr ``` @@ -543,7 +543,7 @@ Result Type must be an integer type scalar. - The type of Value must be the same as Result Type. The type of the + The type of Value must be the same as Result Type. The type of the value pointed to by Pointer must be the same as Result Type. Memory must be a valid memory Scope. @@ -556,9 +556,9 @@ ssa-use `,` ssa-use `:` spv-pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.AtomicXor "Device" "None" %pointer, %value : !spv.ptr ``` diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVBitOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVBitOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVBitOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVBitOps.td @@ -63,7 +63,7 @@ let summary = "Count the number of set bits in an object."; let description = [{ - Results are computed per component. + Results are computed per component. Result Type must be a scalar or vector of integer type. The components must be wide enough to hold the unsigned Width of Base as an unsigned @@ -85,9 +85,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.BitCount %0: i32 %3 = spv.BitCount %1: vector<4xi32> ``` @@ -111,11 +111,11 @@ }]; let description = [{ - Results are computed per component. + Results are computed per component. Result Type must be a scalar or vector of integer type. - The type of Base and Insert must be the same as Result Type. + The type of Base and Insert must be the same as Result Type. Any result bits numbered outside [Offset, Offset + Count - 1] (inclusive) will come from the corresponding bits in Base. @@ -133,20 +133,9 @@ The resulting value is undefined if Count or Offset or their sum is greater than the number of bits in the result. - ### Custom assembly form + Example: - ``` - integer-scalar-vector-type ::= integer-type | - `vector<` integer-literal `x` integer-type `>` - bitfield-insert-op ::= ssa-id `=` `spv.BitFieldInsert` ssa-use `,` ssa-use - `,` ssa-use `,` ssa-use - `:` integer-scalar-vector-type - `,` integer-type `,` integer-type - ``` - - For example: - - ``` + ```mlir %0 = spv.BitFieldInsert %base, %insert, %offset, %count : vector<3xi32>, i8, i8 ``` }]; @@ -182,11 +171,11 @@ let summary = "Extract a bit field from an object, with sign extension."; let description = [{ - Results are computed per component. + Results are computed per component. Result Type must be a scalar or vector of integer type. - The type of Base must be the same as Result Type. + The type of Base must be the same as Result Type. If Count is greater than 0: The bits of Base numbered in [Offset, Offset + Count - 1] (inclusive) become the bits numbered [0, Count - 1] of the @@ -204,20 +193,9 @@ The resulting value is undefined if Count or Offset or their sum is greater than the number of bits in the result. - ### Custom assembly form - - ``` - integer-scalar-vector-type ::= integer-type | - `vector<` integer-literal `x` integer-type `>` - bitfield-extract-s-op ::= ssa-id `=` `spv.BitFieldSExtract` ssa-use - `,` ssa-use `,` ssa-use - `:` integer-scalar-vector-type - `,` integer-type `,` integer-type - ``` + Example: - For example: - - ``` + ```mlir %0 = spv.BitFieldSExtract %base, %offset, %count : vector<3xi32>, i8, i8 ``` }]; @@ -240,20 +218,9 @@ that there is no sign extension. The remaining bits of the result will all be 0. - ### Custom assembly form - - ``` - integer-scalar-vector-type ::= integer-type | - `vector<` integer-literal `x` integer-type `>` - bitfield-extract-u-op ::= ssa-id `=` `spv.BitFieldUExtract` ssa-use - `,` ssa-use `,` ssa-use - `:` integer-scalar-vector-type - `,` integer-type `,` integer-type - ``` + Example: - For example: - - ``` + ```mlir %0 = spv.BitFieldUExtract %base, %offset, %count : vector<3xi32>, i8, i8 ``` }]; @@ -272,11 +239,11 @@ let summary = "Reverse the bits in an object."; let description = [{ - Results are computed per component. + Results are computed per component. Result Type must be a scalar or vector of integer type. - The type of Base must be the same as Result Type. + The type of Base must be the same as Result Type. The bit-number n of the result will be taken from bit-number Width - 1 - n of Base, where Width is the OpTypeInt operand of the Result Type. @@ -290,9 +257,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.BitReverse %0 : i32 %3 = spv.BitReverse %1 : vector<4xi32> ``` @@ -315,7 +282,7 @@ }]; let description = [{ - Results are computed per component, and within each component, per bit. + Results are computed per component, and within each component, per bit. Result Type must be a scalar or vector of integer type. The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. @@ -331,9 +298,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.BitwiseAnd %0, %1 : i32 %2 = spv.BitwiseAnd %0, %1 : vector<4xi32> ``` @@ -356,7 +323,7 @@ }]; let description = [{ - Results are computed per component, and within each component, per bit. + Results are computed per component, and within each component, per bit. Result Type must be a scalar or vector of integer type. The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. @@ -372,9 +339,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.BitwiseOr %0, %1 : i32 %2 = spv.BitwiseOr %0, %1 : vector<4xi32> ``` @@ -397,7 +364,7 @@ }]; let description = [{ - Results are computed per component, and within each component, per bit. + Results are computed per component, and within each component, per bit. Result Type must be a scalar or vector of integer type. The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. @@ -413,9 +380,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.BitwiseXor %0, %1 : i32 %2 = spv.BitwiseXor %0, %1 : vector<4xi32> ``` @@ -440,7 +407,7 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of each Base and Shift must be a scalar or vector of integer + The type of each Base and Shift must be a scalar or vector of integer type. Base and Shift must have the same number of components. The number of components and bit width of the type of Base must be the same as in Result Type. @@ -451,7 +418,7 @@ The number of components and bit width of Result Type must match those Base type. All types must be integer types. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -464,9 +431,9 @@ integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.ShiftLeftLogical %0, %1 : i32, i16 %5 = spv.ShiftLeftLogical %3, %4 : vector<3xi32>, vector<3xi16> ``` @@ -491,7 +458,7 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of each Base and Shift must be a scalar or vector of integer + The type of each Base and Shift must be a scalar or vector of integer type. Base and Shift must have the same number of components. The number of components and bit width of the type of Base must be the same as in Result Type. @@ -499,7 +466,7 @@ Shift is treated as unsigned. The result is undefined if Shift is greater than or equal to the bit width of the components of Base. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -512,9 +479,9 @@ integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.ShiftRightArithmetic %0, %1 : i32, i16 %5 = spv.ShiftRightArithmetic %3, %4 : vector<3xi32>, vector<3xi16> ``` @@ -539,7 +506,7 @@ let description = [{ Result Type must be a scalar or vector of integer type. - The type of each Base and Shift must be a scalar or vector of integer + The type of each Base and Shift must be a scalar or vector of integer type. Base and Shift must have the same number of components. The number of components and bit width of the type of Base must be the same as in Result Type. @@ -548,7 +515,7 @@ Shift is greater than or equal to the bit width of the components of Base. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -561,9 +528,9 @@ integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.ShiftRightLogical %0, %1 : i32, i16 %5 = spv.ShiftRightLogical %3, %4 : vector<3xi32>, vector<3xi16> ``` @@ -583,7 +550,7 @@ let summary = "Complement the bits of Operand."; let description = [{ - Results are computed per component, and within each component, per bit. + Results are computed per component, and within each component, per bit. Result Type must be a scalar or vector of integer type. @@ -599,9 +566,9 @@ not-op ::= ssa-id `=` `spv.BitNot` ssa-use `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.Not %0 : i32 %3 = spv.Not %1 : vector<4xi32> ``` diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVCastOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVCastOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVCastOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVCastOps.td @@ -69,9 +69,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.Bitcast %0 : f32 to i32 %1 = spv.Bitcast %0 : vector<2xf32> to i64 %1 = spv.Bitcast %0 : !spv.ptr to !spv.ptr @@ -106,7 +106,7 @@ Float Value must be a scalar or vector of floating-point type. It must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -115,9 +115,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.ConvertFToS %0 : f32 to i32 %3 = spv.ConvertFToS %2 : vector<3xf32> to vector<3xi32> ``` @@ -139,7 +139,7 @@ Float Value must be a scalar or vector of floating-point type. It must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -148,9 +148,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.ConvertFToU %0 : f32 to i32 %3 = spv.ConvertFToU %2 : vector<3xf32> to vector<3xi32> ``` @@ -170,7 +170,7 @@ Signed Value must be a scalar or vector of integer type. It must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -179,9 +179,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.ConvertSToF %0 : i32 to f32 %3 = spv.ConvertSToF %2 : vector<3xi32> to vector<3xf32> ``` @@ -201,7 +201,7 @@ Unsigned Value must be a scalar or vector of integer type. It must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -210,9 +210,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.ConvertUToF %0 : i32 to f32 %3 = spv.ConvertUToF %2 : vector<3xi32> to vector<3xf32> ``` @@ -234,7 +234,7 @@ have the same number of components as Result Type. The component width cannot equal the component width in Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -243,9 +243,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.FConvertOp %0 : f32 to f64 %3 = spv.FConvertOp %2 : vector<3xf32> to vector<3xf64> ``` @@ -268,7 +268,7 @@ the same number of components as Result Type. The component width cannot equal the component width in Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -277,9 +277,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.SConvertOp %0 : i32 to i64 %3 = spv.SConvertOp %2 : vector<3xi32> to vector<3xi64> ``` @@ -303,7 +303,7 @@ the same number of components as Result Type. The component width cannot equal the component width in Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -312,9 +312,9 @@ `:` operand-type `to` result-type ``` - For example: + Example: - ``` + ```mlir %1 = spv.UConvertOp %0 : i32 to i64 %3 = spv.UConvertOp %2 : vector<3xi32> to vector<3xi64> ``` diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td @@ -51,9 +51,9 @@ (ssa-use (`,` ssa-use)* )? `:` composite-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.CompositeConstruct %1, %2, %3 : vector<3xf32> ``` }]; @@ -91,9 +91,9 @@ `:` composite-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.Variable : !spv.ptr>, Function> %1 = spv.Load "Function" %0 ["Volatile"] : !spv.array<4x!spv.array<4xf32>> %2 = spv.CompositeExtract %1[1 : i32] : !spv.array<4x!spv.array<4xf32>> @@ -146,9 +146,9 @@ `:` object-type `into` composite-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.CompositeInsert %object, %composite[1 : i32] : f32 into !spv.array<4xf32> ``` }]; diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td @@ -29,17 +29,9 @@ let description = [{ This instruction must be the last instruction in a block. - ### Custom assembly form - - ``` - branch-op ::= `spv.Branch` successor - successor ::= bb-id branch-use-list? - branch-use-list ::= `(` ssa-use-list `:` type-list-no-parens `)` - ``` + Example: - For example: - - ``` + ```mlir spv.Branch ^target spv.Branch ^target(%0, %1: i32, f32) ``` @@ -115,9 +107,9 @@ branch-use-list ::= `(` ssa-use-list `:` type-list-no-parens `)` ``` - For example: + Example: - ``` + ```mlir spv.BranchConditional %condition, ^true_branch, ^false_branch spv.BranchConditional %condition, ^true_branch(%0: i32), ^false_branch(%1: i32) ``` @@ -219,16 +211,9 @@ information: Result Type must match the Return Type of the function, and the calling argument types must match the formal parameter types. - ### Custom assembly form + Example: - ``` - function-call-op ::= `spv.FunctionCall` function-id `(` ssa-use-list `)` - `:` function-type - ``` - - For example: - - ``` + ```mlir spv.FunctionCall @f_void(%arg0) : (i32) -> () %0 = spv.FunctionCall @f_iadd(%arg0, %arg1) : (i32, i32) -> i32 ``` @@ -347,12 +332,6 @@ let description = [{ This instruction must be the last instruction in a block. - - ### Custom assembly form - - ``` - return-op ::= `spv.Return` - ``` }]; let arguments = (ins); @@ -369,12 +348,6 @@ let description = [{ This instruction must be the last instruction in a block. - - ### Custom assembly form - - ``` - unreachable-op ::= `spv.Unreachable` - ``` }]; let arguments = (ins); @@ -397,13 +370,7 @@ This instruction must be the last instruction in a block. - ### Custom assembly form - - ``` - return-value-op ::= `spv.ReturnValue` ssa-use `:` spirv-type - ``` - - For example: + Example: ``` spv.ReturnValue %0 : f32 diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVGLSLOps.td @@ -92,15 +92,17 @@ per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` abs-op ::= ssa-id `=` `spv.GLSL.FAbs` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.FAbs %0 : f32 %3 = spv.GLSL.FAbs %1 : vector<3xf16> ``` @@ -121,15 +123,17 @@ with the same component width. Results are computed per component. ### Custom assembly format + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` abs-op ::= ssa-id `=` `spv.GLSL.SAbs` ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.SAbs %0 : i32 %3 = spv.GLSL.SAbs %1 : vector<3xi16> ``` @@ -152,15 +156,17 @@ per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` ceil-op ::= ssa-id `=` `spv.GLSL.Ceil` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Ceil %0 : f32 %3 = spv.GLSL.Ceil %1 : vector<3xf16> ``` @@ -182,6 +188,7 @@ per component. ### Custom assembly format + ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= @@ -190,9 +197,10 @@ cos-op ::= ssa-id `=` `spv.GLSL.Cos` ssa-use `:` restricted-float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Cos %0 : f32 %3 = spv.GLSL.Cos %1 : vector<3xf16> ``` @@ -214,6 +222,7 @@ per component. ### Custom assembly format + ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= @@ -222,9 +231,10 @@ sin-op ::= ssa-id `=` `spv.GLSL.Sin` ssa-use `:` restricted-float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Sin %0 : f32 %3 = spv.GLSL.Sin %1 : vector<3xf16> ``` @@ -246,6 +256,7 @@ computed per component."; ### Custom assembly format + ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= @@ -254,9 +265,10 @@ exp-op ::= ssa-id `=` `spv.GLSL.Exp` ssa-use `:` restricted-float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Exp %0 : f32 %3 = spv.GLSL.Exp %1 : vector<3xf16> ``` @@ -279,15 +291,17 @@ per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` floor-op ::= ssa-id `=` `spv.GLSL.Floor` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Floor %0 : f32 %3 = spv.GLSL.Floor %1 : vector<3xf16> ``` @@ -309,15 +323,17 @@ per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` rsqrt-op ::= ssa-id `=` `spv.GLSL.InverseSqrt` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.InverseSqrt %0 : f32 %3 = spv.GLSL.InverseSqrt %1 : vector<3xf16> ``` @@ -340,6 +356,7 @@ per component. ### Custom assembly format + ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= @@ -348,9 +365,10 @@ log-op ::= ssa-id `=` `spv.GLSL.Log` ssa-use `:` restricted-float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Log %0 : f32 %3 = spv.GLSL.Log %1 : vector<3xf16> ``` @@ -373,15 +391,17 @@ type. Results are computed per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` fmax-op ::= ssa-id `=` `spv.GLSL.FMax` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.FMax %0, %1 : f32 %3 = spv.GLSL.FMax %0, %1 : vector<3xf16> ``` @@ -403,15 +423,17 @@ component. ### Custom assembly format + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` smax-op ::= ssa-id `=` `spv.GLSL.SMax` ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.SMax %0, %1 : i32 %3 = spv.GLSL.SMax %0, %1 : vector<3xi16> ``` @@ -434,15 +456,17 @@ computed per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` fmin-op ::= ssa-id `=` `spv.GLSL.FMin` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.FMin %0, %1 : f32 %3 = spv.GLSL.FMin %0, %1 : vector<3xf16> ``` @@ -464,15 +488,17 @@ component. ### Custom assembly format + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` smin-op ::= ssa-id `=` `spv.GLSL.SMin` ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.SMin %0, %1 : i32 %3 = spv.GLSL.SMin %0, %1 : vector<3xi16> ``` @@ -494,15 +520,17 @@ per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` sign-op ::= ssa-id `=` `spv.GLSL.FSign` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.FSign %0 : f32 %3 = spv.GLSL.FSign %1 : vector<3xf16> ``` @@ -523,15 +551,17 @@ with the same component width. Results are computed per component. ### Custom assembly format + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` sign-op ::= ssa-id `=` `spv.GLSL.SSign` ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.SSign %0 : i32 %3 = spv.GLSL.SSign %1 : vector<3xi16> ``` @@ -553,15 +583,17 @@ per component. ### Custom assembly format + ``` float-scalar-vector-type ::= float-type | `vector<` integer-literal `x` float-type `>` sqrt-op ::= ssa-id `=` `spv.GLSL.Sqrt` ssa-use `:` float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Sqrt %0 : f32 %3 = spv.GLSL.Sqrt %1 : vector<3xf16> ``` @@ -583,6 +615,7 @@ per component. ### Custom assembly format + ``` restricted-float-scalar-type ::= `f16` | `f32` restricted-float-scalar-vector-type ::= @@ -591,9 +624,10 @@ tanh-op ::= ssa-id `=` `spv.GLSL.Tanh` ssa-use `:` restricted-float-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %2 = spv.GLSL.Tanh %0 : f32 %3 = spv.GLSL.Tanh %1 : vector<3xf16> ``` diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVGroupOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVGroupOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVGroupOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVGroupOps.td @@ -35,16 +35,9 @@ higher bit number of the last bitmask needed to represent all bits of the subgroup invocations. - ### Custom assembly form + Example: - ``` - subgroup-ballot-op ::= ssa-id `=` `spv.SubgroupBallotKHR` - ssa-use `:` `vector` `<` 4 `x` `i32` `>` - ``` - - For example: - - ``` + ```mlir %0 = spv.SubgroupBallotKHR %predicate : vector<4xi32> ``` }]; diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td @@ -46,11 +46,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -60,9 +60,9 @@ fordequal-op ::= ssa-id `=` `spv.FOrdEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FOrdEqual %0, %1 : f32 %5 = spv.FOrdEqual %2, %3 : vector<4xf32> ``` @@ -80,11 +80,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -94,9 +94,9 @@ fordgt-op ::= ssa-id `=` `spv.FOrdGreaterThan` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FOrdGreaterThan %0, %1 : f32 %5 = spv.FOrdGreaterThan %2, %3 : vector<4xf32> ``` @@ -114,11 +114,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -128,9 +128,9 @@ fordgte-op ::= ssa-id `=` `spv.FOrdGreaterThanEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FOrdGreaterThanEqual %0, %1 : f32 %5 = spv.FOrdGreaterThanEqual %2, %3 : vector<4xf32> ``` @@ -148,11 +148,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -162,9 +162,9 @@ fordlt-op ::= ssa-id `=` `spv.FOrdLessThan` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FOrdLessThan %0, %1 : f32 %5 = spv.FOrdLessThan %2, %3 : vector<4xf32> ``` @@ -182,11 +182,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -196,9 +196,9 @@ fordlte-op ::= ssa-id `=` `spv.FOrdLessThanEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FOrdLessThanEqual %0, %1 : f32 %5 = spv.FOrdLessThanEqual %2, %3 : vector<4xf32> ``` @@ -213,11 +213,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -227,9 +227,9 @@ fordneq-op ::= ssa-id `=` `spv.FOrdNotEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FOrdNotEqual %0, %1 : f32 %5 = spv.FOrdNotEqual %2, %3 : vector<4xf32> ``` @@ -244,11 +244,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -258,9 +258,9 @@ funordequal-op ::= ssa-id `=` `spv.FUnordEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FUnordEqual %0, %1 : f32 %5 = spv.FUnordEqual %2, %3 : vector<4xf32> ``` @@ -278,11 +278,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -292,9 +292,9 @@ funordgt-op ::= ssa-id `=` `spv.FUnordGreaterThan` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FUnordGreaterThan %0, %1 : f32 %5 = spv.FUnordGreaterThan %2, %3 : vector<4xf32> ``` @@ -312,11 +312,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -326,9 +326,9 @@ funordgte-op ::= ssa-id `=` `spv.FUnordGreaterThanEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FUnordGreaterThanEqual %0, %1 : f32 %5 = spv.FUnordGreaterThanEqual %2, %3 : vector<4xf32> ``` @@ -346,11 +346,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -360,9 +360,9 @@ funordlt-op ::= ssa-id `=` `spv.FUnordLessThan` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FUnordLessThan %0, %1 : f32 %5 = spv.FUnordLessThan %2, %3 : vector<4xf32> ``` @@ -380,11 +380,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -394,9 +394,9 @@ funordlte-op ::= ssa-id `=` `spv.FUnordLessThanEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FUnordLessThanEqual %0, %1 : f32 %5 = spv.FUnordLessThanEqual %2, %3 : vector<4xf32> ``` @@ -411,11 +411,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of floating-point type. They must have the same type, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -425,9 +425,9 @@ funordneq-op ::= ssa-id `=` `spv.FUnordNotEqual` ssa-use, ssa-use ``` - For example: + Example: - ``` + ```mlir %4 = spv.FUnordNotEqual %0, %1 : f32 %5 = spv.FUnordNotEqual %2, %3 : vector<4xf32> ``` @@ -442,22 +442,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` iequal-op ::= ssa-id `=` `spv.IEqual` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.IEqual %0, %1 : i32 %5 = spv.IEqual %2, %3 : vector<4xi32> @@ -473,22 +475,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` inot-equal-op ::= ssa-id `=` `spv.INotEqual` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.INotEqual %0, %1 : i32 %5 = spv.INotEqual %2, %3 : vector<4xi32> @@ -507,11 +511,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 must be the same as Result Type. + The type of Operand 1 must be the same as Result Type. - The type of Operand 2 must be the same as Result Type. + The type of Operand 2 must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -520,9 +524,9 @@ `:` operand-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.LogicalAnd %0, %1 : i1 %2 = spv.LogicalAnd %0, %1 : vector<4xi1> ``` @@ -542,11 +546,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 must be the same as Result Type. + The type of Operand 1 must be the same as Result Type. - The type of Operand 2 must be the same as Result Type. + The type of Operand 2 must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -555,9 +559,9 @@ `:` operand-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.LogicalEqual %0, %1 : i1 %2 = spv.LogicalEqual %0, %1 : vector<4xi1> ``` @@ -574,9 +578,9 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand must be the same as Result Type. + The type of Operand must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -584,9 +588,9 @@ logical-not ::= `spv.LogicalNot` ssa-use `:` operand-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.LogicalNot %0 : i1 %2 = spv.LogicalNot %0 : vector<4xi1> ``` @@ -606,11 +610,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 must be the same as Result Type. + The type of Operand 1 must be the same as Result Type. - The type of Operand 2 must be the same as Result Type. + The type of Operand 2 must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -619,9 +623,9 @@ `:` operand-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.LogicalNotEqual %0, %1 : i1 %2 = spv.LogicalNotEqual %0, %1 : vector<4xi1> ``` @@ -639,11 +643,11 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 must be the same as Result Type. + The type of Operand 1 must be the same as Result Type. - The type of Operand 2 must be the same as Result Type. + The type of Operand 2 must be the same as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form @@ -652,9 +656,9 @@ `:` operand-type ``` - For example: + Example: - ``` + ```mlir %2 = spv.LogicalOr %0, %1 : i1 %2 = spv.LogicalOr %0, %1 : vector<4xi1> ``` @@ -673,22 +677,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` sgreater-than-op ::= ssa-id `=` `spv.SGreaterThan` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.SGreaterThan %0, %1 : i32 %5 = spv.SGreaterThan %2, %3 : vector<4xi32> @@ -707,22 +713,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` sgreater-than-equal-op ::= ssa-id `=` `spv.SGreaterThanEqual` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.SGreaterThanEqual %0, %1 : i32 %5 = spv.SGreaterThanEqual %2, %3 : vector<4xi32> @@ -740,22 +748,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` sless-than-op ::= ssa-id `=` `spv.SLessThan` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.SLessThan %0, %1 : i32 %5 = spv.SLessThan %2, %3 : vector<4xi32> @@ -774,22 +784,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` sless-than-equal-op ::= ssa-id `=` `spv.SLessThanEqual` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.SLessThanEqual %0, %1 : i32 %5 = spv.SLessThanEqual %2, %3 : vector<4xi32> @@ -809,7 +821,7 @@ let description = [{ Before version 1.4, Result Type must be a pointer, scalar, or vector. - The types of Object 1 and Object 2 must be the same as Result Type. + The types of Object 1 and Object 2 must be the same as Result Type. Condition must be a scalar or vector of Boolean type. @@ -822,22 +834,9 @@ component in the result is taken from Object 1, otherwise it is taken from Object 2. - ### Custom assembly form - - ``` - scalar-type ::= integer-type | float-type | boolean-type - select-object-type ::= scalar-type - | `vector<` integer-literal `x` scalar-type `>` - | pointer-type - select-condition-type ::= boolean-type - | `vector<` integer-literal `x` boolean-type `>` - select-op ::= ssa-id `=` `spv.Select` ssa-use, ssa-use, ssa-use - `:` select-condition-type `,` select-object-type - ``` - - For example: + Example: - ``` + ```mlir %3 = spv.Select %0, %1, %2 : i1, f32 %3 = spv.Select %0, %1, %2 : i1, vector<3xi32> %3 = spv.Select %0, %1, %2 : vector<3xi1>, vector<3xf32> @@ -873,22 +872,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` ugreater-than-op ::= ssa-id `=` `spv.UGreaterThan` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.UGreaterThan %0, %1 : i32 %5 = spv.UGreaterThan %2, %3 : vector<4xi32> @@ -907,22 +908,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` ugreater-than-equal-op ::= ssa-id `=` `spv.UGreaterThanEqual` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.UGreaterThanEqual %0, %1 : i32 %5 = spv.UGreaterThanEqual %2, %3 : vector<4xi32> @@ -940,22 +943,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` uless-than-op ::= ssa-id `=` `spv.ULessThan` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.ULessThan %0, %1 : i32 %5 = spv.ULessThan %2, %3 : vector<4xi32> @@ -975,22 +980,24 @@ let description = [{ Result Type must be a scalar or vector of Boolean type. - The type of Operand 1 and Operand 2 must be a scalar or vector of + The type of Operand 1 and Operand 2 must be a scalar or vector of integer type. They must have the same component width, and they must have the same number of components as Result Type. - Results are computed per component. + Results are computed per component. ### Custom assembly form + ``` integer-scalar-vector-type ::= integer-type | `vector<` integer-literal `x` integer-type `>` uless-than-equal-op ::= ssa-id `=` `spv.ULessThanEqual` ssa-use, ssa-use `:` integer-scalar-vector-type ``` - For example: - ``` + Example: + + ```mlir %4 = spv.ULessThanEqual %0, %1 : i32 %5 = spv.ULessThanEqual %2, %3 : vector<4xi32> diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td @@ -67,17 +67,9 @@ Predicate must be a Boolean type. - ### Custom assembly form - - ``` - scope ::= `"Workgroup"` | `"Subgroup"` - non-uniform-ballot-op ::= ssa-id `=` `spv.GroupNonUniformBallot` scope - ssa-use `:` `vector` `<` 4 `x` `integer-type` `>` - ``` - - For example: + Example: - ``` + ```mlir %0 = spv.GroupNonUniformBallot "SubGroup" %predicate : vector<4xi32> ``` }]; @@ -116,17 +108,9 @@ Execution must be Workgroup or Subgroup Scope. - ### Custom assembly form - - ``` - scope ::= `"Workgroup"` | `"Subgroup"` - non-uniform-elect-op ::= ssa-id `=` `spv.GroupNonUniformElect` scope - `:` `i1` - ``` - - For example: + Example: - ``` + ```mlir %0 = spv.GroupNonUniformElect : i1 ``` }]; @@ -170,7 +154,7 @@ The identity I for Operation is 0. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. The method used to + The type of Value must be the same as Result Type. The method used to perform the group operation on the contributed Value(s) from active invocations is implementation defined. @@ -192,9 +176,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : f32 %vector = ... : vector<4xf32> @@ -221,7 +205,7 @@ The identity I for Operation is -INF. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. The method used to + The type of Value must be the same as Result Type. The method used to perform the group operation on the contributed Value(s) from active invocations is implementation defined. From the set of Value(s) provided by active invocations within a subgroup, if for any two Values one of @@ -246,9 +230,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : f32 %vector = ... : vector<4xf32> @@ -275,7 +259,7 @@ The identity I for Operation is +INF. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. The method used to + The type of Value must be the same as Result Type. The method used to perform the group operation on the contributed Value(s) from active invocations is implementation defined. From the set of Value(s) provided by active invocations within a subgroup, if for any two Values one of @@ -300,9 +284,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : f32 %vector = ... : vector<4xf32> @@ -329,7 +313,7 @@ The identity I for Operation is 1. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. The method used to + The type of Value must be the same as Result Type. The method used to perform the group operation on the contributed Value(s) from active invocations is implementation defined. @@ -351,9 +335,9 @@ `:` float-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : f32 %vector = ... : vector<4xf32> @@ -380,7 +364,7 @@ The identity I for Operation is 0. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. + The type of Value must be the same as Result Type. ClusterSize is the size of cluster to use. ClusterSize must be a scalar of integer type, whose Signedness operand is 0. ClusterSize must come @@ -400,9 +384,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : i32 %vector = ... : vector<4xi32> @@ -429,7 +413,7 @@ The identity I for Operation is 1. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. + The type of Value must be the same as Result Type. ClusterSize is the size of cluster to use. ClusterSize must be a scalar of integer type, whose Signedness operand is 0. ClusterSize must come @@ -449,9 +433,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : i32 %vector = ... : vector<4xi32> @@ -478,7 +462,7 @@ The identity I for Operation is INT_MIN. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. + The type of Value must be the same as Result Type. ClusterSize is the size of cluster to use. ClusterSize must be a scalar of integer type, whose Signedness operand is 0. ClusterSize must come @@ -498,9 +482,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : i32 %vector = ... : vector<4xi32> @@ -527,7 +511,7 @@ The identity I for Operation is INT_MAX. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. + The type of Value must be the same as Result Type. ClusterSize is the size of cluster to use. ClusterSize must be a scalar of integer type, whose Signedness operand is 0. ClusterSize must come @@ -547,9 +531,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : i32 %vector = ... : vector<4xi32> @@ -577,7 +561,7 @@ The identity I for Operation is 0. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. + The type of Value must be the same as Result Type. ClusterSize is the size of cluster to use. ClusterSize must be a scalar of integer type, whose Signedness operand is 0. ClusterSize must come @@ -597,9 +581,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : i32 %vector = ... : vector<4xi32> @@ -627,7 +611,7 @@ The identity I for Operation is UINT_MAX. If Operation is ClusteredReduce, ClusterSize must be specified. - The type of Value must be the same as Result Type. + The type of Value must be the same as Result Type. ClusterSize is the size of cluster to use. ClusterSize must be a scalar of integer type, whose Signedness operand is 0. ClusterSize must come @@ -647,9 +631,9 @@ `:` integer-scalar-vector-type ``` - For example: + Example: - ``` + ```mlir %four = spv.constant 4 : i32 %scalar = ... : i32 %vector = ... : vector<4xi32> diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td @@ -59,7 +59,7 @@ result, and so on. Once any non-composite type is reached, there must be no remaining (unused) indexes. - Each index in Indexes + Each index in Indexes: - must be a scalar integer type, @@ -68,15 +68,16 @@ - must be an OpConstant when indexing into a structure. ### Custom assembly form + ``` access-chain-op ::= ssa-id `=` `spv.AccessChain` ssa-use `[` ssa-use (',' ssa-use)* `]` `:` pointer-type ``` - For example: + Example: - ``` + ```mlir %0 = "spv.constant"() { value = 1: i32} : () -> i32 %1 = spv.Variable : !spv.ptr>, Function> %2 = spv.AccessChain %1[%0] : !spv.ptr>, Function> @@ -134,19 +135,9 @@ OpControlBarrier will be visible to any other invocation after return from that OpControlBarrier. - ### Custom assembly form - - ``` - scope ::= `"CrossDevice"` | `"Device"` | `"Workgroup"` | ... - - memory-semantics ::= `"None"` | `"Acquire"` | "Release"` | ... - - control-barrier-op ::= `spv.ControlBarrier` scope, scope, memory-semantics - ``` - - For example: + Example: - ``` + ```mlir spv.ControlBarrier "Workgroup", "Device", "Acquire|UniformMemory" ``` @@ -194,9 +185,9 @@ (integer-literal (`, ` integer-literal)* )? ``` - For example: + Example: - ``` + ```mlir spv.ExecutionMode @foo "ContractionOff" spv.ExecutionMode @bar "LocalSizeHint", 3, 4, 5 ``` @@ -247,9 +238,9 @@ (`[` memory-access `]`)? ` : ` spirv-element-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.Variable : !spv.ptr %1 = spv.Load "Function" %0 : f32 %2 = spv.Load "Function" %0 ["Volatile"] : f32 @@ -296,19 +287,9 @@ To execute both a memory barrier and a control barrier, see OpControlBarrier. - ### Custom assembly form - - ``` - scope ::= `"CrossDevice"` | `"Device"` | `"Workgroup"` | ... - - memory-semantics ::= `"None"` | `"Acquire"` | `"Release"` | ... - - memory-barrier-op ::= `spv.MemoryBarrier` scope, memory-semantics - ``` + Example: - For example: - - ``` + ```mlir spv.MemoryBarrier "Device", "Acquire|UniformMemory" ``` @@ -350,9 +331,9 @@ (`[` memory-access `]`)? `:` spirv-element-type ``` - For example: + Example: - ``` + ```mlir %0 = spv.Variable : !spv.ptr %1 = spv.FMul ... : f32 spv.Store "Function" %0, %1 : f32 @@ -391,15 +372,9 @@ bit pattern or abstract value resulting in possibly different concrete, abstract, or opaque values. - ### Custom assembly form - - ``` - undef-op ::= `spv.undef` `:` spirv-type - ``` + Example: - For example: - - ``` + ```mlir %0 = spv.undef : f32 %1 = spv.undef : !spv.struct>> ``` @@ -454,9 +429,9 @@ descriptor set and binding number. `built_in` specifies SPIR-V BuiltIn decoration associated with the op. - For example: + Example: - ``` + ```mlir %0 = spv.constant ... %1 = spv.Variable : !spv.ptr diff --git a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td --- a/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td +++ b/mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td @@ -33,16 +33,9 @@ type, this op returns a pointer type as well, and the type is the same as the variable referenced. - ### Custom assembly form - - ``` - spv-address-of-op ::= ssa-id `=` `spv._address_of` symbol-ref-id - `:` spirv-pointer-type - ``` - - For example: + Example: - ``` + ```mlir %0 = spv._address_of @global_var : !spv.ptr ``` }]; @@ -93,9 +86,9 @@ (`:` spirv-type)? ``` - For example: + Example: - ``` + ```mlir %0 = spv.constant true %1 = spv.constant dense<[2, 3]> : vector<2xf32> %2 = spv.constant [dense<3.0> : vector<2xf32>] : !spv.array<1xvector<2xf32>> @@ -169,9 +162,9 @@ symbol-reference (`, ` symbol-reference)* ``` - For example: + Example: - ``` + ```mlir spv.EntryPoint "GLCompute" @foo spv.EntryPoint "Kernel" @foo, @var1, @var2 @@ -222,9 +215,9 @@ spv-function-control region ``` - For example: + Example: - ``` + ```mlir spv.func @foo() -> () "None" { ... } spv.func @bar() -> () "Inline|Pure" { ... } ``` @@ -313,9 +306,9 @@ descriptor set and binding number. `built_in` specifies SPIR-V BuiltIn decoration associated with the op. - For example: + Example: - ``` + ```mlir spv.globalVariable @var0 : !spv.ptr @var0 spv.globalVariable @var1 initializer(@var0) : !spv.ptr spv.globalVariable @var2 bind(1, 2) : !spv.ptr @@ -390,9 +383,9 @@ region ``` - For example: + Example: - ``` + ```mlir spv.module Logical GLSL450 {} spv.module Logical Vulkan @@ -477,16 +470,9 @@ for modelling purpose in the SPIR-V dialect. This op's return type is the same as the specialization constant. - ### Custom assembly form + Example: - ``` - spv-reference-of-op ::= ssa-id `=` `spv._reference_of` symbol-ref-id - `:` spirv-scalar-type - ``` - - For example: - - ``` + ```mlir %0 = spv._reference_of @spec_const : f32 ``` }]; @@ -533,9 +519,9 @@ where `spec_id` specifies the SPIR-V SpecId decoration associated with the op. - For example: + Example: - ``` + ```mlir spv.specConstant @spec_const1 = true spv.specConstant @spec_const2 spec_id(5) = 42 : i32 ```