summarylogtreecommitdiffstats
path: root/0006-spirv-create-e4m3fn-type.patch
blob: 70f140141e9d1df098b850f7b1baa303c26dad78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 6fbfe20c4693cd2457d6147bd3a99141f38689cf Mon Sep 17 00:00:00 2001
From: Georg Lehmann <dadschoorse@gmail.com>
Date: Wed, 9 Apr 2025 13:44:18 +0200
Subject: [PATCH 06/13] spirv: create e4m3fn type

---
 src/compiler/spirv/spirv_to_nir.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 05ccce54db6..7b3275fd493 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -1890,10 +1890,14 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
       int32_t encoding = count > 3 ? w[3] : -1;
       switch (encoding) {
       case -1:
-         /* No encoding specified, it is a regular FP. */
-         vtn_fail_if(bit_size != 16 && bit_size != 32 && bit_size != 64,
+         if (bit_size == 8) {
+           val->type->type = glsl_e4m3fn_t_type();
+         } else {
+            /* No encoding specified, it is a regular FP. */
+            vtn_fail_if(bit_size != 16 && bit_size != 32 && bit_size != 64,
                      "Invalid float bit size: %u", bit_size);
-         val->type->type = glsl_floatN_t_type(bit_size);
+            val->type->type = glsl_floatN_t_type(bit_size);
+         }
          break;
 
       case SpvFPEncodingBFloat16KHR:
-- 
2.49.0