I have just seen that I have had an epic brain lapse on this.

The code is pretty clear, the correct value of count should be ann_count - i. 
This is because:
  a. The value of ann_count is the value of the array size BEFORE the insert; 
this is clear from the code within the if (offset + ..) where it increments 
ann_count.
 b. Since ann_count is the size before the insert, it should move the content 
in the open range [i, ann_count) to [i + 1, ann_count + 1); thus the number of 
elements is given by ann_count - i.

Changing the count to ann_count - i does the right thing, and also makes it 
quite clear that Matt is correct on patch 11: that it was just papering over a 
bug from using the wrong count value.

However, once this is done, the build does assert() on some shaders that I 
have; this is because it fails to understand some registers.

-Kevin

-----Original Message-----
From: Matt Turner [mailto:matts...@gmail.com] 
Sent: Monday, November 13, 2017 11:21 PM
To: Rogovin, Kevin <kevin.rogo...@intel.com>
Cc: mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [PATCH 07/18] intel/compiler: fix for memmove argument 
on annotating error

On Mon, Nov 13, 2017 at 1:12 PM, Rogovin, Kevin <kevin.rogo...@intel.com> wrote:
> Hi,
>
>
>  I confess I am not 100% on this code and I did educated guessing what it is  
> trying to do; I figured it was trying to insert contents at the current index 
> i; and that ann_count is the size -after- the insert. thus I figured the 
> memmove is to move the half open interval [i, ann_count-1) to the half open 
> interval [i + 1, ann_count). The number of elements in the half open range 
> [i, ann_count - 1) is given by ann_count - i - 1.
>
> I tried changing the count from ann_count - i - 1 to ann_count - i + 1 and 
> then the disassembler crashed in annotation on the same shaders that I have 
> had it crash on before.

Interesting. Could you send me the shader binary? I'll take a look.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to