[Mesa-dev] [PATCH v2 04/20] i965/fs: clamp exec_size to 4 when an instruction has an scalar DF source

Francisco Jerez currojerez at riseup.net
Tue Jan 17 20:26:46 UTC 2017


Typo in the subject line "an scalar".

Samuel Iglesias Gonsálvez <siglesias at igalia.com> writes:

> Then the SIMD lowering pass will get rid of any compressed instructions with scalar
> source (whether force_writemask_all or not) and we avoid hitting the Gen7 region
> decompression bug.
>
> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> Suggested-by: Francisco Jerez <currojerez at riseup.net>
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 95714c16f15..a2ba0fde9fd 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -4516,6 +4516,11 @@ get_fpu_lowered_simd_width(const struct gen_device_info *devinfo,
>              const unsigned reg_count = DIV_ROUND_UP(inst->size_written, REG_SIZE);
>              max_width = MIN2(max_width, inst->exec_size / reg_count);
>           }
> +
> +         if (type_sz(inst->src[i].type) == 8 &&
> +             ((inst->size_read(i) != 0 && inst->size_read(i) <= REG_SIZE) ||

Not sure what you're trying to achieve with the line above.

> +              is_uniform(inst->src[i])))
> +            max_width = MIN2(max_width, 4);

AFAICT this is going to do the lowering incorrectly on HSW which doesn't
have the same limitation.  Let's restructure things slightly for
readability:

|   for (unsigned i = 0; i < inst->sources; i++) {
|      /* IVB implements DF scalars as <0;2,1> regions. */
|      const bool is_scalar_exception = is_uniform(inst->src[i]) &&
|         (devinfo->is_haswell || type_sz(inst->src[i].type) != 8);
|      const bool is_packed_word_exception =
|         type_sz(inst->dst.type) == 4 && inst->dst.stride == 1 &&
|         type_sz(inst->src[i].type) == 2 && inst->src[i].stride == 1;
|
|      if (inst->size_written > REG_SIZE &&
|          inst->size_read(i) != 0 && inst->size_read(i) <= REG_SIZE &&
|          !is_scalar_exception && !is_packed_word_exception) {
|          // ...
|      }
|   }

If you do it as above patch is:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

>        }
>     }
>  
> -- 
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170117/045551b7/attachment.sig>


More information about the mesa-dev mailing list