Repository navigation
perf(webgpu): stop reserving GPU memory in 128-256 MiB blocks - #215
Merged
Merged
Conversation
Devices were requested with wgpu's default memory hints, which make the Vulkan allocator reserve device memory in 128 then 256 MiB blocks and host-visible memory in 64 then 128 MiB blocks. Reserved blocks count as graphics memory in full, so a fresh device held 192 MiB with nothing in it, and a 4K texture with mips (85 MiB) cost about 128 MiB because only two fit a block. MemoryHints::MemoryUsage starts blocks at 8 MiB and gives larger resources an exact-size allocation, as Dawn does. Measured on Linux (Intel, Mesa) through the native API and a three.js WebGPURenderer scene, DRM memory before -> after: empty device 215 -> 34 MiB; scene at +384 models 287 -> 183 MiB; 16 retained 4K textures 2331 -> 1716 MiB. Frame times unchanged.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
ℹ️ Note: npm publishing is disabled for pull requests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Devices were requested with wgpu's default memory hints. On Vulkan the allocator then reserves device memory in 128 then 256 MiB blocks (host-visible in 64 then 128 MiB), and a reserved block counts as graphics memory in full. A fresh device held 192 MiB with nothing in it, and a 4K texture with mips (85 MiB) cost about 128 MiB because only two fit a block.
MemoryHints::MemoryUsagestarts blocks at 8 MiB and gives larger resources an exact-size allocation, as Dawn does.Measured on Linux (Intel, Mesa) with a headless harness on the native API and a three.js
WebGPURendererscene, process DRM memory before and after:Frame rate and render time were unchanged across the scene ramp.