mesa/src/amd/compiler/tests
Rhys Perry 03938804f1 aco: avoid breaking clauses with waitcnt
fossil-db (navi31):
Totals from 3573 (4.50% of 79395) affected shaders:
Instrs: 6172096 -> 6170009 (-0.03%); split: -0.04%, +0.01%
CodeSize: 31448052 -> 31439660 (-0.03%); split: -0.03%, +0.01%
Latency: 37317302 -> 37307935 (-0.03%); split: -0.03%, +0.00%
InvThroughput: 6820967 -> 6819930 (-0.02%); split: -0.02%, +0.00%
VClause: 163424 -> 157705 (-3.50%)
SClause: 135441 -> 135295 (-0.11%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28433>
2024-03-29 12:04:13 +00:00
..
check_output.py aco/tests: improve reporting of failed code checks 2021-06-03 03:49:07 +00:00
framework.h aco: reformat according to its .clang-format 2023-06-16 19:59:52 +00:00
glsl_scraper.py aco/tests: use more raw strings 2024-01-03 13:33:52 +00:00
helpers.cpp aco: remove create_instruction() template parameter 2024-03-28 11:25:43 +00:00
helpers.h aco/tests: add tests for VOPD operand swapping 2024-02-08 12:15:23 +00:00
main.cpp aco: reformat according to its .clang-format 2023-06-16 19:59:52 +00:00
meson.build aco/tests: add tests for VOPD operand swapping 2024-02-08 12:15:23 +00:00
README.md aco/tests: add tests for form_hard_clauses() 2021-06-03 03:49:07 +00:00
test_assembler.cpp aco: remove create_instruction() template parameter 2024-03-28 11:25:43 +00:00
test_builder.cpp amd: change chip_class naming to "enum amd_gfx_level gfx_level" 2022-05-13 14:56:22 -04:00
test_d3d11_derivs.cpp aco/ra: rework linear VGPR allocation 2024-03-06 12:55:46 +00:00
test_hard_clause.cpp aco: remove create_instruction() template parameter 2024-03-28 11:25:43 +00:00
test_insert_nops.cpp aco: remove create_instruction() template parameter 2024-03-28 11:25:43 +00:00
test_insert_waitcnt.cpp aco: avoid breaking clauses with waitcnt 2024-03-29 12:04:13 +00:00
test_isel.cpp aco: reformat according to its .clang-format 2023-06-16 19:59:52 +00:00
test_optimizer.cpp aco/tests: use correct operand size for some 64bit ops 2023-11-15 12:35:32 +00:00
test_optimizer_postRA.cpp aco: print exec/vcc_lo/hi for single dword access 2024-02-09 22:14:44 +00:00
test_reduce_assign.cpp aco: require linear vgpr uses to be late kill 2024-03-06 12:55:45 +00:00
test_regalloc.cpp aco/tests: add tests for linear VGPR register allocation 2024-03-06 12:55:46 +00:00
test_scheduler.cpp aco/tests: add tests for VOPD operand swapping 2024-02-08 12:15:23 +00:00
test_sdwa.cpp aco/optimizer: copy propagate to output modifier instructions 2023-10-02 14:02:49 +00:00
test_tests.cpp radv,aco: tweaks to get clang-format to print nicer code 2023-06-16 19:59:52 +00:00
test_to_hw_instr.cpp aco: optimize for purely linear VGPR copies 2024-03-06 12:55:46 +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