Mesa (main): pan/va: Add more transcendental operations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 15:33:06 UTC 2022


Module: Mesa
Branch: main
Commit: 822dfb76de84461e83101601b217bc4a0174f480
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=822dfb76de84461e83101601b217bc4a0174f480

Author: Icecream95 <ixn at disroot.org>
Date:   Sat Mar 26 10:34:44 2022 +1300

pan/va: Add more transcendental operations

TODO: Make the secondary opcode field wider so that FATAN_ASSIST can
be split into two instructions

[Alyssa: Fixes to the hardware behaviour.]

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15588>

---

 src/panfrost/bifrost/valhall/ISA.xml      | 22 ++++++++++++++++++----
 src/panfrost/bifrost/valhall/valhall.c.py |  1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/bifrost/valhall/ISA.xml b/src/panfrost/bifrost/valhall/ISA.xml
index f6954391f9c..36d348453ec 100644
--- a/src/panfrost/bifrost/valhall/ISA.xml
+++ b/src/panfrost/bifrost/valhall/ISA.xml
@@ -1677,8 +1677,10 @@
     <desc>
       Performs a given special function. The floating-point reciprocal (`FRCP`)
       and reciprocal square root (`FRSQ`) instructions may be freely used as-is.
-      The logarithm instruction (`FLOGD.f32`) requires an argument reduction. See the
-      transcendentals section for more information.
+      The logarithm instruction (`FLOGD.f32`) requires an argument
+      reduction. See the transcendentals section for more information. Like the
+      Bifrost op, `FRSQ_APPROX.f32` does an implicit `FREXPM.f32.sqrt` on the
+      source.
     </desc>
     <src float="true" swizzle="true" absneg="true"/>
   </group>
@@ -1689,8 +1691,9 @@
     <ins name="FSINCOS_OFFSET.u6" opcode2="6"/>
     <ins name="FEXP_TABLE.u4" opcode2="13"/>
     <desc>
-      Performs a given special function.The trigonometric tables (`FSIN_TABLE.u6` and `FCOS_TABLE.u6`) are crude,
-      requiring both an argument reduction and postprocessing.
+      Performs a given special function. The trigonometric tables
+      (`FSIN_TABLE.u6` and `FCOS_TABLE.u6`) are crude, requiring both an
+      argument reduction and postprocessing.
     </desc>
     <src/>
   </group>
@@ -1767,6 +1770,17 @@
     <src absneg="true">B</src>
   </ins>
 
+  <ins name="FATAN_ASSIST.f32" title="ATAN calculation helper" dests="1" opcode="0xA4" opcode2="14" unit="SFU">
+    <desc>
+      Used for `atan2()` implementation. Destination is two 16-bit
+      values (int and float) for the first form, and a single 32-bit float when
+      `.second` is set (indicating the FATAN_TABLE.f32 instruction).
+    </desc>
+    <mod name="second" start="24" size="1"/>
+    <src>A</src>
+    <src>B</src>
+  </ins>
+
   <group name="IADD" title="Integer addition" dests="1" opcode2="0" unit="CVT">
     <desc>
       $A + B$ with optional saturation.
diff --git a/src/panfrost/bifrost/valhall/valhall.c.py b/src/panfrost/bifrost/valhall/valhall.c.py
index 171359e922d..b0c9049726f 100644
--- a/src/panfrost/bifrost/valhall/valhall.c.py
+++ b/src/panfrost/bifrost/valhall/valhall.c.py
@@ -77,6 +77,7 @@ SKIP = set([
         # TODO
         "IDP.v4s8",
         "IDP.v4u8",
+        "FATAN_ASSIST.f32",
         "TEX_DUAL",
         "TODO.VAR_TEX",
     ])



More information about the mesa-commit mailing list