SPIRV-Tools/test/diff/diff_files
Shahbaz Youssefi 9beb54513c
Stabilize the output of spirv-diff (#4698)
* Reimplement LCS used by spirv-diff

Two improvements are made to the LCS algorithm:

- The LCS algorithm is reimplemented to use a std::stack instead of
  being recursive.  This prevents stack overflow in the LCSTest.Large
  test.
- The LCS algorithm uses an NxM table.  Previously, entries of this
  table were {size_t, bool, bool}, which is now packed in 32 bits.  The
  first entry can assume a maximum value of min(N, M), which
  realistically for SPIR-V diff will not be larger than 1 billion
  instructions.  This reduces memory usage of LCS by 75%.

This partially reverts 845f3efb8a and
enables LCS tests.

* Stabilize the output of spirv-diff

std::map is used instead of std::unordered_map to ensure the output of
spirv-diff is identical everywhere.

This partially reverts 845f3efb8a and
enables spirv-diff tests.
2022-02-07 09:37:04 -05:00
..
.gitignore Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
basic_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
basic_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
basic_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
diff_test_files_autogen.cmake Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
different_decorations_fragment_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
different_decorations_fragment_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
different_decorations_fragment_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
different_decorations_vertex_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
different_decorations_vertex_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
different_decorations_vertex_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
extra_if_block_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
extra_if_block_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
extra_if_block_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
generate_tests.py Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
index_signedness_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
index_signedness_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
index_signedness_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
int_vs_uint_constants_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
int_vs_uint_constants_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
int_vs_uint_constants_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
large_functions_large_diffs_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
large_functions_large_diffs_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
large_functions_large_diffs_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
large_functions_small_diffs_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
large_functions_small_diffs_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
large_functions_small_diffs_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
multiple_different_entry_points_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
multiple_different_entry_points_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
multiple_different_entry_points_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
multiple_same_entry_points_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
multiple_same_entry_points_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
multiple_same_entry_points_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
OpExtInst_in_dst_only_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
OpExtInst_in_dst_only_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
OpExtInst_in_dst_only_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
OpExtInst_in_src_only_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
OpExtInst_in_src_only_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
OpExtInst_in_src_only_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
README.md Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
reordered_if_blocks_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
reordered_if_blocks_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
reordered_if_blocks_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
reordered_switch_blocks_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
reordered_switch_blocks_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
reordered_switch_blocks_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
small_functions_small_diffs_autogen.cpp Stabilize the output of spirv-diff (#4698) 2022-02-07 09:37:04 -05:00
small_functions_small_diffs_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
small_functions_small_diffs_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
unrelated_shaders_autogen.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
unrelated_shaders_dst.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
unrelated_shaders_src.spvasm Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00

Diff tests

This directory contains files used to ensure correctness of the spirv-diff implementation. The generate_tests.py script takes name_src.spvasm and name_dst.spvasm (for each name) and produces unit test files in the form of name_autogen.cpp.

The unit test files test the diff between the src and dst inputs, as well as between debug-stripped versions of those. Additionally, based on the {variant}_TESTS lists defined in generate_tests.py, extra unit tests are added to exercise different options of spirv-diff.

New tests are added simply by placing a new name_src.spvasm and name_dst.spvasm pair in this directory and running generate_tests.py. Note that this script needs the path to the spirv-diff executable that is built.

The generate_tests.py script additionally expects name_src.spvasm to include a heading where the purpose of the test is explained. This heading is parsed as a block of lines starting with ;; at the top of the file.