Closed Bug 1505449 Opened 6 years ago Closed 5 years ago

Reduce GPU cache memory usage

Categories

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

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(11 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
The GPU cache grows dynamically, but never shrinks, even during memory pressure. This means that loading francine (which pumps the GPU cache above 100MB) will permanently bake that large texture size into the runtime until the window is closed.

We can be smarter here.
Generalizing this bug a bit. I've got patches.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=e71152f3841fc6e02a81f977c9b9824572740b3e
Summary: Support shrinking the GPU cache → Reduce GPU cache memory usage
This does two things:
* Sizes the GPU cache debug display to the size of the GPU cache.
* Tracks allocations/frees so that the debug display shows all live
  blocks, rather than just the ones allocated in the last frame.

Depends on D15453
Unconditionally making the texture a render target doesn't really have
any downsides, and a blit is much faster than an upload from CPU. This
matters because we're going to make the gpu cache grown more granularly
(and thus more often).

We also get rid of the unnecessary rounding-up for height, since this is
already managed by gpu_cache.rs.

Depends on D15454
This saves megabytes of memory.

Depends on D15455
There's no overhead to doing so, and right now we use an entire row for
any allocation > 128 blocks, which is suboptimal.Doing this dramatically
improves utilization on francine.

Depends on D15456
We never need to take slices that cross rows. This approach is easier on
the heap allocator (since it doesn't require contiguous memory) and leads
to less slop.

Depends on D15457
We end up with an array of Blocks in the megabytes, and we can make them
smaller.

Depends on D15458
https://github.com/servo/webrender/pull/3452 for everything but the last patch, which is still waiting on review.
Depends on D15477
Hit a weird issue with the patch from comment 10, described at [1]. I've dropped it from the push to get the rest landed now. NI kvark for thoughts on [1].

[1] https://github.com/servo/webrender/pull/3452#issuecomment-450506767
Flags: needinfo?(dmalyshau)
(In reply to Bobby Holley (:bholley) from comment #14)
> Hit a weird issue with the patch from comment 10, described at [1]. I've
> dropped it from the push to get the rest landed now. NI kvark for thoughts
> on [1].
> 
> [1] https://github.com/servo/webrender/pull/3452#issuecomment-450506767

This turned out to be [1]. Landing with a workaround in [2]. Will file a gecko-side bug for the ANGLE issue.

[1] https://bugs.chromium.org/p/angleproject/issues/detail?id=3039
[2] https://github.com/servo/webrender/pull/3456
Flags: needinfo?(dmalyshau)
Resolving fixed, since the main work here landed and the rest (which was on its way in bug 1517038) was just a ridealong anyway.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: