Mesa (main): radv: Enable ray queries by default

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 24 08:52:35 UTC 2022


Module: Mesa
Branch: main
Commit: 5f5882ef08c3ecbeb438888f3a10ce4a01233534
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f5882ef08c3ecbeb438888f3a10ce4a01233534

Author: Konstantin Seurer <konstantin.seurer at gmail.com>
Date:   Tue May 10 08:58:38 2022 +0200

radv: Enable ray queries by default

Ray queries and acceleration structure builds
are quite stable now and so we can enable those
features for CI and more feedback and bug reports.

Signed-off-by: Konstantin Seurer <konstantin.seurer at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16007>

---

 docs/envvars.rst                |  8 ++++----
 src/amd/vulkan/radv_debug.h     |  2 +-
 src/amd/vulkan/radv_device.c    |  8 ++++----
 src/amd/vulkan/radv_meta.c      |  2 +-
 src/amd/vulkan/radv_pipeline.c  |  4 ++--
 src/amd/vulkan/radv_private.h   |  4 ++--
 src/amd/vulkan/radv_rt_common.c | 14 +++++++++-----
 7 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/docs/envvars.rst b/docs/envvars.rst
index 26baca653ff..1503651ff93 100644
--- a/docs/envvars.rst
+++ b/docs/envvars.rst
@@ -722,9 +722,9 @@ RADV driver environment variables
       enable wave32 for compute shaders (GFX10+)
    ``dccmsaa``
       enable DCC for MSAA images
-   ``force_emulate_rt``
-      forces ray-tracing to be emulated in software,
-      even if there is hardware support.
+   ``emulate_rt``
+      forces ray-tracing to be emulated in software on GFX10_3+ and enables
+      rt extensions with older hardware.
    ``gewave32``
       enable wave32 for vertex/tess/geometry shaders (GFX10+)
    ``localbos``
@@ -738,7 +738,7 @@ RADV driver environment variables
    ``nggc``
       enable NGG culling on GPUs where it's not enabled by default (GFX10.1 only).
    ``rt``
-      enable rt extensions whose implementation is still experimental.
+      enable rt pipelines whose implementation is still experimental.
    ``sam``
       enable optimizations to move more driver internal objects to VRAM.
    ``rtwave64``
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index 754d5c82a11..3c8a4ed70a1 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -79,7 +79,7 @@ enum {
    RADV_PERFTEST_SAM = 1u << 7,
    RADV_PERFTEST_RT = 1u << 8,
    RADV_PERFTEST_NGGC = 1u << 9,
-   RADV_PERFTEST_FORCE_EMULATE_RT = 1u << 10,
+   RADV_PERFTEST_EMULATE_RT = 1u << 10,
    RADV_PERFTEST_NV_MS = 1u << 11,
    RADV_PERFTEST_RT_WAVE_64 = 1u << 12,
 };
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 21c345054c1..482a8ebaba0 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -400,7 +400,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
    *ext = (struct vk_device_extension_table){
       .KHR_8bit_storage = true,
       .KHR_16bit_storage = true,
-      .KHR_acceleration_structure = radv_enable_rt(device),
+      .KHR_acceleration_structure = radv_enable_rt(device, false),
       .KHR_bind_memory2 = true,
       .KHR_buffer_device_address = true,
       .KHR_copy_commands2 = true,
@@ -435,8 +435,8 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
       .KHR_pipeline_executable_properties = true,
       .KHR_pipeline_library = !device->use_llvm,
       .KHR_push_descriptor = true,
-      .KHR_ray_query = radv_enable_rt(device),
-      .KHR_ray_tracing_pipeline = radv_enable_rt(device),
+      .KHR_ray_query = radv_enable_rt(device, false),
+      .KHR_ray_tracing_pipeline = radv_enable_rt(device, true),
       .KHR_relaxed_block_layout = true,
       .KHR_sampler_mirror_clamp_to_edge = true,
       .KHR_sampler_ycbcr_conversion = true,
@@ -921,7 +921,7 @@ static const struct debug_control radv_perftest_options[] = {{"localbos", RADV_P
                                                              {"sam", RADV_PERFTEST_SAM},
                                                              {"rt", RADV_PERFTEST_RT},
                                                              {"nggc", RADV_PERFTEST_NGGC},
-                                                             {"force_emulate_rt", RADV_PERFTEST_FORCE_EMULATE_RT},
+                                                             {"emulate_rt", RADV_PERFTEST_EMULATE_RT},
                                                              {"nv_ms", RADV_PERFTEST_NV_MS},
                                                              {"rtwave64", RADV_PERFTEST_RT_WAVE_64},
                                                              {NULL, 0}};
diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index 2a24429d60b..cb014bb47ce 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -587,7 +587,7 @@ radv_device_init_meta(struct radv_device *device)
    if (result != VK_SUCCESS)
       goto fail_fmask_expand;
 
-   if (radv_enable_rt(device->physical_device)) {
+   if (radv_enable_rt(device->physical_device, false)) {
       result = radv_device_init_accel_struct_build_state(device);
       if (result != VK_SUCCESS)
          goto fail_accel_struct_build;
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index b17b97bc8b0..c52928199b1 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -271,8 +271,8 @@ radv_get_hash_flags(const struct radv_device *device, bool stats)
 
    if (device->physical_device->use_ngg_culling)
       hash_flags |= RADV_HASH_SHADER_USE_NGG_CULLING;
-   if (device->instance->perftest_flags & RADV_PERFTEST_FORCE_EMULATE_RT)
-      hash_flags |= RADV_HASH_SHADER_FORCE_EMULATE_RT;
+   if (device->instance->perftest_flags & RADV_PERFTEST_EMULATE_RT)
+      hash_flags |= RADV_HASH_SHADER_EMULATE_RT;
    if (device->physical_device->rt_wave_size == 64)
       hash_flags |= RADV_HASH_SHADER_RT_WAVE64;
    if (device->physical_device->cs_wave_size == 32)
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 9d7bca31a9c..e880d453ea5 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1760,7 +1760,7 @@ struct radv_event {
 #define RADV_HASH_SHADER_USE_NGG_CULLING   (1 << 13)
 #define RADV_HASH_SHADER_ROBUST_BUFFER_ACCESS (1 << 14)
 #define RADV_HASH_SHADER_ROBUST_BUFFER_ACCESS2 (1 << 15)
-#define RADV_HASH_SHADER_FORCE_EMULATE_RT      (1 << 16)
+#define RADV_HASH_SHADER_EMULATE_RT            (1 << 16)
 #define RADV_HASH_SHADER_SPLIT_FMA             (1 << 17)
 #define RADV_HASH_SHADER_RT_WAVE64             (1 << 18)
 
@@ -1780,7 +1780,7 @@ uint32_t radv_get_hash_flags(const struct radv_device *device, bool stats);
 
 bool radv_rt_pipeline_has_dynamic_stack_size(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo);
 
-bool radv_enable_rt(const struct radv_physical_device *pdevice);
+bool radv_enable_rt(const struct radv_physical_device *pdevice, bool rt_pipelines);
 
 bool radv_emulate_rt(const struct radv_physical_device *pdevice);
 
diff --git a/src/amd/vulkan/radv_rt_common.c b/src/amd/vulkan/radv_rt_common.c
index 47172766e1a..e44c4f5ba0f 100644
--- a/src/amd/vulkan/radv_rt_common.c
+++ b/src/amd/vulkan/radv_rt_common.c
@@ -26,17 +26,21 @@
 #include "radv_acceleration_structure.h"
 
 bool
-radv_enable_rt(const struct radv_physical_device *pdevice)
+radv_enable_rt(const struct radv_physical_device *pdevice, bool rt_pipelines)
 {
-   return (pdevice->instance->perftest_flags & RADV_PERFTEST_RT) && !pdevice->use_llvm;
+   if ((pdevice->rad_info.gfx_level < GFX10_3 && !radv_emulate_rt(pdevice)) || pdevice->use_llvm)
+      return false;
+
+   if (rt_pipelines)
+      return pdevice->instance->perftest_flags & RADV_PERFTEST_RT;
+
+   return true;
 }
 
 bool
 radv_emulate_rt(const struct radv_physical_device *pdevice)
 {
-   assert(radv_enable_rt(pdevice));
-   return pdevice->rad_info.gfx_level < GFX10_3 ||
-          (pdevice->instance->perftest_flags & RADV_PERFTEST_FORCE_EMULATE_RT);
+   return pdevice->instance->perftest_flags & RADV_PERFTEST_EMULATE_RT;
 }
 
 void



More information about the mesa-commit mailing list