SPIRV-Tools/include/spirv-tools
Cassandra Beckley 1bc0e6f59a
Add a new legalization pass to dedupe invocation interlock instructions (#5409)
Add a new legalization pass to dedupe invocation interlock instructions

DXC will be adding support for HLSL's rasterizer ordered views by using
the SPV_EXT_fragment_shader_interlock_extension. That extension
stipulates that if an entry point has an interlock ordering execution
mode, it must dynamically execute OpBeginInvocationInterlockEXT and
OpEndInvocationInterlockEXT, in that order, exactly once. This would be
difficult to determine in DXC's SPIR-V backend, so instead we will emit
these instructions potentially multiple times, and use this legalization
pass to ensure that the final SPIR-V follows the specification.

This PR uses data-flow analysis to determine where to place begin and
end instructions; in essence, determining whether a block contains or is
preceded by a begin instruction is similar to a specialized case of a
reaching definitions analysis, where we have only a single definition,
such as `bool has_begun = false`. For this simpler case, we can compute
the set of blocks using BFS to determine the reachability of the begin
instruction.

We need to do this for both begin and end instructions, so I have
generalized portions of the code to run both forward and backward over
the CFG for each respective case.
2023-09-27 19:54:10 -04:00
..
instrument.hpp instrument: Use Import linkage for instrumentation functions (#5355) 2023-09-20 10:50:30 -06:00
libspirv.h Update SPIRV-Headers, add cache control operand kinds (#5406) 2023-09-13 17:43:12 -04:00
libspirv.hpp libspirv.cpp: adds c++ api for spvBinaryParse (#5109) 2023-02-14 14:08:20 -05:00
linker.hpp linker: Add --use-highest-version option (#5376) 2023-08-21 17:05:33 -06:00
linter.hpp spirv-lint: Add lint based on divergence analysis (#4488) 2021-08-27 14:43:23 -04:00
optimizer.hpp Add a new legalization pass to dedupe invocation interlock instructions (#5409) 2023-09-27 19:54:10 -04:00