[Mesa-dev] [PATCH 0/3] Sweep NIR after linking phase to free held memory
danylo.piliaiev at gmail.com
Tue Jul 10 08:51:43 UTC 2018
This patch series is a draft changes to reduce memory usage when
compiling shaders and add utility function to calculate a size of
The issue I'm attempting to fix described in the bug:
In short some 32bit games under Wine use a lot of complex shaders
compiling which leads to huge memory usage and sometimes to crashes
due to it.
The changes themselves are trivial but have some price:
After the changes shader with average complexity may link ~3-5% slower.
The savings are huge when compiling a lot of shaders:
In my test case it was around 1mb per shader where the size of nir
after sweep was 20-40kb.
Since the changes slightly slow the compilation and are useful for small
amount of cases I believe that it may be better to introduce new
environment variable to control these sweeps.
I would like to get advice whether this change is desirable and should it
be hidden behind environment variable (if yes suggestions about its name
Also I wasn't able to test the change in st_link_nir and will welcome
some help with this.
Danylo Piliaiev (3):
i965: Sweep NIR after linking phase to free held memory
st: Sweep NIR after linking phase to free held memory
ralloc: Add ralloc_calc_size to measure memory held by memory contexts
src/mesa/drivers/dri/i965/brw_link.cpp | 9 +++++++
src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 ++
src/util/ralloc.c | 30 +++++++++++++++++++++++
src/util/ralloc.h | 5 ++++
4 files changed, 46 insertions(+)
More information about the mesa-dev