diff --git a/mlir/docs/SPIRVToLLVMDialectConversion.md b/mlir/docs/SPIRVToLLVMDialectConversion.md --- a/mlir/docs/SPIRVToLLVMDialectConversion.md +++ b/mlir/docs/SPIRVToLLVMDialectConversion.md @@ -368,18 +368,35 @@ ### `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 + struct { + int32_t executionMode; + int32_t values[]; // optional 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 +621,10 @@ 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 +632,20 @@ * 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