Geometry shaders can output many vertices and thus have higher VPM memory pressure as a result. It is possible that too wide geometry shader dispatches exceed the maximum available VPM output allocated, in which case we need to reduce the dispatch width until we can fit the VPM memory requirements. Supported dispatch widths for geometry shaders are 16, 8, 4, 1.
There is a limit in the number of VPM output sectors that can be used by a geometry shader that we can meet by lowering the dispatch width at compile time, however, at draw time we need to revisit this number and, together with other elements that can contribute to total VPM memory requirements, decide on a configuration that can fit the program into the available VPM memory. Ideally, we also want to aim for not using more than half of the available memory so we that we can run a pair of bin and render programs in parallel.
v2: fixed language in comment and typo in commit log. (Alejandro)
76fc8c8bb19 v3d: compute appropriate VPM memory configuration for geometry shader workloads
src/broadcom/compiler/v3d_compiler.h | 7 +
src/broadcom/compiler/vir.c | 18 +++
src/gallium/drivers/v3d/v3dx_draw.c | 258 +++++++++++++++++++++++++++++++----
3 files changed, 259 insertions(+), 24 deletions(-)