-
Notifications
You must be signed in to change notification settings - Fork 664
spirv-fuzz: global variables and interface blocks #3111
Description
At present spirv-fuzz assumes that all global variable are available for reading. But from SPIR-V 1.4 onwards this is not the case: a global variable can only be accessed from a function in the call tree of entry point E if said variable is listed in the interface for E.
This could be handled in a few ways, with two promising candidates being:
-
Have a transformation that can add a global variable to an entry point's interface. This is semantics-preserving, and the set of variables in the interface is allowed to be a superset of what is actually referenced. Whenever another transformation could lead to globals not currently in an entry point's interface being accessed, adapt the precondition of said transformation to guard against this, and in the fuzzer apply the new transformation as needed so that the precondition holds.
-
When a transformation would lead to an access of a global that is not in an interface block, include adding the transformation to the interface block as part of the transformation's effect.
2 is a bit less intrusive than 1, but has the disadvantage of making "add to interface block" and "use global" inseparable. (Though "add to interface block" could still be available as a separate fuzzer pass transformation.)