[Mesa-dev] r600/sb loop issue
Dave Airlie
airlied at gmail.com
Wed Dec 3 14:43:23 PST 2014
Hi Vadim,
I've been looking with Glenn's help into a bug in sb for a couple of
weeks now triggered by a change in how GLSL generates switch
statements.
I understand you probably aren't too interested in r600g but I believe
I'm hitting a design level problem and I would like some advice.
So it appears that GLSL can create loops that don't repeat for switch
statements, and it appears SB wasn't ready to handle such a thing.
sb has the ->is_loop() and it just checks !repeats.empty(), so this
meant in the finalizer code we'd fall into the if statement which
would then assert.
I hacked/fixed (more hacked), this in 7b0067d23a6f64cf83c42e7f11b2cd4100c569fe
which attempts to detect single pass loops and handle things that way.
However this lead to stack depth calculations being incorrectly done,
so I moved the single loop detect into the is_loop check, (see
attached patch).
This fixes the rendering in some places, but lead to a regression in
tests/shaders/glsl-vs-continue-in-switch-in-do-while.shader_test
error at : PHI t76||FP at R3.x, t128||FP at R3.x, t115||FP at R3.x,
t102||FP at R3.x, t89||FP at R3.x : expected
operand value t115||FP at R3.x, gpr contains t17||FP at R3.x
error at : PHI t76||FP at R3.x, t128||FP at R3.x, t115||FP at R3.x,
t102||FP at R3.x, t89||FP at R3.x : expected
operand value t102||FP at R3.x, gpr contains t17||FP at R3.x
Now Glenn suspected this was due to the is_loop check in
sb_shader.cpp:create_bbs,
and changing that check to only detect repeating loops removes that issue,
but introduces stack sizing issues again, resulting in lockups/random rendering.
So I just want to ask had you considered single loops with an always
break in sb design,
and perhaps some idea where things are going so wrong with the
register alloc above.
I suspect I'll keep digging into this, but its getting to the edges of
the brain space/time I can find!
Dave.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-r600g-sb-detect-empty-once-iterated-loops.patch
Type: text/x-patch
Size: 4021 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141204/6d420f6d/attachment.bin>
More information about the mesa-dev
mailing list