[Mlir-commits] [mlir] [mlir][spirv] Add definition for GL Pack/UnpackHalf2x16 (PR #143889)

Igor Wodiany llvmlistbot at llvm.org
Thu Jun 12 08:10:15 PDT 2025


================
@@ -1317,4 +1317,88 @@ def SPIRV_GLFractOp : SPIRV_GLUnaryArithmeticOp<"Fract", 10, SPIRV_Float> {
   }];
 }
 
+// -----
+
+def SPIRV_GLPackHalf2x16Op : SPIRV_GLOp<"PackHalf2x16", 58, [Pure]> {
+  let summary = "Pack two-component vector of 32-bit floats into a 32-bit integer";
+
+  let description = [{
+    Result is the unsigned integer obtained by converting the components of a
+    two-component floating-point vector to the 16-bit OpTypeFloat, and then packing
+    these two 16-bit integers into a 32-bit unsigned integer. The first vector
----------------
IgWod-IMG wrote:

I agree, I did some digging, and it seems that at least with respect to the rounding mode its somehow intentional: https://github.com/KhronosGroup/Vulkan-Docs/issues/1825. Looking at the Vulkan spec itself, it gives a bit more information: https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#spirvenv-op-prec:

> <html><body>
<!--StartFragment-->
packHalf2x16 | Correctly rounded with implementation defined rounding mode.
-- | --
<!--EndFragment-->
</body>
</html>

https://github.com/llvm/llvm-project/pull/143889


More information about the Mlir-commits mailing list