[Mesa-dev] [PATCH 2/2] i965: Optimize intel_batchbuffer_emit_dword().

Matt Turner mattst88 at gmail.com
Wed Jul 8 15:33:17 PDT 2015


On Wed, Jul 8, 2015 at 2:07 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Wed, Jul 08, 2015 at 02:00:02PM -0700, Matt Turner wrote:
>> By keeping a pointer to the next available location, we reduce the
>> number of memory accesses needed to write to the batchbuffer.
>>
>> A net ~7k reduction of .text size, 7.5k of which is from the change to
>> intel_batchbuffer_emit_dword().
>>
>>    text     data      bss      dec      hex  filename
>> 4943740   195152    26192  5165084   4ed01c  i965_dri.so before
>> 4936804   195152    26192  5158148   4eb504  i965_dri.so after
>>
>> Combined with the previous patch, improves performance of Synmark
>> OglBatch7 by 4.05914% +/- 1.49373% (n=270) on Haswell.
>> ---
>> Full disclosure: when testing on an IVB desktop, I measured a
>> regression in the same benchmark of -4.19005% +/- 1.15188% (n=30).
>> I don't have any explanation.
>
> The problem is that it seems to generate worse code with multiple
> adjacent emit_dwords. I have seen similar regressions when doing the
> same batch[index] to *batch++ elsewhere.
> -Chris

That is in conflict with the data I've provided. In fact, I started by
noticing that if I added intel_batchbuffer_emit_dword* functions that
took multiple dwords that there was a reduction in .text size, so it's
something that I've considered.

The two attached patches demonstrate that the batch[index++] pattern
generates larger (worse) code than *batch++. 1.patch

   text   data    bss    dec    hex filename
4936804 195152  26192 5158148 4eb504 mesa-release/lib/i965_dri.so
after 1.patch (no change)
4936884 195152  26192 5158228 4eb554 mesa-release/lib/i965_dri.so after 2.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.patch
Type: text/x-patch
Size: 2833 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150708/83f6f8ea/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.patch
Type: text/x-patch
Size: 1967 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150708/83f6f8ea/attachment-0003.bin>


More information about the mesa-dev mailing list