RFC: create a test target to verify that intel compiler shader cache hash key is complete
When intel compiler source files reference struct intel_device_info
fields, the fields must be included in the shader cache hash key. Developers may not be aware of this requirement, and new references in libintel_compiler.a may result in cache collisions that only occur for multiplatform (eg network-provided) shader caches. The failure case is hard to detect.
This MR:
- generates an alternative declaration of
struct intel_device_info
containing only the members used in the hash key - creates a dummy test executable from lib_intelcompiler files, made to include the limited struct declaration.
- fails compilation (when building tests) when compiler files access a devinfo member which is not part of the key.
Other suggested mechanisms to test for the failure case have drawbacks:
- grep / sed of source files will lack precision/accuracy.
- clang plugins to flag non-compiler fields and generate warnings pick up include an intricate build-time dependency
Drawbacks to this approach:
- code generation in
struct intel_device_info
is already somewhat invasive/overbuilt. This test goes further in the same direction. - multiple/different declarations of
struct intel_device_info
may confuse symbol lookup in editors and be irritating to developers - compiling brw_* files twice has a build-time cost (when building tests)
- the macro use in intel_device_info.h is hacky
I'm looking for feedback:
- Ideas to make the mechanism less hacky
- Opinions on the value of testing for this failure case
- Suggestions for better approaches
- NAK on worsening the impact within intel_device_info.h