mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 01:10:16 +01:00
asahi: Add XML for indirect dispatch
This splits up the CDM commands into their subparts, after which indirect dispatch is straightforward. Also fix the pipeline bits. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21272>
This commit is contained in:
parent
3da4838591
commit
c3b8928b84
2 changed files with 80 additions and 20 deletions
|
|
@ -779,27 +779,57 @@
|
|||
|
||||
<!-- CDM commands start -->
|
||||
<enum name="CDM Block Type">
|
||||
<value name="Compute Kernel" value="0"/>
|
||||
<value name="Header" value="0"/>
|
||||
<value name="Stream Link" value="1"/>
|
||||
<value name="Stream Terminate" value="2"/>
|
||||
<value name="Launch" value="3"/>
|
||||
</enum>
|
||||
|
||||
<!--- Command to launch a direct compute kernel -->
|
||||
<struct name="Launch" size="36">
|
||||
<enum name="CDM Mode">
|
||||
<!-- Global size + Local size -->
|
||||
<value name="Direct" value="0"/>
|
||||
|
||||
<!-- Indirect buffer + Local size. Indirect buffer contains 3x 32-bit global
|
||||
size. Used for indirect dispatch when the local size must be
|
||||
fixed (e.g. due to local memory being used) -->
|
||||
<value name="Indirect global" value="1"/>
|
||||
|
||||
<!-- Indirect buffer, containing 6x 32-bit size. Used for indirect dispatch
|
||||
when the driver wants to optimize the local size with an auxiliary
|
||||
compute kernel (requiring e.g. no local memory use) -->
|
||||
<value name="Indirect local" value="2"/>
|
||||
</enum>
|
||||
|
||||
<struct name="CDM Header" size="8">
|
||||
<field name="Uniform register count" size="3" start="1" type="uint" modifier="groups(64)"/>
|
||||
<field name="Texture state register count" size="5" start="4" type="uint" modifier="groups(8)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="Sampler states"/>
|
||||
<field name="Preshader register count" size="4" start="12" type="uint" modifier="groups(16)"/>
|
||||
<field name="Block Type" size="3" start="29" type="CDM Block Type" default="Compute Kernel"/>
|
||||
<field name="Pipeline" size="32" start="1:0" type="address"/>
|
||||
<field name="Group count X" size="32" start="2:0" type="uint"/>
|
||||
<field name="Group count Y" size="32" start="3:0" type="uint"/>
|
||||
<field name="Group count Z" size="32" start="4:0" type="uint"/>
|
||||
<field name="Local size X" size="32" start="5:0" type="uint"/>
|
||||
<field name="Local size Y" size="32" start="6:0" type="uint"/>
|
||||
<field name="Local size Z" size="32" start="7:0" type="uint"/>
|
||||
<!-- Might be its own command, block type = 3? -->
|
||||
<field name="Unk 2" size="32" start="8:0" type="hex" default="0x60000160"/>
|
||||
<field name="Mode" size="2" start="27" type="CDM Mode"/>
|
||||
<field name="Block Type" size="3" start="29" type="CDM Block Type" default="Header"/>
|
||||
<field name="Pipeline" size="26" start="1:6" type="address" modifier="shr(6)"/>
|
||||
</struct>
|
||||
|
||||
<struct name="CDM Indirect" size="8">
|
||||
<field name="Address hi" size="8" start="0" type="hex"/>
|
||||
<field name="Address lo" size="30" start="34" type="hex" modifier="shr(2)"/>
|
||||
</struct>
|
||||
|
||||
<struct name="CDM Global size" size="12">
|
||||
<field name="X" size="32" start="0:0" type="uint"/>
|
||||
<field name="Y" size="32" start="1:0" type="uint"/>
|
||||
<field name="Z" size="32" start="2:0" type="uint"/>
|
||||
</struct>
|
||||
|
||||
<struct name="CDM Local size" size="12">
|
||||
<field name="X" size="32" start="0:0" type="uint"/>
|
||||
<field name="Y" size="32" start="1:0" type="uint"/>
|
||||
<field name="Z" size="32" start="2:0" type="uint"/>
|
||||
</struct>
|
||||
|
||||
<struct name="CDM Launch" size="4">
|
||||
<field name="Unknown" size="12" start="0" type="hex" default="0x160"/>
|
||||
<field name="Block Type" size="3" start="29" type="CDM Block Type" default="Launch"/>
|
||||
</struct>
|
||||
|
||||
<struct name="CDM Stream Link" size="8">
|
||||
|
|
@ -811,7 +841,6 @@
|
|||
<struct name="CDM Stream Terminate" size="8">
|
||||
<field name="Block Type" size="3" start="29" type="CDM Block Type" default="Stream Terminate"/>
|
||||
</struct>
|
||||
|
||||
<!-- CDM commands end -->
|
||||
|
||||
<!--- The rest of this file is likely software defined by macOS kernel -->
|
||||
|
|
|
|||
|
|
@ -511,12 +511,38 @@ agxdecode_cdm(const uint8_t *map, uint64_t *link, bool verbose,
|
|||
enum agx_cdm_block_type block_type = (map[3] >> 5);
|
||||
|
||||
switch (block_type) {
|
||||
case AGX_CDM_BLOCK_TYPE_COMPUTE_KERNEL: {
|
||||
agx_unpack(agxdecode_dump_stream, map, LAUNCH, cmd);
|
||||
agxdecode_stateful(cmd.pipeline, "Pipeline", agxdecode_usc, verbose,
|
||||
&cmd.sampler_state_register_count);
|
||||
DUMP_UNPACKED(LAUNCH, cmd, "Launch\n");
|
||||
return AGX_LAUNCH_LENGTH;
|
||||
case AGX_CDM_BLOCK_TYPE_HEADER: {
|
||||
size_t length = AGX_CDM_HEADER_LENGTH;
|
||||
|
||||
#define CDM_PRINT(STRUCT_NAME, human) \
|
||||
DUMP_CL(CDM_##STRUCT_NAME, map, human); \
|
||||
map += AGX_CDM_##STRUCT_NAME##_LENGTH; \
|
||||
length += AGX_CDM_##STRUCT_NAME##_LENGTH;
|
||||
|
||||
agx_unpack(agxdecode_dump_stream, map, CDM_HEADER, hdr);
|
||||
agxdecode_stateful(hdr.pipeline, "Pipeline", agxdecode_usc, verbose,
|
||||
&hdr.sampler_state_register_count);
|
||||
DUMP_UNPACKED(CDM_HEADER, hdr, "Compute\n");
|
||||
map += AGX_CDM_HEADER_LENGTH;
|
||||
|
||||
switch (hdr.mode) {
|
||||
case AGX_CDM_MODE_DIRECT:
|
||||
CDM_PRINT(GLOBAL_SIZE, "Global size");
|
||||
CDM_PRINT(LOCAL_SIZE, "Local size");
|
||||
break;
|
||||
case AGX_CDM_MODE_INDIRECT_GLOBAL:
|
||||
CDM_PRINT(INDIRECT, "Indirect buffer");
|
||||
CDM_PRINT(LOCAL_SIZE, "Local size");
|
||||
break;
|
||||
case AGX_CDM_MODE_INDIRECT_LOCAL:
|
||||
CDM_PRINT(INDIRECT, "Indirect buffer");
|
||||
break;
|
||||
default:
|
||||
fprintf(agxdecode_dump_stream, "Unknown CDM mode: %u\n", hdr.mode);
|
||||
break;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
case AGX_CDM_BLOCK_TYPE_STREAM_LINK: {
|
||||
|
|
@ -531,6 +557,11 @@ agxdecode_cdm(const uint8_t *map, uint64_t *link, bool verbose,
|
|||
return STATE_DONE;
|
||||
}
|
||||
|
||||
case AGX_CDM_BLOCK_TYPE_LAUNCH: {
|
||||
DUMP_CL(CDM_LAUNCH, map, "Launch");
|
||||
return AGX_CDM_LAUNCH_LENGTH;
|
||||
}
|
||||
|
||||
default:
|
||||
fprintf(agxdecode_dump_stream, "Unknown CDM block type: %u\n",
|
||||
block_type);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue