[Mesa-dev] [PATCH 0/9] i965 assembly validator
Matt Turner
mattst88 at gmail.com
Wed Oct 21 15:58:08 PDT 2015
Inspired by a bug this summer, I've written a basic assembly validation
pass. The series currently checks only three things:
- that instruction sources are not null (when they shouldn't be);
- that the Gen supports the instruction opcode; and
- that the various accumulator restrictions are satisfied.
To do this, I add a bit of infrastructure to the annotation system, to
allow errors to be printed.
In debug builds, an assertion checks that the assembly was validated.
When using INTEL_DEBUG=<shader stage>, ERROR: ... will be emitted
following a bad instruction, with a hopefully helpful message describing
what's wrong. For example:
mov(8) g116<1>.xUD null
ERROR: src0 is null
[...]
shader_runner: ../../../../../../mesa/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp:1671: void brw::vec4_generator::generate_code(const cfg_t*, const nir_shader*): Assertion `validated' failed.
I'd like to extend the validator to cover many more cases, but that's
no reason to hold back what I've already written -- checking for null
source would have saved three people a week or two after all.
More information about the mesa-dev
mailing list