mesa/src/amd/compiler/tests
Georg Lehmann 64cae5c48d aco: form mixed MTBUF/MUBUF clauses
This should be one clause (all of the instructions load from the same vertex buffer)

s_clause 0x2                                                ; bfa10002
tbuffer_load_format_xyzw v[8:11], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UNORM] idxen offset:36 ; e9c32024 80010805
tbuffer_load_format_xyzw v[12:15], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UNORM] idxen offset:16 ; e9c32010 80010c05
tbuffer_load_format_xyzw v[16:19], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UNORM] idxen offset:12 ; e9c3200c 80011005
s_clause 0x2                                                ; bfa10002
buffer_load_dwordx3 v[20:22], v5, s[4:7], 0 idxen           ; e03c2000 80011405
buffer_load_dwordx3 v[23:25], v5, s[4:7], 0 idxen offset:20 ; e03c2014 80011705
buffer_load_dwordx4 v[28:31], v5, s[4:7], 0 idxen offset:48 ; e0382030 80011c05
tbuffer_load_format_xy v[0:1], v5, s[4:7], 0 format:[BUF_FMT_8_8_UNORM] idxen offset:32 ; e8712020 80010005

Foz-DB Navi21:
Totals from 5624 (7.08% of 79395) affected shaders:
MaxWaves: 149894 -> 149898 (+0.00%)
Instrs: 3032697 -> 3034853 (+0.07%); split: -0.05%, +0.12%
CodeSize: 15907852 -> 15915752 (+0.05%); split: -0.05%, +0.10%
VGPRs: 216248 -> 216144 (-0.05%)
Latency: 10955137 -> 11008760 (+0.49%); split: -0.22%, +0.70%
InvThroughput: 2032857 -> 2033916 (+0.05%); split: -0.03%, +0.08%
VClause: 50120 -> 41778 (-16.64%); split: -16.66%, +0.02%
SClause: 62034 -> 62004 (-0.05%); split: -0.33%, +0.29%
Copies: 253836 -> 254505 (+0.26%); split: -0.17%, +0.43%
VALU: 1621606 -> 1622274 (+0.04%); split: -0.03%, +0.07%
SALU: 653251 -> 653252 (+0.00%)

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34379>
2025-04-08 09:22:04 +00:00
..
check_output.py aco/tests: fix skip_lines=True with remaining characters in matches 2025-01-08 15:28:37 +00:00
framework.h aco/tests: support GFX12 2024-05-14 20:50:27 +00:00
glsl_scraper.py meson: remove --depfile for aco_tests 2024-05-30 09:44:52 +00:00
helpers.cpp aco/tests: use GFX1201 instead of GFX1200 2025-03-11 06:50:49 +00:00
helpers.h aco: check for SDWA before applying extract to lshl/cvt_f32 2024-11-06 19:31:20 +00:00
main.cpp aco/tests: don't assume constructor order 2024-04-16 15:46:19 +00:00
meson.build build: pass licensing information in SPDX form 2024-06-29 12:42:49 -07:00
README.md
test_assembler.cpp aco/tests: add more tests for chained branches 2025-02-27 10:40:01 +00:00
test_builder.cpp aco: use SPDX-License-Identifier 2024-04-08 15:49:25 +00:00
test_d3d11_derivs.cpp aco/sched_ilp: base latency and issue cycles on aco_statistics 2025-01-28 17:00:45 +00:00
test_hard_clause.cpp aco: form mixed MTBUF/MUBUF clauses 2025-04-08 09:22:04 +00:00
test_insert_nops.cpp aco/insert_NOPs: implement VALU -> VALU case for VALUReadSGPRHazard on GFX12 2025-01-30 03:13:16 +00:00
test_insert_waitcnt.cpp aco/gfx12: insert wait between VMEM WaW 2024-12-02 10:13:39 +00:00
test_isel.cpp aco/isel: track control flow divergence in loops more accurately 2025-02-05 10:54:21 +00:00
test_lower_subdword.cpp aco: add tests for lower_subdword 2024-05-02 11:09:35 +00:00
test_optimizer.cpp aco: do not apply OMOD/CLAMP for pseudo scalar trans instrs 2025-03-13 11:22:10 +00:00
test_optimizer_postRA.cpp aco: remove definition from Pseudo branch instructions 2024-12-06 14:34:03 +00:00
test_reduce_assign.cpp aco: only set latekill in live_var_analysis 2024-08-12 10:31:09 +00:00
test_regalloc.cpp aco/tests: Add tests for precolored operands in different regs 2025-02-28 16:00:48 +00:00
test_scheduler.cpp aco: replace constant v_bfrev_b32 with v_mov_b32 to create vopd 2024-07-01 17:34:22 +00:00
test_sdwa.cpp aco/optimizer: fix signed extract of sub dword temps with SDWA 2025-01-02 09:33:18 +00:00
test_tests.cpp aco: use SPDX-License-Identifier 2024-04-08 15:49:25 +00:00
test_to_hw_instr.cpp aco: use VOP3 v_mov_b16 if necessary 2025-01-10 15:05:00 +00:00

Tests are wrapped in a BEGIN_TEST/END_TEST and write data to the output file pointer. Tests have checks against the output. They are single line comments prefixed with certain characters:

  • ! fails the test if the current line does not match the pattern
  • >> skips to the first line which matches the pattern, or fails the test if there is none
  • ; executes python code to extend the pattern syntax by inserting functions into the variable dictionary, fail the test, insert more checks or consume characters from the output

Before this prefix, there can be a ~ to only perform the check for certain variants (a regex directly following the ~ is used).

Pattern Syntax

Patterns can define variables which can be accessed in both python code and the pattern itself. These are useful for readability or dealing with unstable identifiers in the output. Variable identifiers are sequences of digits, ascii letters or _ (though they cannot start with a digit).

  • \ can be used to match the following literal character without interpreting it.
  • Most characters expect the same characters in the output.
  • A sequence of spaces in the pattern expects a sequence of spaces or tabs in the output.
  • A # in the pattern expects an unsigned integer in the output. The # can be followed by an identifier to store the integer in a variable.
  • A $ in the pattern stores the output until the first whitespace character into a variable.
  • A % in the pattern followed by an identifier is the same as a # but it expects a % before the integer in the output. It basically matches a ACO temporary.
  • A @ calls a variable as a function. It can be followed by an argument string wrapped in ( and ).

Functions

  • s64, s96, s128, v2, v3, etc, expand to a pattern which matches a disassembled instruction's definition or operand. It later checks that the size and alignment is what's expected.
  • match_func expands to a sequence of $ and inserts functions with expand to the extracted output
  • search_re consumes the rest of the line and fails the test if the pattern is not found