intel/eu: Handle compaction when inserting validation errors
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 19 Jul 2022 07:27:29 +0000 (00:27 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 28 Jul 2022 21:31:45 +0000 (21:31 +0000)
commit82ee30e55861b237b0a0e23cd31133cb8778fd7b
tree5363ac39d608e74b22eab558aff42741099c49fa
parentce42fc4fa16e8c32ea11cd49da1fb72f1e8a12e1
intel/eu: Handle compaction when inserting validation errors

When the EU validator encountered an error, it would add an annotation
to the disassembly.  Unfortunately, the code to insert an error assumed
that the next instruction would start at (offset + sizeof(brw_inst)),
which is not true if the instruction with an error is compacted.

This could lead to cascading disassembly errors, where we started trying
to decode the next instruction at the wrong offset, and getting lots of
scary looking output:

   ERROR: Register Regioning patterns where [...]
   (-f0.1.any16h) illegal(*** invalid execution size value 6 )      { align1 $7.src atomic };
   (+f0.1.any16h) illegal.sat(*** invalid execution size value 6 )  { align1 $9.src AccWrEnable };
   illegal(*** invalid execution size value 6 )                     { align1 $11.src };
   (+f0.1) illegal.sat(*** invalid execution size value 6 )         { align1 F@2 AccWrEnable };
   (+f0.1) illegal.sat(*** invalid execution size value 6 )         { align1 F@2 AccWrEnable };
   (+f0.1) illegal.sat(*** invalid execution size value 6 )         { align1 $15.src AccWrEnable };
   illegal(*** invalid execution size value 6 )                     { align1 $15.src };
   (+f0.1) illegal.sat.g.f0.1(*** invalid execution size value 6 )  { align1 $13.src AccWrEnable };

Only the first instruction was actually wrong - the rest are just a
result of starting the disassembler at the wrong offset.  Trash ensues!

To fix this, just pass the instruction size in a few layers so we can
record the next offset properly.

Cc: mesa-stable
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17624>
src/intel/compiler/brw_disasm_info.c
src/intel/compiler/brw_disasm_info.h
src/intel/compiler/brw_eu.h
src/intel/compiler/brw_eu_validate.c
src/intel/compiler/test_eu_compact.cpp