[Mesa-dev] [PATCH 10/19] i965/fs: Lower LOAD_PAYLOAD and clean up.

Kenneth Graunke kenneth at whitecape.org
Wed Apr 23 22:55:01 PDT 2014


On 04/18/2014 11:56 AM, Matt Turner wrote:
> Clean up with with register_coalesce()/dead_code_eliminate().
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 37 ++++++++++++++++++++++++++++++++++++
>  src/mesa/drivers/dri/i965/brw_fs.h   |  1 +
>  2 files changed, 38 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index e963ee8..602fc4a 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -2635,6 +2635,38 @@ fs_visitor::lower_uniform_pull_constant_loads()
>     }
>  }
>  
> +bool
> +fs_visitor::lower_load_payload()
> +{
> +   bool progress = false;
> +
> +   foreach_list_safe(node, &instructions) {
> +      fs_inst *inst = (fs_inst *)node;
> +
> +      if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
> +         fs_reg dst = inst->dst;
> +

It would be great to have a comment here such as:

/* src[0] represents the (optional) message header. */

It might also be worth adding a comment above the opcode definition in
the previous patch explaining that src[0] is reserved for an optional
message header, and could be BAD_FILE, while the rest of the parameters
follow in src[1..n].  Notably, this is the first opcode where you can
have a BAD_FILE early, and real parameters later (AFAIK).

> +         if (inst->src[0].file != BAD_FILE) {
> +            inst->insert_before(MOV(dst, inst->src[0]));
> +         }
> +         dst.reg_offset++;
> +
> +         for (int i = 1; i < inst->sources; i++) {
> +            inst->insert_before(MOV(dst, inst->src[i]));
> +            dst.reg_offset++;
> +         }
> +
> +         inst->remove();
> +         progress = true;
> +      }
> +   }
> +
> +   if (progress)
> +      invalidate_live_intervals();
> +
> +   return progress;
> +}
> +
>  void
>  fs_visitor::dump_instructions()
>  {
> @@ -3085,6 +3117,11 @@ fs_visitor::run()
>  	 progress = compute_to_mrf() || progress;
>        } while (progress);
>  
> +      if (lower_load_payload()) {
> +         register_coalesce();
> +         dead_code_eliminate();
> +      }
> +
>        lower_uniform_pull_constant_loads();
>  
>        assign_curb_setup();
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
> index 4f1bdc6..c1445b8 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -392,6 +392,7 @@ public:
>     void fail(const char *msg, ...);
>     void no16(const char *msg, ...);
>     void lower_uniform_pull_constant_loads();
> +   bool lower_load_payload();
>  
>     void push_force_uncompressed();
>     void pop_force_uncompressed();
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140423/9b871385/attachment.sig>


More information about the mesa-dev mailing list