Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCrash when allocating unreasonable amounts of texture memory #3210
Conversation
|
Looks like some of the PF code needs updating:
|
| let report = self.report_memory(); | ||
| let AllocError::OverBudget(budget) = error; | ||
| error!( | ||
| "Excessive GPU alloc: tex cache:{}, targets:{}, gpu cache:{}, vertex data: {} budget: {}", |
This comment has been minimized.
This comment has been minimized.
bholley
Oct 17, 2018
Contributor
I think it'd be preferable to derive(Display) on MemoryReport and use that here, so that any additional fields we add will automatically get picked up here.
ebf59ac
to
a31bf6c
|
I fixed the failing rawtest and added a commit that prints a message and skips the rawtests that rely on a the device pixel ratio being 1.0 when it is not the case to avoid having to comment them out locally. |
|
Generally looks good to me - should we change the |
| @@ -1583,6 +1609,8 @@ impl Device { | |||
| self.release_depth_target(texture.get_dimensions()); | |||
| } | |||
|
|
|||
| self.deallocated_gpu_memory(texture.size_in_bytes()); | |||
This comment has been minimized.
This comment has been minimized.
gw3583
Oct 21, 2018
Collaborator
Are there any other places in the code we re-size / re-init textures that we need to account for the change in allocation size?
This comment has been minimized.
This comment has been minimized.
nical
Oct 21, 2018
Author
Collaborator
I didn't find any. Our code to resize texture currently destroys and re-creates bigger textures (with possibly a blit from the old texture to the new one.
This comment has been minimized.
This comment has been minimized.
bholley
Oct 22, 2018
Contributor
Yeah, this was a change I had to make for immutable storage. Texture re-initialization is no more.
| } | ||
| } | ||
|
|
||
| fn log_allocation_failure(&self, error: AllocError) { |
This comment has been minimized.
This comment has been minimized.
gw3583
Oct 21, 2018
Collaborator
It would be neat to have both the current budget and allocated memory available as a profile counter in the debug profiler overlay. This would allow us to get a sense of total texture allocations on pages as we browse, and make sure that the counters are working correctly.
This comment has been minimized.
This comment has been minimized.
nical
Oct 21, 2018
Author
Collaborator
Since the budget is there to force a crash when things are so wrong that it's best not to keep the browser alive, I don't think it is very interesting to display.
That said I think that displaying some number that we think is reasonable for an average page, or some number beyond which we believe something worth investigating (but not to the point that we'd crash the browser) would be useful, as well as displaying the current allocated texture memory.
|
That try push needs another try |
Ah, yes indeed, there we go: https://treeherder.mozilla.org/#/jobs?repo=try&revision=56a80fb4e9602775ab0530099c9c443ba43b26fa |
|
@nical Looks like this is ready to merge now, is that right? |
|
Per discussion on IRC late last week, we should rebase it on top of [1] when that lands to avoid having multiple mechanisms for tracking GPU memory usage. |
|
|
|
Looks like the bug mentioned above has landed - so I guess this needs a rebase on top of that? |
|
It just needs to be rebased to use the global atomic byte count rather than tracking it per-device. That should be trivial, then it can land. |
|
ping @nical - should we get this rebased and landed? |
|
Sorry for the delay, I need to more or less re-write the PR so I'll close it for now. |
nical commentedOct 17, 2018
•
edited by larsbergstrom
Track texture allocations and crash if we go beyond a certain budget. The budget (2Gb by default) is configurable in the renderer options. I'll experiment with various thresholds in gecko (which probably need to take into account the window size) when this hits mozilla-central.
Fixes #3207.
This change is