ir3/a7xx: implement and document unknown alias field

The UNK field encodes the table size for alias.tex: the first alias.tex
instruction uses it to indicate how many follow (i.e., it is the total
table size minus one).

Also switch from using a src to a cat7 field to store this value which
makes it a bit easier to handle.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31222>
This commit is contained in:
Job Noorman 2025-01-22 15:33:47 +01:00 committed by Marge Bot
parent af7c6f8dd5
commit dab47b55ef
3 changed files with 11 additions and 6 deletions

View file

@ -435,6 +435,7 @@ struct ir3_instruction {
unsigned g : 1; /* global */
ir3_alias_scope alias_scope;
unsigned alias_table_size_minus_one;
bool alias_type_float;
} cat7;
/* for meta-instructions, just used to hold extra data

View file

@ -1459,6 +1459,8 @@ cat7_alias_float_type: T_TYPE_F16
cat7_alias_type: cat7_alias_int_type
| cat7_alias_float_type { instr->cat7.alias_type_float = true; }
cat7_alias_table_size_minus_one: T_INT { instr->cat7.alias_table_size_minus_one = $1; }
cat7_instr: cat7_barrier
| cat7_data_cache
| T_OP_SLEEP { new_instr(OPC_SLEEP); }
@ -1468,9 +1470,7 @@ cat7_instr: cat7_barrier
| T_OP_UNLOCK { new_instr(OPC_UNLOCK); }
| T_OP_ALIAS {
new_instr(OPC_ALIAS);
} '.' cat7_alias_scope '.' cat7_alias_type '.' integer dst_reg ',' cat7_alias_src {
new_src(0, IR3_REG_IMMED)->uim_val = $8;
}
} '.' cat7_alias_scope '.' cat7_alias_type '.' cat7_alias_table_size_minus_one dst_reg ',' cat7_alias_src
raw_instr: T_RAW {new_instr(OPC_META_RAW)->raw.value = $1;}

View file

@ -306,10 +306,14 @@ SOFTWARE.
Notice the lack of nops between alias and the instruction
that uses it.
In this case, the size of the table is bounded (max 16 entries)
and the number of entries in the table is indicated by
the first alias instruction in the TABLE_SIZE_MINUS_ONE field.
</doc>
<gen min="700"/>
<display>
{SY}{SS}{JP}{NAME}.{SCOPE}.{TYPE}{TYPE_SIZE}.{UNK} {DST_HALF}{DST}, {SRC}
{SY}{SS}{JP}{NAME}.{SCOPE}.{TYPE}{TYPE_SIZE}.{TABLE_SIZE_MINUS_ONE} {DST_HALF}{DST}, {SRC}
</display>
<override>
@ -332,7 +336,7 @@ SOFTWARE.
<param name="TYPE"/>
</field>
<field low="32" high="39" name="DST" type="#reg-gpr"/>
<field low="40" high="43" name="UNK" type="uint"/>
<field low="40" high="43" name="TABLE_SIZE_MINUS_ONE" type="uint"/>
<field pos="44" name="SS" type="bool" display="(ss)"/>
<pattern low="45" high="46">xx</pattern>
<field pos="47" name="SCOPE_LO" type="uint"/>
@ -354,7 +358,7 @@ SOFTWARE.
<encode>
<map name="SRC">src->srcs[0]</map>
<map name="SRC_REG_TYPE">(src->srcs[0]->flags &amp; IR3_REG_CONST) ? 1 : ((src->srcs[0]->flags &amp; IR3_REG_IMMED) ? 2 : 0)</map>
<map name="UNK">extract_reg_uim(src->srcs[1])</map>
<map name="TABLE_SIZE_MINUS_ONE">src->cat7.alias_table_size_minus_one</map>
<map name="TYPE_SIZE">(src->srcs[0]->flags &amp; IR3_REG_HALF) ? 0 : 1</map>
<map name="SCOPE_LO">src->cat7.alias_scope &amp; 0x1</map>
<map name="SCOPE_HI">src->cat7.alias_scope &gt;&gt; 1</map>