diff options
author | Shahbaz Youssefi <syoussefi@google.com> | 2022-02-02 18:33:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 18:33:18 +0300 |
commit | 7fa9e746ef815b27f7747c9bab2689c113fb33d9 (patch) | |
tree | 4ee4e2cefedd80cbfe4e318d0c7c110c9edc0458 /README.md | |
parent | b846f8f1dc2d79f2b5ce27d5ad901f885da1cf82 (diff) |
Introduce spirv-diff (#4611)
spirv-diff is a new tool that produces diff-style output comparing two
SPIR-V modules. The instructions between the src and dst modules are
matched as best as the tool can, and output is produced (in src
id-space) that shows which instructions are removed in src, added in dst
or modified between them. The order of instructions are not retained.
Matching instructions between two SPIR-V modules is not trivial, and
thus a number of heuristics are applied in this tool. In particular,
without debug information, it's hard to match functions as they can be
reordered. As such, this tool is primarily useful to produce the diff
of two SPIR-V modules derived from the same source.
This tool can be useful in a number of scenarios:
- Compare the SPIR-V before and after modifying a shader
- Compare the SPIR-V produced from a shader before and after compiler
codegen changes.
- Compare the SPIR-V produced from a shader before and after some
transformation or optimization.
- Compare the SPIR-V produced from a shader with different compilers.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -212,6 +212,24 @@ issue](https://github.com/KhronosGroup/SPIRV-Tools/issues]) with "Fuzzer:" as the start of its title. +### Diff + +*Note:* The diff tool is still under development. + +The diff tool takes two SPIR-V files, either in binary or text format and +produces a diff-style comparison between the two. The instructions between the +src and dst modules are matched as best as the tool can, and output is produced +(in src id-space) that shows which instructions are removed in src, added in dst +or modified between them. The order of instructions are not retained. + +Matching instructions between two SPIR-V modules is not trivial, and thus a +number of heuristics are applied in this tool. In particular, without debug +information, match functions is nontrivial as they can be reordered. As such, +this tool is primarily useful to produce the diff of two SPIR-V modules derived +from the same source, for example before and after a modification to the shader, +before and after a transformation, or SPIR-V produced from different tools. + + ### Extras * [Utility filters](#utility-filters) @@ -624,6 +642,15 @@ This is experimental. * `spirv-cfg` - the control flow graph dumper * `<spirv-dir>/tools/cfg` +### Diff tool + +*Warning:* This functionality is under development, and is incomplete. + +The diff tool produces a diff-style comparison between two SPIR-V modules. + +* `spirv-diff` - the standalone diff tool + * `<spirv-dir>`/tools/diff` + ### Utility filters * `spirv-lesspipe.sh` - Automatically disassembles `.spv` binary files for the |