[Mesa-dev] [PATCH 4/5] radeonsi: fix the VGT performance tweak for small instances

Marek Olšák maraeo at gmail.com
Fri Sep 9 15:05:54 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

Based on the VGT spec.

The Vulkan driver doesn't do it optimally and they plan to fix it.
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index d3e6e1a..e44147f 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -311,28 +311,29 @@ static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx,
 			wd_switch_on_eop = true;
 
 		/* Hawaii hangs if instancing is enabled and WD_SWITCH_ON_EOP is 0.
 		 * We don't know that for indirect drawing, so treat it as
 		 * always problematic. */
 		if (sctx->b.family == CHIP_HAWAII &&
 		    (info->indirect || info->instance_count > 1))
 			wd_switch_on_eop = true;
 
 		/* Performance recommendation for 4 SE Gfx7-8 parts if
-		 * instances are smaller than a primgroup. Ignore the fact
-		 * primgroup_size is a primitive count, not vertex count.
-		 * Don't do anything for indirect draws.
+		 * instances are smaller than a primgroup.
+		 * Assume indirect draws always use small instances.
+		 * This is needed for good VS wave utilization.
 		 */
 		if (sctx->b.chip_class <= VI &&
 		    sctx->b.screen->info.max_se >= 4 &&
-		    !info->indirect &&
-		    info->instance_count > 1 && info->count < primgroup_size)
+		    (info->indirect ||
+		     (info->instance_count > 1 &&
+		      si_num_prims_for_vertices(info) < primgroup_size)))
 			wd_switch_on_eop = true;
 
 		/* Required on CIK and later. */
 		if (sctx->b.screen->info.max_se > 2 && !wd_switch_on_eop)
 			ia_switch_on_eoi = true;
 
 		/* Required by Hawaii and, for some special cases, by VI. */
 		if (ia_switch_on_eoi &&
 		    (sctx->b.family == CHIP_HAWAII ||
 		     (sctx->b.chip_class == VI &&
-- 
2.7.4



More information about the mesa-dev mailing list