nv/codegen: Implement nir_op_fquantize2f16
authorM Henning <drawoc@darkrefraction.com>
Fri, 21 Jul 2023 02:54:52 +0000 (22:54 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 1 Aug 2023 18:58:04 +0000 (18:58 +0000)
Passes most of dEQP-VK.spirv_assembly.instruction.graphics.opquantize.* but
not the too_small_* tests for some reason. (Tested on kepler.)

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24327>

src/nouveau/codegen/nv50_ir_from_nir.cpp

index e0eeaeb..b204189 100644 (file)
@@ -2838,6 +2838,14 @@ Converter::visit(nir_alu_instr *insn)
       mkOp3(OP_PERMT, TYPE_U32, newDefs[0], getSrc(&insn->src[0]), prmt, loadImm(NULL, 0));
       break;
    }
+   case nir_op_fquantize2f16: {
+      DEFAULT_CHECKS;
+      LValues &newDefs = convert(&insn->dest);
+      Value *tmp = getSSA();
+      mkCvt(OP_CVT, TYPE_F16, tmp, TYPE_F32, getSrc(&insn->src[0]))->ftz = 1;
+      mkCvt(OP_CVT, TYPE_F32, newDefs[0], TYPE_F16, tmp);
+      break;
+   }
    case nir_op_urol: {
       DEFAULT_CHECKS;
       LValues &newDefs = convert(&insn->dest);