Mesa (staging/22.0): radv: Disable NGG for GS with suboptimal output vertex count.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 13 20:18:53 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: 83f738516d4c93baa6007421f8d95396de42da36
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=83f738516d4c93baa6007421f8d95396de42da36
Author: Timur Kristóf <timur.kristof at gmail.com>
Date: Wed Apr 6 14:15:50 2022 +0200
radv: Disable NGG for GS with suboptimal output vertex count.
When GS has a lot of output vertices: In this case,
the occupancy of NGG GS is very low because API GS invocations
can't even occupy a single Wave32 wave.
Therefore the legacy pipeline performs better here.
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6260
Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15767>
(cherry picked from commit 94706601fa2f52605d6e488f30fad9a0e2440612)
---
.pick_status.json | 2 +-
src/amd/vulkan/radv_pipeline.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index 2b9c77885fa..617a040281c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1492,7 +1492,7 @@
"description": "radv: Disable NGG for GS with suboptimal output vertex count.",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"because_sha": null
},
{
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 8bfac4d55f7..a60ecaabc25 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -3086,6 +3086,19 @@ radv_fill_shader_info(struct radv_pipeline *pipeline,
infos[MESA_SHADER_TESS_EVAL].is_ngg = false;
}
+ if (nir[MESA_SHADER_GEOMETRY] &&
+ nir[MESA_SHADER_GEOMETRY]->info.gs.vertices_out >= 9) {
+ /* GS has suboptimal number of output vertices. In this case,
+ * the occupancy of NGG GS is very low, and API GS invocations
+ * can't even occupy a single Wave32 wave.
+ * Therefore the legacy pipeline performs better here.
+ */
+ if (nir[MESA_SHADER_TESS_EVAL])
+ infos[MESA_SHADER_TESS_EVAL].is_ngg = false;
+ else
+ infos[MESA_SHADER_VERTEX].is_ngg = false;
+ }
+
gl_shader_stage last_xfb_stage = MESA_SHADER_VERTEX;
for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) {
More information about the mesa-commit
mailing list