WebGL shader loop unroll issue via angle d3d with ps_3_0

RESOLVED WONTFIX

Status

()

Core
Canvas: WebGL
RESOLVED WONTFIX
6 years ago
a year ago

People

(Reporter: Florian Bösch, Assigned: kvark)

Tracking

(Blocks: 1 bug)

14 Branch
Unspecified
Windows
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.8 Safari/536.11

Steps to reproduce:

Run this code: http://codeflow.org/issues/unroll-problem/


Actual results:

Output indicated 2 minutes time to error and shown this error message:

"error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (9 iterations), use the [unroll(n)] attribute to force an exact higher number"

On the shader info log. CPU use was at 25% and the page/browser was non-responding.


Expected results:

Linux/OSX have no problem with this code and show an output of "Compile Time: 11ms".

Updated

6 years ago
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
(Assignee)

Comment 1

a year ago
Unable to repro on Linux x64 with FF 53.0a1, "Intel(R) HD Graphics 5500 (Broadwell GT2)"
(Reporter)

Comment 2

a year ago
You need to try on Windows since it's a Direct3D HLSL compiler related problem.
(Assignee)

Updated

a year ago
OS: Linux → Windows
(Assignee)

Comment 3

a year ago
Florian, I tested on Windows 7 with Radeon Rx 480, no issues either.
(Reporter)

Comment 4

a year ago
If you've merged in some angle fixes or updated the d3d runtime to dx11, the bug could be fixed by those. If you want to know when you incidentially "fixed" it you'll have to bisect FF versions all the way back to 2012 since apparently only now somebody got around to look at the bug.
(Assignee)

Comment 5

a year ago
Ah, apologies, that was OSX (sharing the monitor and input got me confused).
Loading on actual Windows gets FF stuck. Investigating...
(Assignee)

Updated

a year ago
Assignee: nobody → kvark
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(Assignee)

Comment 6

a year ago
Looks like Angle puts `[unroll]` on top of the loop, and then FXC is having problems actually doing it.
Related - https://codereview.appspot.com/7139055/
(Assignee)

Comment 7

a year ago
Created attachment 8822527 [details]
test.hlsl

Attaching HLSL produced by Angle
I think we're also unrolling loops always, when we don't always need to.
(Assignee)

Comment 9

a year ago
Created attachment 8822528 [details]
Output.txt

Attached the FXC output when compiling the Angle-produced HTML with targets ps_3_0, ps_4_0, ps_5_0:

ps_3_0 gives up after ~2 minutes, although reporting it stopped after 710 iterations (6 iterations per second?)
ps_4_0 and ps_5_0 succeed in 13 seconds

One possible solution is to submit a patch to Angle limiting the maximum loop unroll, similar to https://codereview.appspot.com/7139055/. Although, it doesn't seem straightforward that it will be merged, especially given the freely adjustable constant it would introduce.

Another solution is to force angle to work with D3D11 and HLSL 4.0 targets, if possible. Given that we are fading out WinXP, I don't see much value in supporting D3D9 anyway.
Attachment #8822528 - Flags: feedback?(jgilbert)
(Assignee)

Comment 10

a year ago
Florian, I accidentally had "webgl.angle.try-d3d11 == false" on that Windows machine. When I set it back to default (true), the page loads normally, reporting: "Compile Time: 2140ms". I suppose the issue only persists where d3d11 is not available or fails to activate. Could you check again and confirm if it's still a problem?
Flags: needinfo?(pyalot)
(Reporter)

Comment 11

a year ago
I currently can't test on a windows configuration, but I know that d3d11 helps some.

However, 2140ms is much too long to compile a shader. It takes 21ms to compile on Linux (and probably similar amounts on other OS'es).

Lengthy shader compile times have been a persistent problem for WebGL and should be eliminated.
(Assignee)

Comment 12

a year ago
Florian, I do agree that 2140ms is little outside of the comfort zone, and we should be doing something about it. However, this bug doesn't seem to be a proper medium, since the original report was about FXC running out of time after 2 minutes, which was a much more severe issue that is no longer a problem.

Jeff, do we have a general bug for tracking Angle's shader compiling performance?
Flags: needinfo?(jgilbert)
(In reply to Dzmitry Malyshau from comment #12)
> Florian, I do agree that 2140ms is little outside of the comfort zone, and
> we should be doing something about it. However, this bug doesn't seem to be
> a proper medium, since the original report was about FXC running out of time
> after 2 minutes, which was a much more severe issue that is no longer a
> problem.
> 
> Jeff, do we have a general bug for tracking Angle's shader compiling
> performance?

I don't think so. I made one: Bug 1326482
Flags: needinfo?(jgilbert)
Blocks: 1326482
Hardware: x86 → Unspecified
Attachment #8822528 - Flags: feedback?(jgilbert)
(Assignee)

Comment 14

a year ago
Ok, thanks Jeff! I consider this issue to be closed then.
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
Flags: needinfo?(pyalot)
Resolution: --- → FIXED
Resolution: FIXED → WONTFIX
Summary: WebGL shader loop unroll issue via angle d3d → WebGL shader loop unroll issue via angle d3d with ps_3_0
You need to log in before you can comment on or make changes to this bug.