From f4ef34f207d15bcade7aed644328035dd0f2cc16 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 29 May 2019 17:46:55 -0500 Subject: intel/fs: Add an UNDEF instruction to avoid excess live ranges With 8 and 16-bit types and anything where we have to use non-trivial strides registersto deal with restrictions, we end up with things that look like partial writes even though we don't care about any values in the register except those written by that instruction. This is particularly important when dealing with loops because liveness sees is_partial_write and the fact that an old version from a previous loop iteration may be valid at that point and extends all purely partially written values to the entire loop. This commit adds a new UNDEF instruction which does nothing (the generator doesn't emit anything) but which does a fake write to the register. This informs liveness that we don't care about any values before that point so it won't consider those registers to be falsely live. We can safely emit UNDEF instructions for all SSA values that come in from NIR and nearly all temporaries generated by various stages of the compiler. In particular, we need to insert UNDEF instructions when we handle region restrictions because the newly allocated registers are almost guaranteed to be partially written. No shader-db changes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110432 Reviewed-by: Matt Turner --- src/intel/compiler/brw_eu_defines.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/intel/compiler/brw_eu_defines.h') diff --git a/src/intel/compiler/brw_eu_defines.h b/src/intel/compiler/brw_eu_defines.h index 66e6c53c2b7..933037c4df3 100644 --- a/src/intel/compiler/brw_eu_defines.h +++ b/src/intel/compiler/brw_eu_defines.h @@ -322,6 +322,14 @@ enum opcode { */ SHADER_OPCODE_SEND, + /** + * An "undefined" write which does nothing but indicates to liveness that + * we don't care about any values in the register which predate this + * instruction. Used to prevent partial writes from causing issues with + * live ranges. + */ + SHADER_OPCODE_UNDEF, + /** * Texture sampling opcodes. * -- cgit v1.2.3