[Mesa-dev] [PATCH 2/2] i965/gen8: Handle the MUL dest hazard exception

Ben Widawsky ben at bwidawsk.net
Fri Nov 21 10:52:08 PST 2014


On Fri, Nov 21, 2014 at 10:50:31AM -0800, Ben Widawsky wrote:
> Fix one of the few cases where we can't reliable touch the destination hazard
> bits. I am explicitly doing this patch individually so it is easy to backport. I
> was tempted to do this patch before the previous patch which reorganized the
> code, but I believe even doing that first, this is still easy to backport.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86268
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>

This is the wrong bug link. it should be 84212. Fixed locally.


> ---
>  src/mesa/drivers/dri/i965/brw_vec4.cpp | 20 ++++++++++++++++++--
>  src/mesa/drivers/dri/i965/brw_vec4.h   |  1 +
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 0c2bbe9..d583f27 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -841,9 +841,25 @@ vec4_visitor::move_push_constants_to_pull_constants()
>  }
>  
>  /* Conditions for which we want to avoid setting the dependency control bits */
> -static bool
> -is_dep_ctrl_safe(vec4_instruction *inst)
> +bool
> +vec4_visitor::is_dep_ctrl_safe(vec4_instruction *inst)
>  {
> +#define IS_DWORD(reg) \
> +   (reg.type == BRW_REGISTER_TYPE_UD || \
> +    reg.type == BRW_REGISTER_TYPE_D)
> +
> +   /* From the destination hazard section of the spec:
> +    * > Instructions other than send, may use this control as long as operations
> +    * > that have different pipeline latencies are not mixed.
> +    */
> +   if (brw->gen >= 8) {
> +      if (inst->opcode == BRW_OPCODE_MUL &&
> +         IS_DWORD(inst->src[0]) &&
> +         IS_DWORD(inst->src[1]))
> +         return false;
> +   }
> +#undef IS_DWORD
> +
>     /*
>      * In the presence of send messages, totally interrupt dependency
>      * control. They're long enough that the chance of dependency
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
> index 8e7dfe1..81bb06c 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.h
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.h
> @@ -393,6 +393,7 @@ public:
>     bool opt_cse();
>     bool opt_algebraic();
>     bool opt_register_coalesce();
> +   bool is_dep_ctrl_safe(vec4_instruction *inst);
>     void opt_set_dependency_control();
>     void opt_schedule_instructions();
>  
> -- 
> 2.1.3
> 

-- 
Ben Widawsky, Intel Open Source Technology Center


More information about the mesa-dev mailing list