Summary: | Piglit shaders@ssa@fs-if-def-else-break fails with sb but passes with R600_DEBUG=nosb | ||
---|---|---|---|
Product: | Mesa | Reporter: | Gert Wollny <gw.fossdev> |
Component: | Drivers/Gallium/r600 | Assignee: | Default DRI bug account <dri-devel> |
Status: | RESOLVED FIXED | QA Contact: | Default DRI bug account <dri-devel> |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Test that fails with r600/sb
Test that doesn't fail |
Description
Gert Wollny
2017-06-15 09:07:31 UTC
Also shaders@ssa@fs-while-loop-rotate-value fails with sb enabled, but passes with nosb. spec@glsl-1.10@execution@variable-indexing@ vs-output-array-float-index-wr vs-output-array-vec3-index-wr vs-output-array-vec4-index-wr also fail with sb enabled but pass without it. Hello, I'm using an HD6310 graphic card and when I'm running piglit with mesa-17.3-rc5, I have the same error. What's the status of this bug ? Best regards, Romain Naour After reviewing the byte code of fs-if-def-else-break I found that the problem is a bit different: In the original code BREAK is called in the loop when (KC0[0].x != 0) just like implemented in the glsl code: 0002 LOOP_START_DX10 @36 0004 ALU_PUSH_BEFORE 2 @48 KC0[CB0:0-15] 0048 2 x: MOV R2.x, 1 0050 3 MP x: PRED_SETNE_INT R6.x, KC0[0].x, 0 0006 JUMP @10 << JUMP is called if condition fails 0008 ALU 2 @52 0052 4 x: MOV R2.x, [0x00000002 2.8026e-45].x 0054 00000002 0010 ELSE @16 POP:1 0012 LOOP_BREAK @34 0014 POP @16 POP:1 however, in the optimized code the assignment and its branch is optimized away, and BREAK is called when (KC0[0].x == 0), i.e. exactly the opposite of the 0002 LOOP_START_DX10 @30 0004 PUSH @6 0006 ALU 1 @38 KC0[CB0:0-15] 0038 2 M x: PRED_SETNE_INT __.x, KC0[0].x, 0 0008 JUMP @14 POP:1 << JUMP is called if condition fails 0010 LOOP_BREAK @28 0012 POP @14 POP:1 i.e. the optimizer removed the if branch, keeps the else branch but acts as if it were the if branch, hence the failure. With a bit more digging I found out that the sb optimizer simply drops the ELSE if no ALU instructions are found in the else branch, i.e. while(cond1) if (cond2) { a = b + c; } else { break; } } becomes while(cond1) if (cond2) { a = b + c; break; } } after the first sb/dce_cleanup pass, and this is obviously wrong. With the break in the if path this is not a problem. I'll attach two piglits that illustrate the behaviour. Created attachment 136995 [details]
Test that fails with r600/sb
Other then in the fs-if-def-else-break piglit here the if path doesn't get completely optimized away.
Created attachment 136996 [details]
Test that doesn't fail
Here the break is in the if path and other then ELSE the JUMP instruction doesn't get optimized away. Since the ELSE clause contains an ALU clause it also doesn't get optimized away.
Should be resolved with commit 8d633f067b8a3d74e3f39faea0773a229d4b93b3 Author: Dave Airlie <airlied@redhat.com> Date: Tue Jan 30 16:38:51 2018 +1000 r600/sb: insert the else clause when we might depart from a loop |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.