I'm developing an Electron app and I'm trying to figure out if there's a way (a flag?) that lets you limit gpu-process system memory usage
The gpu-process usually takes 500+ MB on content rich pages.
I'd like to force it to a lower value or programmatically force the app to use high-performance (discrete) GPU, which would move the cache from system memory to GPU memory.
I tried running the app with all of the gpu related flags found on this website but nothing worked:
--gpu-program-cache-size-kb=1000
--disable-accelerated-video-decode
reduces gpu-process memory a little bit but increases CPU usage--enable-gpu-memory-buffer-compositor-resources --enable-gpu-rasterization --ignore-gpu-blocklist --enable-zero-copy
chrome://gpu
doesn't active GPU#1 either: --gpu-vendor-id=0x10da --gpu-device-id=0x1c8a
--force_high_performance_gpu
doesn't seem to do anything on Windows.Hybrid graphics (NVIDIA Optimus, AMD Switchable graphics) is one of the early-state technology (in usability terms) even though it was introduced a long time ago.
Technically the same applies to video cards in general. They were not supposed to be controlled by every application. Only specific software (Operation systems, Drivers, some games, and graphic tools) was responsible to manage them.
These days everything is changing. Machine Learning and other basic tasks could be done on GPU relatively easily. And we even have some public tools for that. But still, it's hard and non-standardized.
There were many attempts to control GPU in different software. You already tried many flags. And most of them are outdated already. There was even a moment when Chrom(ium) and Firefox were banned in Nvidia's drivers. i.e. There was no legit way to use them together.
Windows took control over GPUs a long time ago. So neither drivers nor applications are responsible for the decision of what hardware will be used. And chromium does not seem to care much about this control anymore. They can't even fix the white screen problem with hardware acceleration.
Linux distributives have a worse position. Drivers are not even fully functional. Canonical with NVidia made NVidia Prime to control hybrid graphics. And there are many other non-official solutions for that.
I just want to say that it's better to avoid attempts to control GPU until it's super critical. The situation could be changed many times.
Nevertheless, the best approach would be to register your application in Windows for higher performance before your application is started. I'm not aware if Windows provide a special tool except GUI for that. But you always can try to register the application through the Regedit
in the path: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\DirectX\UserGpuPreferences
.
Or you can rename your application executable to something famous so Windows will prioritize it without extra settings. e.g. chrome.exe
-> doomx64.exe
.