<div dir="ltr">Thanks for all your work on Nouveau and I look forward to your contributions to radeonsi</div><br><div class="gmail_quote"><div dir="ltr">On Thu, 22 Dec 2016 at 23:16 Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br class="gmail_msg">
<br class="gmail_msg">
This series makes use of the scheduling control code in order to improve the<br class="gmail_msg">
instruction pipelining on Maxwell GPUs.<br class="gmail_msg">
<br class="gmail_msg">
Starting with the Kepler architecture, where a control instruction has to be<br class="gmail_msg">
inserted every 7 instructions, Maxwell added additional control codes and the<br class="gmail_msg">
control instruction now has to be every 3 instructions. Maxwell control codes<br class="gmail_msg">
are really powerful and well documented [1]. By the way, I would like to thank<br class="gmail_msg">
Scott Gray who did an awesome reverse engineering work, although I had to<br class="gmail_msg">
figure out the missing parts myself.<br class="gmail_msg">
<br class="gmail_msg">
On Maxwell, control codes are mainly used for setting the number of stall<br class="gmail_msg">
counts and for producing/consumming dependency barriers in order to avoid<br class="gmail_msg">
hazards. I'm not going to explain in details how do they work because the<br class="gmail_msg">
documentation is quite good and because I added explanations here and there<br class="gmail_msg">
in the source code. But the main thing to understand is that the previous<br class="gmail_msg">
control code used by default (ie. st 0x0) means "wait for all dependencies<br class="gmail_msg">
and stall the pipeline for 15 cycles which is the maximum".<br class="gmail_msg">
Which is quite bad...<br class="gmail_msg">
<br class="gmail_msg">
Now, let's have a look at the (impressive) performance improvements. :-)<br class="gmail_msg">
I measured on a GeForce GTX 750 Ti (GM107) reclocked to the highest perf level,<br class="gmail_msg">
with and without the control codes (NV50_PROG_SCHED=0/1).<br class="gmail_msg">
<br class="gmail_msg">
app: number of FPS without -> number of FPS with (+gain%)<br class="gmail_msg">
<br class="gmail_msg">
FurMark: 13 -> 42 (+223%)<br class="gmail_msg">
Pixmark Piano: 2 -> 7 (+250%)<br class="gmail_msg">
Pixmark Volposion: 6 -> 20 (+233%)<br class="gmail_msg">
Julia F32: 61 -> 219 (+259%)<br class="gmail_msg">
LightMarks: 352 -> 685 (+94%)<br class="gmail_msg">
Heaven (low): 51 -> 102 (+100%)<br class="gmail_msg">
Heaven (ultra): 14 -> 27 (+93%)<br class="gmail_msg">
Valley (low): 30 -> 68 (+126%)<br class="gmail_msg">
Valley (ultra): 18 -> 39 (+100%)<br class="gmail_msg">
Talos (low): 32 -> 50 (+56%)<br class="gmail_msg">
Talos (ultra): 7 -> 14 (+100%)<br class="gmail_msg">
Shadow of Mordor (lowest): 13 -> 20 (+53%)<br class="gmail_msg">
<br class="gmail_msg">
That's it! I think it's enough to understand the power of Maxwell control<br class="gmail_msg">
codes. We may get additional numbers from Phoronix (wink, wink, Michael).<br class="gmail_msg">
As I said in the main patch, the control codes can be disabled with<br class="gmail_msg">
'export NV50_PROG_SCHED=0'.<br class="gmail_msg">
<br class="gmail_msg">
Now, let's have a look how nouveau performs compared to NVIDIA's blob.<br class="gmail_msg">
<br class="gmail_msg">
FurMark: 42 -> 59 (+40%)<br class="gmail_msg">
Pixmark Piano: 7 -> 13 (+85%)<br class="gmail_msg">
Pixmark Volposion: 20 -> 42 (+110%)<br class="gmail_msg">
Julia F32: 219 -> 351 (+60%)<br class="gmail_msg">
LightMarks: 685 -> 1192 (+74%)<br class="gmail_msg">
Heaven (low): 102 -> 144 (+41%)<br class="gmail_msg">
Heaven (ultra): 27 -> 46 (+70%)<br class="gmail_msg">
Valley (low): 68 -> 94 (+38%)<br class="gmail_msg">
Valley (ultra): 39 -> 60 (+53%)<br class="gmail_msg">
Talos (low): 50 -> 128 (+156%)<br class="gmail_msg">
Talos (ultra): 14 -> 30 (+114%)<br class="gmail_msg">
Shadow of Mordor (lowest): 20 -> 77 (+285%)<br class="gmail_msg">
<br class="gmail_msg">
Nouveau is still far away from the blob, but now I think Maxwell is actually<br class="gmail_msg">
in roughly the same shape as Kepler in terms of performance and features.<br class="gmail_msg">
Speaking about this, I will enable OpenGL 4.3 on Maxwell in a separate patch,<br class="gmail_msg">
later on.<br class="gmail_msg">
<br class="gmail_msg">
The overhead at compile time added by this seris is rather small. For a full<br class="gmail_msg">
shader-db run with my private repository of shaders, it takes approximately<br class="gmail_msg">
208s for compiling 25k shaders before the series and approximately 211s after.<br class="gmail_msg">
Less than 2% of overhead and it's comparable to a full shader-db run on Kepler.<br class="gmail_msg">
<br class="gmail_msg">
No regressions with both piglit and dEQP (tested multiple times) and all<br class="gmail_msg">
benchmarks/games I have tried render fine and seem to be quite stable.<br class="gmail_msg">
<br class="gmail_msg">
Due to a lack of time, some parts are still left to do and some others could<br class="gmail_msg">
be improved. With the following ideas implemented I'm pretty sure we can<br class="gmail_msg">
improve performance significantly.<br class="gmail_msg">
<br class="gmail_msg">
* Add support for the yield flag. This seems to be a hint to the hardware for<br class="gmail_msg">
improving how the work is balanced between the warps. I didn't figure out<br class="gmail_msg">
how and where to use it without breaking a bunch of things. Need time and<br class="gmail_msg">
patience.<br class="gmail_msg">
<br class="gmail_msg">
* Add support for dual-issue, the rules are pretty different than Kepler<br class="gmail_msg">
especially because of the dependency barriers. Note that the yield flag has<br class="gmail_msg">
to be set, otherwise the hardware won't dual-issue and in fact it will wait<br class="gmail_msg">
for all dependencies (ie. st 0x0) which is really different that what you<br class="gmail_msg">
are looking for.<br class="gmail_msg">
<br class="gmail_msg">
* Reduce stall counts. A bunch of instructions have a read latency which is the<br class="gmail_msg">
number of cycles before they can actually read the sources. This should be<br class="gmail_msg">
fairly easy to implement but will require some reverse engineering to<br class="gmail_msg">
completely understand the idea.<br class="gmail_msg">
<br class="gmail_msg">
This is my last contribution for the Nouveau driver for a while because I have<br class="gmail_msg">
been hired by Valve to work on radeonsi. Do not expect such perf improvements<br class="gmail_msg">
with radeonsi because it already performs really well, unlike Nouveau. But<br class="gmail_msg">
with time and patience we can do better. :-)<br class="gmail_msg">
<br class="gmail_msg">
This series is also available from my fdo account:<br class="gmail_msg">
<a href="https://cgit.freedesktop.org/~hakzsam/mesa/log/?h=gm107_scheduler" rel="noreferrer" class="gmail_msg" target="_blank">https://cgit.freedesktop.org/~hakzsam/mesa/log/?h=gm107_scheduler</a><br class="gmail_msg">
<br class="gmail_msg">
Please, review!<br class="gmail_msg">
Thanks.<br class="gmail_msg">
<br class="gmail_msg">
[1] <a href="https://github.com/NervanaSystems/maxas/wiki/Control-Codes" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/NervanaSystems/maxas/wiki/Control-Codes</a><br class="gmail_msg">
<br class="gmail_msg">
Samuel Pitoiset (5):<br class="gmail_msg">
nv50/ir: do not insert texture barriers on gm107<br class="gmail_msg">
nv50/ir: improve instruction pipelining on gm107<br class="gmail_msg">
nv50/ir: use sched control codes for gm107 builtins<br class="gmail_msg">
nvc0: use sched control codes for gm107 blitter shader<br class="gmail_msg">
nvc0: use sched control codes for gm107 MP counters code<br class="gmail_msg">
<br class="gmail_msg">
src/gallium/drivers/nouveau/codegen/lib/gm107.asm | 40 +-<br class="gmail_msg">
.../drivers/nouveau/codegen/lib/gm107.asm.h | 40 +-<br class="gmail_msg">
.../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 771 ++++++++++++++++++++-<br class="gmail_msg">
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 3 +-<br class="gmail_msg">
.../nouveau/codegen/nv50_ir_target_gm107.cpp | 253 +++++++<br class="gmail_msg">
.../drivers/nouveau/codegen/nv50_ir_target_gm107.h | 7 +<br class="gmail_msg">
.../drivers/nouveau/nvc0/nvc0_query_hw_sm.c | 88 +--<br class="gmail_msg">
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 20 +-<br class="gmail_msg">
8 files changed, 1127 insertions(+), 95 deletions(-)<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
2.11.0<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
mesa-dev mailing list<br class="gmail_msg">
<a href="mailto:mesa-dev@lists.freedesktop.org" class="gmail_msg" target="_blank">mesa-dev@lists.freedesktop.org</a><br class="gmail_msg">
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br class="gmail_msg">
</blockquote></div>