Closed Bug 1528332 Opened 7 years ago Closed 5 years ago

Linux startup performance is bad because of shader compilation

Categories

(Core :: Graphics: WebRender, enhancement, P3)

enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jrmuizel, Unassigned)

References

(Blocks 1 open bug)

Details

We're twice as slow as non WebRender. It would be good to know why.

Even though the profiles don't have symbols we experimentally determined that the problem is mostly shader compilation (400ms)

Priority: -- → P3
Summary: Linux startup performance → Linux startup performance is bad because of shader compilation
Flags: needinfo?(nical.bugzilla)

I tried enabling shader binary caching and on my nvidia GPU (proprietary driver), the results aren't very encouraging:

1st run:

 -- shader creation took 0.085248 ms
 -- add new program binary
 -- shader creation took 0.034697 ms
 -- add new program binary
 -- shader creation took 0.040414 ms
 -- add new program binary
 -- shader creation took 0.021777 ms
 -- add new program binary
 -- shader creation took 0.034441 ms
 -- add new program binary
 -- shader creation took 0.039966 ms
 -- add new program binary
 -- shader creation took 0.061193 ms
 -- add new program binary
 -- shader creation took 0.095624 ms
 -- add new program binary
 -- shader creation took 0.087658 ms
 -- add new program binary
 -- shader creation took 0.136278 ms
 -- add new program binary
 -- shader creation took 0.142131 ms
 -- add new program binary
 -- update disk cache

2nd run:

 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- load program binary
 -- update disk cache
 -- update disk cache
 -- shader creation took 0.80261 ms
 -- shader creation took 0.204994 ms
 -- shader creation took 0.30304 ms
 -- shader creation took 0.521692 ms
 -- shader creation took 0.224012 ms
 -- shader creation took 0.290144 ms
 -- shader creation took 0.514493 ms
 -- shader creation took 0.982213 ms
 -- shader creation took 0.503457 ms
 -- shader creation took 0.361135 ms
 -- shader creation took 0.560699 ms
 -- shader creation took 0.717563 ms

I'll try on intel.

I am getting similar numbers on intel. It looks like both drivers are doing a better job at caching shaders than we can with program binaries.

Flags: needinfo?(nical.bugzilla)

Actually, it could be that the cost of compiling shaders is shifted to when the binary is loaded instead of on the first draw call, in which case the disk cache could still be a win but I am not measuring the right thing.

Sotaro, did you observe a similar behavior when you implemented the disk cache?

Flags: needinfo?(sotaro.ikeda.g)

(In reply to Nicolas Silva [:nical] from comment #7)

Sotaro, did you observe a similar behavior when you implemented the disk cache?

Yea, I saw similar behavior. When I implemented the disk cache, gl.program_binary() took long time on linux. Then I did not enabled the disk cache on linux.

Flags: needinfo?(sotaro.ikeda.g)

We discussed this during the daily. Jamie also had a similar experience with mesa's internal shader cache being pretty better than what we can achieve with with chached shader binaries. I suppose nvidia has similar optimizations.

In addition, since this bug was filed, jamie added pre-optimzed shaders which helped a lot with shader compilation time.
In the logging I recorded earlier shader compilation is in the order of 0.1 ms which is good enough.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.