@@ -368,18 +368,37 @@ non-vector | `spv.CompositeInsert` | `llvm.insertvalue`
368
368
369
369
### ` spv.EntryPoint ` and ` spv.ExecutionMode `
370
370
371
- ** Note: these conversions are likely to be changed in the future**
372
-
373
371
First of all, it is important to note that there is no direct representation of
374
- entry points in LLVM. At the moment, we choose to ** remove these ops** , assuming
375
- that the module generated from SPIR-V has no other internal functions (This
376
- assumption is actually made in [ ` mlir-spirv-cpu-runner ` ] ( #`mlir-spirv-cpu-runner` ) ).
372
+ entry points in LLVM. At the moment, we use the following approach:
373
+
374
+ * ` spv.EntryPoint ` is simply removed.
375
+
376
+ * In contrast, ` spv.ExecutionMode ` may contain important information about the
377
+ entry point. For example, ` LocalSize ` provides information about the
378
+ work-group size that can be reused.
377
379
378
- However, these ops can be used to see which functions in the module are entry
379
- point functions. ` spv.ExecutionMode ` also carries the metadata associated with
380
- the entry point such as ` LocalSize ` , which indicates the workgroup size in the
381
- x, y, and z dimensions. It will be useful to represent this on the LLVM side
382
- (TODO).
380
+ In order to preserve this inforamtion, ` spv.ExecutionMode ` is converted to
381
+ a struct global variable that stores the execution mode id and any variables
382
+ associated with it. In C, the struct has the structure shown below.
383
+
384
+ ``` C
385
+ // No values are associated // There are values that are associated
386
+ // with this entry point. // with this entry point.
387
+ struct { struct {
388
+ int32_t executionMode; int32_t executionMode;
389
+ }; int32_t values[ ] ;
390
+ };
391
+ ```
392
+
393
+ ```mlir
394
+ // spv.ExecutionMode @empty "ContractionOff"
395
+ llvm.mlir.global external constant @{{.*}}() : !llvm.struct<(i32)> {
396
+ %0 = llvm.mlir.undef : !llvm.struct<(i32)>
397
+ %1 = llvm.mlir.constant(31 : i32) : !llvm.i32
398
+ %ret = llvm.insertvalue %1, %0[0 : i32] : !llvm.struct<(i32)>
399
+ llvm.return %ret : !llvm.struct<(i32)>
400
+ }
401
+ ```
383
402
384
403
### Logical ops
385
404
@@ -604,25 +623,31 @@ cover all possible corner cases.
604
623
605
624
There is no support of the following ops:
606
625
607
- * All Atomic ops
626
+ * All atomic ops
627
+ * All group ops
608
628
* All matrix ops
609
- * All GroupNonUniform ops
629
+ * All OCL ops
610
630
611
631
As well as:
612
632
613
633
* spv.CompositeConstruct
614
634
* spv.ControlBarrier
615
635
* spv.CopyMemory
616
636
* spv.FMod
637
+ * spv.GLSL.Acos
638
+ * spv.GLSL.Asin
639
+ * spv.GLSL.Atan
640
+ * spv.GLSL.Cosh
641
+ * spv.GLSL.FSign
617
642
* spv.GLSL.SAbs
643
+ * spv.GLSL.Sinh
618
644
* spv.GLSL.SSign
619
- * spv.GLSL.FSign
620
645
* spv.MemoryBarrier
621
646
* spv.mlir.referenceof
622
647
* spv.SMod
623
648
* spv.specConstant
624
- * spv.SubgroupBallotKHR
625
649
* spv.Unreachable
650
+ * spv.VectorExtractDynamic
626
651
627
652
## Control flow conversion
628
653
0 commit comments