Mesa (main): pan/bi: Track instruction size in opcode table

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 15 20:41:30 UTC 2021


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jun 10 20:08:18 2021 -0400

pan/bi: Track instruction size in opcode table

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

---

 src/panfrost/bifrost/bi_opcodes.c.py | 10 ++++++----
 src/panfrost/bifrost/bi_opcodes.h.py | 12 ++++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/panfrost/bifrost/bi_opcodes.c.py b/src/panfrost/bifrost/bi_opcodes.c.py
index d0cda112dcd..cbe0ae458a2 100644
--- a/src/panfrost/bifrost/bi_opcodes.c.py
+++ b/src/panfrost/bifrost/bi_opcodes.c.py
@@ -29,6 +29,7 @@ struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = {
 % for opcode in sorted(mnemonics):
     <%
         add = instructions["+" + opcode][0][1] if "+" + opcode in instructions else None
+        size = typesize(opcode)
         message = add["message"].upper() if add else "NONE"
         sr_count = add["staging_count"].upper() if add else "0"
         sr_read = int(add["staging"] in ["r", "rw"] if add else False)
@@ -46,9 +47,10 @@ struct bi_op_props bi_opcode_props[BI_NUM_OPCODES] = {
         m_not = hasmod(mods, 'not1')
     %>
     [BI_OPCODE_${opcode.replace('.', '_').upper()}] = {
-        "${opcode}", BIFROST_MESSAGE_${message}, BI_SR_COUNT_${sr_count},
-        ${sr_read}, ${sr_write}, ${last}, ${branch}, ${table}, ${has_fma}, ${has_add},
-        ${clamp}, ${not_result}, ${abs}, ${neg}, ${m_not},
+        "${opcode}", BIFROST_MESSAGE_${message}, BI_SIZE_${size},
+        BI_SR_COUNT_${sr_count}, ${sr_read}, ${sr_write}, ${last}, ${branch},
+        ${table}, ${has_fma}, ${has_add}, ${clamp}, ${not_result}, ${abs},
+        ${neg}, ${m_not},
     },
 % endfor
 };"""
@@ -61,4 +63,4 @@ instructions = parse_instructions(sys.argv[1], include_pseudo = True)
 ir_instructions = partition_mnemonics(instructions)
 mnemonics = set(x[1:] for x in instructions.keys())
 
-print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, mnemonics = mnemonics, instructions = instructions))
+print(Template(COPYRIGHT + TEMPLATE).render(ops = ir_instructions, mnemonics = mnemonics, instructions = instructions, typesize = typesize))
diff --git a/src/panfrost/bifrost/bi_opcodes.h.py b/src/panfrost/bifrost/bi_opcodes.h.py
index 9459eda894c..2c3f915baf9 100644
--- a/src/panfrost/bifrost/bi_opcodes.h.py
+++ b/src/panfrost/bifrost/bi_opcodes.h.py
@@ -64,11 +64,23 @@ enum bi_sr_count {
     BI_SR_COUNT_SR_COUNT = 7
 };
 
+enum bi_size {
+   BI_SIZE_8 = 0,
+   BI_SIZE_16,
+   BI_SIZE_24,
+   BI_SIZE_32,
+   BI_SIZE_48,
+   BI_SIZE_64,
+   BI_SIZE_96,
+   BI_SIZE_128,
+};
+
 /* Description of an opcode in the IR */
 struct bi_op_props {
         const char *name;
 
         enum bifrost_message_type message : 4;
+        enum bi_size size : 3;
         enum bi_sr_count sr_count : 3;
         bool sr_read : 1;
         bool sr_write : 1;



More information about the mesa-commit mailing list