From c9de3d57f70cfbbb96df8f2b124bef6d99b19098 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Mon, 2 Dec 2024 15:19:45 -0800 Subject: [PATCH] panfrost/va: add FLUSH instruction This is needed to implement FTZ for intermediate values on valhall. Signed-off-by: Benjamin Lee Reviewed-by: Mary Guillemard Part-of: --- src/panfrost/compiler/compiler.h | 9 ++++++--- src/panfrost/compiler/valhall/ISA.xml | 25 +++++++++++++++++++++++++ src/panfrost/compiler/valhall/va_pack.c | 9 +++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/panfrost/compiler/compiler.h b/src/panfrost/compiler/compiler.h index 244e5a7ce86..b4dc34c47b1 100644 --- a/src/panfrost/compiler/compiler.h +++ b/src/panfrost/compiler/compiler.h @@ -34,6 +34,7 @@ #include "util/u_worklist.h" #include "bi_opcodes.h" #include "bifrost.h" +#include "valhall_enums.h" #ifdef __cplusplus extern "C" { @@ -473,9 +474,11 @@ typedef struct { bool format; /* LEA_TEX */ struct { - enum bi_special special; /* FADD_RSCALE, FMA_RSCALE */ - enum bi_round round; /* FMA, converts, FADD, _RSCALE, etc */ - bool ftz; /* Flush-to-zero for F16_TO_F32 */ + enum bi_special special; /* FADD_RSCALE, FMA_RSCALE */ + enum bi_round round; /* FMA, converts, FADD, _RSCALE, etc */ + bool ftz; /* Flush-to-zero for F16_TO_F32 and FLUSH */ + enum va_nan_mode nan_mode; /* NaN flush mode, for FLUSH */ + bool flush_inf; /* Flush infinity to finite, for FLUSH */ }; struct { diff --git a/src/panfrost/compiler/valhall/ISA.xml b/src/panfrost/compiler/valhall/ISA.xml index 5bdecf2a8cd..18e23d02493 100644 --- a/src/panfrost/compiler/valhall/ISA.xml +++ b/src/panfrost/compiler/valhall/ISA.xml @@ -778,6 +778,16 @@ aor1 + + + Flush specific NaN values in FLUSH.f32 and FLUSH.v2f16. flush_nan flushes + all NaN values to zero. quiet_nan flushes signaling NaNs to quiet NaNs. + + none + flush_nan + quiet_nan + +