[Mesa-dev] [PATCH 32/32] i965: Don't compact instructions with unmapped bits.

Matt Turner mattst88 at gmail.com
Sun Feb 8 14:19:11 PST 2015


On Fri, Feb 6, 2015 at 6:43 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> Some instruction bits don't have a mapping defined to any compacted
> instruction field.  If they're ever set and we end up compacting the
> instruction they will be forced to zero.  Avoid using compaction in such
> cases.

Nice find!

> ---
>  src/mesa/drivers/dri/i965/brw_eu_compact.c | 48 ++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c
> index 8e33bcb..7331ac8 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
> @@ -843,6 +843,48 @@ set_3src_source_index(struct brw_context *brw, brw_compact_inst *dst, brw_inst *
>  }
>
>  static bool
> +has_unmapped_bits(struct brw_context *brw, brw_inst *src)
> +{
> +   /* Check for instruction bits that don't map to any of the fields of the
> +    * compacted instruction.  The instruction cannot be compacted if any of
> +    * them are set.  They overlap with:
> +    *  - NibCtrl (bit 47 on Gen7, bit 11 on Gen8)
> +    *  - Dst.AddrImm[9] (bit 47 on Gen8)
> +    *  - Src0.AddrImm[9] (bit 95 on Gen8)
> +    */
> +   if (brw->gen >= 8)
> +      return brw_inst_bits(src, 95, 95) ||
> +         brw_inst_bits(src, 47, 47) ||

Here and elsewhere, align the brw_inst_bits calls to the same column
as the call after the return.

> +         brw_inst_bits(src, 11, 11) ||
> +         brw_inst_bits(src, 7,  7);
> +   else
> +      return brw_inst_bits(src, 95, 91) ||
> +         brw_inst_bits(src, 47, 47) ||
> +         brw_inst_bits(src, 7,  7) ||
> +         (brw->gen < 7 && brw_inst_bits(src, 90, 90));
> +}
> +
> +static bool
> +has_3src_unmapped_bits(struct brw_context *brw, brw_inst *src)
> +{
> +   /* Check for three-source instruction bits that don't map to any of the
> +    * fields of the compacted instruction.  All of them seem to be reserved
> +    * bits currently.

If they're all reserved bits we should never be setting them, so we
should just assert.


More information about the mesa-dev mailing list