radv: stop emulating number of generated primitives by GS on GFX11
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 1 Nov 2022 09:24:36 +0000 (10:24 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 8 Nov 2022 16:15:16 +0000 (16:15 +0000)
According to RadeonSI, only GFX10 and GFX10.3 need to emulate.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19319>

src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_query.c
src/amd/vulkan/radv_shader_info.c

index 9639e460e35c23402debbd5b4782f19b1f27cf16..45ada569c0ce609beda5dee45a7131e5eef2dd9b 100644 (file)
@@ -874,6 +874,9 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
                                (device->rad_info.gfx_level >= GFX11 ||
                                 (device->instance->perftest_flags & RADV_PERFTEST_NGG_STREAMOUT));
 
+   device->emulate_ngg_gs_query_pipeline_stat =
+      device->use_ngg && device->rad_info.gfx_level < GFX11;
+
    /* Determine the number of threads per wave for all stages. */
    device->cs_wave_size = 64;
    device->ps_wave_size = 64;
index 6dc5e360f7777357c9c2f4e207bb1726ed1e5f8f..ac85089c227a3125f2d1016fc60b2bca3972fb8d 100644 (file)
@@ -290,6 +290,9 @@ struct radv_physical_device {
    /* Whether to enable NGG streamout. */
    bool use_ngg_streamout;
 
+   /* Whether to emulate the number of primitives generated by GS. */
+   bool emulate_ngg_gs_query_pipeline_stat;
+
    /* Number of threads per wave. */
    uint8_t ps_wave_size;
    uint8_t cs_wave_size;
index 389e5938bf131fda8113cc4d60f55ddee58e6856..e931616a7e0f79070a6c359acdc0828e5ea44f14 100644 (file)
@@ -1091,8 +1091,9 @@ radv_CreateQueryPool(VkDevice _device, const VkQueryPoolCreateInfo *pCreateInfo,
     * hardware if GS uses the legacy path. When NGG GS is used, the hardware can't know the number
     * of generated primitives and we have to increment it from the shader using a plain GDS atomic.
     */
-   pool->uses_gds = device->physical_device->use_ngg &&
-                    ((pool->pipeline_stats_mask & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT) ||
+   pool->uses_gds = (device->physical_device->emulate_ngg_gs_query_pipeline_stat &&
+                     (pool->pipeline_stats_mask & VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT)) ||
+                    (device->physical_device->use_ngg &&
                      pCreateInfo->queryType == VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT);
 
    switch (pCreateInfo->queryType) {
index 979dd28ba442ba2865a3889df84be677c7ca1169..8e8ec56c1ad76d36be8545ca96e7b4508562d683 100644 (file)
@@ -1205,7 +1205,8 @@ gfx10_get_ngg_query_info(const struct radv_device *device, struct radv_pipeline_
 {
    struct radv_shader_info *info = gs_stage ? &gs_stage->info : &es_stage->info;
 
-   info->gs.has_ngg_pipeline_stat_query = !!gs_stage;
+   info->gs.has_ngg_pipeline_stat_query =
+      device->physical_device->emulate_ngg_gs_query_pipeline_stat && !!gs_stage;
    info->has_ngg_xfb_query = gs_stage ? !!gs_stage->nir->xfb_info : !!es_stage->nir->xfb_info;
    info->has_ngg_prim_query = pipeline_key->primitives_generated_query || info->has_ngg_xfb_query;
 }