Closed Bug 1885217 (webgpu-fxc) Opened 1 year ago Closed 1 month ago

WebGPU: shader compilation with FXC is slow, broken, and abandoned

Categories

(Core :: Graphics: WebGPU, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: ErichDonGubler, Unassigned)

References

(Blocks 3 open bugs, )

Details

Firefox currently uses Microsoft's FXC by default for its DX12 back end. FXC is a legacy component that has multiple significant issues:

  • First and foremost, FXC is slow, easily taking over 10 seconds to compile relatively simple shaders.
  • FXC is incorrect; it has some shader compilation bugs that have no roadmap for resolution.

We need to overcome both of these issues in order to have an objectively good experience with shader compilation in our implementation of WebGPU.

Possible solutions we know of so far:

  • Microsoft's DirectX Shader Compiler (AKA "DXC") is a successor to FXC that fixes these issues. We could consume it, and thereby resolve the above problems.
  • Another approach might be to write a compilation backend for Firefox's shader transpiler (Naga) for DXIL (DXC's new intermediate representation), so we can emit it directly (viz., wgpu#4155).

:jgilbert has noted that our most likely path to success is to work with Microsoft directly, and ensure that DXC is suitable to ship for us if we run into obstacles.

Summary: WebGPU: shader compilation with FXC is broken and abandoned → WebGPU: shader compilation with FXC is slow, broken, and abandoned
See Also: → 1620134

Currently planning on resolving this via bug 1903302.

Severity: -- → S3
Type: enhancement → defect
Depends on: webgpu-dxc
See Also: → 1908916
See Also: → 1863983
Depends on: 1938710
Blocks: 1938710
No longer depends on: 1938710
Blocks: 1939980
Blocks: 1939943
Blocks: 1939985

(In reply to Erich Gubler [:ErichDonGubler] (he/him) from comment #2)

Currently planning on resolving this via bug 1903302.

I see that issue (1903302) is RESOLVED FIXED but this issue remains open. Pardon my unfamiliarity with reading how Bugzilla represents things. I wanted to check if this is indeed correctly still open because FF on Windows uses FXC in the current release?

I have been experiencing about a 3-5 second startup delay in https://editor.graphite.art upon creating a new document, which is when Vello is initialized (and its shaders have to be compiled). Could someone please confirm for me that this observed delay is likely attributed to FXC being used under the hood, so I know to keep an eye on this issue as the future solution to the initialization freeze in Graphite? And if this is the cause, are there any estimates about when this might be completed or if there are mitigations we can apply on our end within Graphite? (For example, is there a way to avoid this freezing the main thread while shader compilation occurs?)

Flags: needinfo?(egubler)

This issue should be closed. Thank you for following up!

Please do file a new bug; your problem is unfortunately almost certainly a problem with DXC, if you're still experiencing it, since FXC was never exposed on Firefox Beta or Stable. To help you with getting all the right information in for that, here's some stuff I already know we'll ask you for over there:

  • Can you please attach the report from about:support as an attachment, using the text from Copy raw data to clipboard? You can paste directly into comment entry, and Bugzilla will ask you if you want to create an attachment.

  • Can you please upload a performance profile of this issue using Firefox's built-in profiling? See here for instructions on gathering one: https://profiler.firefox.com/docs/#/./guide-getting-started

    Once you've created a permalink for the profile, include it in the OP so we can take a look.

Status: NEW → RESOLVED
Closed: 1 month ago
Flags: needinfo?(egubler)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.