[Mesa-dev] [PATCH] i965: Don't consider null dst instructions as matching non-null dst.

Tapani Pälli tapani.palli at intel.com
Mon Jan 12 21:58:56 PST 2015


Thanks, this fixes the issue;

Tested-by: Tapani Pälli <tapani.palli at intel.com>

On 01/13/2015 01:07 AM, Matt Turner wrote:
> When performing common subexpression elimination on instructions with
> non-null destinations we emit a MOV to copy the result to a new
> register that must have no other uses. In the case of:
>
>     cmp.g.f0.0(8) null:D, vgrf43:F, 0.500000f
>     ...
>     cmp.g.f0.0(8) vgrf113:D, vgrf43:F, 0.500000f
>
> we put the first instruction in the AEB and decided that we could reuse
> its result when we found the second. Unfortunately, that meant that we'd
> emit a MOV from the first's destination, which is null.
>
> Don't do anything if the entry's destination is null and the
> instruction's destination is non-null.
> ---
> Tapani noticed we were hitting an assertion in CSE about entry/inst's
> dst types not being the same when running Unreal 4 Sun Temple demo.
>
>   src/mesa/drivers/dri/i965/brw_fs_cse.cpp   | 3 ++-
>   src/mesa/drivers/dri/i965/brw_vec4_cse.cpp | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> index f87601c..11cb327 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> @@ -194,7 +194,8 @@ fs_visitor::opt_cse_local(bblock_t *block)
>
>            foreach_in_list_use_after(aeb_entry, entry, &aeb) {
>               /* Match current instruction's expression against those in AEB. */
> -            if (instructions_match(inst, entry->generator)) {
> +            if (!(entry->generator->dst.is_null() && !inst->dst.is_null()) &&
> +                instructions_match(inst, entry->generator)) {
>                  found = true;
>                  progress = true;
>                  break;
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
> index 30a4098..ee50419 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
> @@ -157,7 +157,8 @@ vec4_visitor::opt_cse_local(bblock_t *block)
>
>            foreach_in_list_use_after(aeb_entry, entry, &aeb) {
>               /* Match current instruction's expression against those in AEB. */
> -            if (instructions_match(inst, entry->generator)) {
> +            if (!(entry->generator->dst.is_null() && !inst->dst.is_null()) &&
> +                instructions_match(inst, entry->generator)) {
>                  found = true;
>                  progress = true;
>                  break;
>


More information about the mesa-dev mailing list