filament
filament copied to clipboard
Memory usage increase while using Vulkan back-end on Android
Describe the bug I am in the process of upgrading the Filament version in my app from 1.9.25 to 1.24.0, however, I noticed a large memory usage increase in devices running Vulkan as the back-end. I tested every Filament version in between and noticed the increase in version 1.10.4.
Memory usage increases by about 66%
- Samsung A10s -> 350 to 580MB
- Redmi Note 8 -> 420 to 700MB
To Reproduce Run application using Vulkan as back-end in both versions 1.10.3 and 1.10.4
Expected behavior Stable memory usage or a reason for the increase
Smartphone (please complete the following information):
- Devices: Samsung A10s (PowerVR 8320) and Redmi Note 8 (Adreno 610)
- OS: Android 11
Additional context The release notes for version 1.10.4 says "Vulkan: performance improvements on Mali."
There are a couple of possible culprits in file VulkanConstants.h
VK_MAX_COMMAND_BUFFERS = 3; increase to 10
VK_MAX_PIPELINE_AGE = 5; increase to 10
Was this increase intentional on Android? Are there any reports from other users showing the benefits of making these changes? PowerVR GPU is weak and buggy, but new phones powered by this GPU are still being sold, mostly in Asia and South America, and they represent about 20% of my user base and the crash rate is already too high with the current memory usage.
Thanks for the bug report! As I recall, those new constant values were based on experimentation with a Pixel 4, it helped performance by reducing the frequency of GPU alloc / free churn.
Another possible culprit is the fact that we changed how we used the vkmemalloc library, which was causing catastrophic slowness on devices such as Mali that have their bufferImageGranularity property set to 1.
We recently upgraded vkmemalloc (#5691) which allowed us to back to using its simpler API. This became active starting with v1.24.0.
We've made many improvements since the time that we increased those constants. We should probably re-evaluate what we want for "good" default values.
We should also consider making them configurable after #5556 lands.
ok, thank you. I have had a beta version (with Filament 1.24.0) tested for a week or so, and no issues have been reported, actually, some users reported better performance. I will release it to production to a small subset of users to see if there are any issues. Anyway, it would be great to be able to change those values when creating the engine.
Thanks, I'll keep the bug open to track the work for making these constants configurable.
Out of curiosity, what does your app do? We're generally interested in what folks are using Filament for. :)
It is a drum kit simulator called DrumKnee 3D. I ported it from iOS recently.
@pixelflinger this one should be easy, just make some of the stuff in VulkanConstants.h configurable