[Mesa-dev] [PATCH v2 1/4] i965: Always set a valid block end pointer

Kenneth Graunke kenneth at whitecape.org
Mon Jun 9 02:22:45 PDT 2014


On Thursday, June 05, 2014 03:03:05 PM Iago Toral Quiroga wrote:
> When a instruction stream ends in a block structure (like a IF/ELSE/ENDIF) 
the
> last block's end pointer will not be set, leading to a crash later on in
> fs_live_variables::setup_def_use().
> 
> If we have not assigned the end pointer of the last block, set it to the 
last
> instruction.
> ---
>  src/mesa/drivers/dri/i965/brw_cfg.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp 
b/src/mesa/drivers/dri/i965/brw_cfg.cpp
> index 6bf99f1..d4647c4 100644
> --- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
> @@ -257,6 +257,11 @@ cfg_t::cfg_t(exec_list *instructions)
>        }
>     }
>  
> +   /* If the instruction stream ended with a block structure we need to
> +      set the block's end pointer to the last instruction here */
> +   if (!cur->end)
> +      cur->end = (backend_instruction *)instructions->get_tail();
> +
>     cur->end_ip = ip;
>  
>     make_block_array();
> 

I'm not too excited about this patch - threads must terminate with a SEND 
message to a particular shared function, such as a URB write or FB write.  So 
the instruction stream really shouldn't end in an IF/ELSE/ENDIF.

I think we should probably just drop it, as it isn't needed for the latest 
version of your series anyway.

That said, perhaps we should add an assert(cur->end) here?  It seems like 
catching this problem earlier than fs_live_variables::setup_def_use would be 
nice.  What do you think?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140609/56a15c69/attachment.sig>


More information about the mesa-dev mailing list