[llvm-branch-commits] [mlir] f6c7ebe - [MLIR][SPIRVToLLVM] Updated documentation on entry points and not supported ops
George Mitenkov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 21 00:50:17 PST 2020
Author: George Mitenkov
Date: 2020-12-21T11:20:40+03:00
New Revision: f6c7ebe76ac5df175050a558e767a68abee07425
URL: https://github.com/llvm/llvm-project/commit/f6c7ebe76ac5df175050a558e767a68abee07425
DIFF: https://github.com/llvm/llvm-project/commit/f6c7ebe76ac5df175050a558e767a68abee07425.diff
LOG: [MLIR][SPIRVToLLVM] Updated documentation on entry points and not supported ops
This patch addresses two issues:
1. Not supported ops are updated to pick up the changes in the
SPIR-V dialect.
2. Conversion on `spv.ExecutionMode` is updated.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D91881
Added:
Modified:
mlir/docs/SPIRVToLLVMDialectConversion.md
Removed:
################################################################################
diff --git a/mlir/docs/SPIRVToLLVMDialectConversion.md b/mlir/docs/SPIRVToLLVMDialectConversion.md
index c42a529beed1..3aa4d0fa43a1 100644
--- a/mlir/docs/SPIRVToLLVMDialectConversion.md
+++ b/mlir/docs/SPIRVToLLVMDialectConversion.md
@@ -368,18 +368,37 @@ non-vector | `spv.CompositeInsert` | `llvm.insertvalue`
### `spv.EntryPoint` and `spv.ExecutionMode`
-**Note: these conversions are likely to be changed in the future**
-
First of all, it is important to note that there is no direct representation of
-entry points in LLVM. At the moment, we choose to **remove these ops**, assuming
-that the module generated from SPIR-V has no other internal functions (This
-assumption is actually made in [`mlir-spirv-cpu-runner`](#`mlir-spirv-cpu-runner`)).
+entry points in LLVM. At the moment, we use the following approach:
+
+* `spv.EntryPoint` is simply removed.
+
+* In contrast, `spv.ExecutionMode` may contain important information about the
+ entry point. For example, `LocalSize` provides information about the
+ work-group size that can be reused.
-However, these ops can be used to see which functions in the module are entry
-point functions. `spv.ExecutionMode` also carries the metadata associated with
-the entry point such as `LocalSize`, which indicates the workgroup size in the
-x, y, and z dimensions. It will be useful to represent this on the LLVM side
-(TODO).
+ In order to preserve this inforamtion, `spv.ExecutionMode` is converted to
+ a struct global variable that stores the execution mode id and any variables
+ associated with it. In C, the struct has the structure shown below.
+
+ ```C
+ // No values are associated // There are values that are associated
+ // with this entry point. // with this entry point.
+ struct { struct {
+ int32_t executionMode; int32_t executionMode;
+ }; int32_t values[];
+ };
+ ```
+
+ ```mlir
+ // spv.ExecutionMode @empty "ContractionOff"
+ llvm.mlir.global external constant @{{.*}}() : !llvm.struct<(i32)> {
+ %0 = llvm.mlir.undef : !llvm.struct<(i32)>
+ %1 = llvm.mlir.constant(31 : i32) : !llvm.i32
+ %ret = llvm.insertvalue %1, %0[0 : i32] : !llvm.struct<(i32)>
+ llvm.return %ret : !llvm.struct<(i32)>
+ }
+ ```
### Logical ops
@@ -604,9 +623,10 @@ cover all possible corner cases.
There is no support of the following ops:
-* All Atomic ops
+* All atomic ops
+* All group ops
* All matrix ops
-* All GroupNonUniform ops
+* All OCL ops
As well as:
@@ -614,15 +634,20 @@ As well as:
* spv.ControlBarrier
* spv.CopyMemory
* spv.FMod
+* spv.GLSL.Acos
+* spv.GLSL.Asin
+* spv.GLSL.Atan
+* spv.GLSL.Cosh
+* spv.GLSL.FSign
* spv.GLSL.SAbs
+* spv.GLSL.Sinh
* spv.GLSL.SSign
-* spv.GLSL.FSign
* spv.MemoryBarrier
* spv.mlir.referenceof
* spv.SMod
* spv.specConstant
-* spv.SubgroupBallotKHR
* spv.Unreachable
+* spv.VectorExtractDynamic
## Control flow conversion
More information about the llvm-branch-commits
mailing list