<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 7, 2018 at 8:11 PM, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8 June 2018 at 07:53, Jiang, Sonny <<a href="mailto:Sonny.Jiang@amd.com">Sonny.Jiang@amd.com</a>> wrote:<br>
> By applied patch 1, gfx IB size changes obviously.<br>
><br>
><br>
> openarena GFX-IB-size changes from 7.64k to 7.44k.<br>
> glxgears GFX-IB-size changes from 8.48k to 8.416k.<br>
><br>
><br>
> The adding CPU workloads are quite small in this case and it's  hard to<br>
> measure it. So the assumption is that writing a SET_CONTEXT_REG packet is<br>
> more expensive. And we emit too many redundant packets. Some registers<br>
> rarely get different values.<br>
<br>
</span>We spend a lot of time removing CPU overheads in draw call paths,  even threaded<br>
it can still be something. This sort of idea can introduce a lot of<br>
branches and cache<br>
misses, reading a value back from the tracked_regs with a branch as opposed to<br>
just writing directly to the DMA packet.<br>
<br>
I think without a specified win for this code you aren't make things<br>
better. it's<br>
up to Marek and Nicolai, but I'm very wary of wasting time/energy in<br>
this direction<br>
without some numbers to show anything, good or bad.<br></blockquote><div><br></div></div>It was my idea to do this. Only emit functions that can benefit are optimized here. There are many others that won't be optimized like this for precisely the reasons you mentioned.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If there is one unnecessary SET_CONTEXT_REG packet between 2 draw calls and that packet is removed, we gain real GPU performance, not just an IB space saving.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Marek<br></div></div>