rusticl/kernel: preserve fp16 denorms to fix vload/vstore_half
authorKarol Herbst <kherbst@redhat.com>
Wed, 12 Oct 2022 21:43:22 +0000 (23:43 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 13 Oct 2022 13:13:54 +0000 (13:13 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19041>

src/gallium/frontends/rusticl/core/kernel.rs
src/gallium/frontends/rusticl/mesa/compiler/nir.rs

index 336678b..1e34a7f 100644 (file)
@@ -623,6 +623,11 @@ fn convert_spirv_to_nir(
         } else {
             let mut nir = p.to_nir(name, d);
 
+            /* this is a hack until we support fp16 properly and check for denorms inside
+             * vstore/vload_half
+             */
+            nir.preserve_fp16_denorms();
+
             lower_and_optimize_nir_pre_inputs(d, &mut nir, &d.lib_clc);
             let mut args = KernelArg::from_spirv_nir(&args, &mut nir);
             let internal_args = lower_and_optimize_nir_late(d, &mut nir, &mut args);
index c72132b..90bf7c9 100644 (file)
@@ -254,6 +254,13 @@ impl NirShader {
         }
     }
 
+    pub fn preserve_fp16_denorms(&mut self) {
+        unsafe {
+            self.nir.as_mut().info.float_controls_execution_mode |=
+                float_controls::FLOAT_CONTROLS_DENORM_PRESERVE_FP16 as u16;
+        }
+    }
+
     pub fn add_var(
         &self,
         mode: nir_variable_mode,