You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementation of
[SPV_KHR_float_controls2](https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html)
extension, and corresponding tests.
Some of the tests make use of `!spirv.ExecutionMode` LLVM named
metadata. This is because some SPIR-V instructions don't have a direct
equivalent in LLVM IR, so the SPIR-V Target uses different LLVM named
metadata to convey the necessary information. Below, you will find an
example from one of the newly added tests:
```
!spirv.ExecutionMode = !{!19, !20, !21, !22, !23, !24, !25, !26, !27}
!19 = !{ptr @k_float_controls_float, i32 6028, float poison, i32 131079}
!20 = !{ptr @k_float_controls_all, i32 6028, float poison, i32 131079}
!21 = !{ptr @k_float_controls_float, i32 31}
!22 = !{ptr @k_float_controls_all, i32 31}
!23 = !{ptr @k_float_controls_float, i32 4461, i32 32}
!24 = !{ptr @k_float_controls_all, i32 4461, i32 16}
!25 = !{ptr @k_float_controls_all, i32 4461, i32 32}
!26 = !{ptr @k_float_controls_all, i32 4461, i32 64}
!27 = !{ptr @k_float_controls_all, i32 4461, i32 128}
```
`!spirv.ExecutionMode` contains a list of metadata nodes, and each of
them specifies the required operands for expressing a particular
`OpExecutionMode` instruction in SPIR-V. For example, `!19 = !{ptr
@k_float_controls_float, i32 6028, float poison, i32 131079}` will be
lowered to `OpExecutionMode [[k_float_controls_float_ID]]
FPFastMathDefault [[float_type_ID]] 131079`.
---------
Co-authored-by: Dmitry Sidorov <[email protected]>
Copy file name to clipboardExpand all lines: llvm/docs/SPIRVUsage.rst
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -232,7 +232,7 @@ Below is a list of supported SPIR-V extensions, sorted alphabetically by their e
232
232
* - ``SPV_INTEL_int4``
233
233
- Adds support for 4-bit integer type, and allow this type to be used in cooperative matrices.
234
234
* - ``SPV_KHR_float_controls2``
235
-
- Adds ability to specify the floating-point environment in shaders. It can be used on whole modules and individual instructions.
235
+
- Adds execution modes and decorations to control floating-point computations in both kernels and shaders. It can be used on whole modules and individual instructions.
236
236
237
237
SPIR-V representation in LLVM IR
238
238
================================
@@ -589,3 +589,31 @@ Group and Subgroup Operations
589
589
For workgroup and subgroup operations, LLVM uses function calls to represent SPIR-V's
590
590
group-based instructions. These builtins facilitate group synchronization, data sharing,
591
591
and collective operations essential for efficient parallel computation.
592
+
593
+
SPIR-V Instructions Mapped to LLVM Metadata
594
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
595
+
Some SPIR-V instructions don't have a direct equivalent in the LLVM IR language. To
596
+
address this, the SPIR-V Target uses different specific LLVM named metadata to convey
597
+
the necessary information. The SPIR-V specification allows multiple module-scope
598
+
instructions, where as LLVM named metadata must be unique. Therefore, the encoding of
0 commit comments