[v2] radv: add an option for disabling NGG on GFX10

Submitted by Samuel Pitoiset on July 7, 2019, 5:54 p.m.

Details

Message ID 20190707175410.11221-1-samuel.pitoiset@gmail.com
State New
Headers show
Series "radv: add an option for disabling NGG on GFX10" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset July 7, 2019, 5:54 p.m.
Will be useful for testing the legacy path.

v2: add to get_hash_flags() too

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/vulkan/radv_debug.h    | 1 +
 src/amd/vulkan/radv_device.c   | 1 +
 src/amd/vulkan/radv_pipeline.c | 5 ++++-
 src/amd/vulkan/radv_private.h  | 2 ++
 4 files changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index 75e28000e14..723fabda57f 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -52,6 +52,7 @@  enum {
 	RADV_DEBUG_NOTHREADLLVM      = 0x400000,
 	RADV_DEBUG_NOBINNING         = 0x800000,
 	RADV_DEBUG_NO_LOAD_STORE_OPT = 0x1000000,
+	RADV_DEBUG_NO_NGG            = 0x2000000,
 };
 
 enum {
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 4a1078a1b52..5a92e5276d9 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -474,6 +474,7 @@  static const struct debug_control radv_debug_options[] = {
 	{"nothreadllvm", RADV_DEBUG_NOTHREADLLVM},
 	{"nobinning", RADV_DEBUG_NOBINNING},
 	{"noloadstoreopt", RADV_DEBUG_NO_LOAD_STORE_OPT},
+	{"nongg", RADV_DEBUG_NO_NGG},
 	{NULL, 0}
 };
 
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 69acfdaec7d..ff39c140572 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -157,6 +157,8 @@  static uint32_t get_hash_flags(struct radv_device *device)
 
 	if (device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH)
 		hash_flags |= RADV_HASH_SHADER_UNSAFE_MATH;
+	if (device->instance->debug_flags & RADV_DEBUG_NO_NGG)
+		hash_flags |= RADV_HASH_SHADER_NO_NGG;
 	if (device->instance->perftest_flags & RADV_PERFTEST_SISCHED)
 		hash_flags |= RADV_HASH_SHADER_SISCHED;
 	return hash_flags;
@@ -2253,7 +2255,8 @@  radv_fill_shader_keys(struct radv_device *device,
 			keys[MESA_SHADER_VERTEX].vs.out.as_es = true;
 	}
 
-	if (device->physical_device->rad_info.chip_class >= GFX10) {
+	if (!(device->instance->debug_flags & RADV_DEBUG_NO_NGG) &&
+	    device->physical_device->rad_info.chip_class >= GFX10) {
 		keys[MESA_SHADER_VERTEX].vs.out.as_ngg = true;
 	}
 
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index fd1f8972adc..21db7fbbbc9 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1390,6 +1390,8 @@  struct radv_shader_module;
 #define RADV_HASH_SHADER_IS_GEOM_COPY_SHADER (1 << 0)
 #define RADV_HASH_SHADER_SISCHED             (1 << 1)
 #define RADV_HASH_SHADER_UNSAFE_MATH         (1 << 2)
+#define RADV_HASH_SHADER_NO_NGG              (1 << 3)
+
 void
 radv_hash_shaders(unsigned char *hash,
 		  const VkPipelineShaderStageCreateInfo **stages,

Comments

r-b

On Sun, Jul 7, 2019 at 7:50 PM Samuel Pitoiset
<samuel.pitoiset@gmail.com> wrote:
>
> Will be useful for testing the legacy path.
>
> v2: add to get_hash_flags() too
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> ---
>  src/amd/vulkan/radv_debug.h    | 1 +
>  src/amd/vulkan/radv_device.c   | 1 +
>  src/amd/vulkan/radv_pipeline.c | 5 ++++-
>  src/amd/vulkan/radv_private.h  | 2 ++
>  4 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
> index 75e28000e14..723fabda57f 100644
> --- a/src/amd/vulkan/radv_debug.h
> +++ b/src/amd/vulkan/radv_debug.h
> @@ -52,6 +52,7 @@ enum {
>         RADV_DEBUG_NOTHREADLLVM      = 0x400000,
>         RADV_DEBUG_NOBINNING         = 0x800000,
>         RADV_DEBUG_NO_LOAD_STORE_OPT = 0x1000000,
> +       RADV_DEBUG_NO_NGG            = 0x2000000,
>  };
>
>  enum {
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 4a1078a1b52..5a92e5276d9 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -474,6 +474,7 @@ static const struct debug_control radv_debug_options[] = {
>         {"nothreadllvm", RADV_DEBUG_NOTHREADLLVM},
>         {"nobinning", RADV_DEBUG_NOBINNING},
>         {"noloadstoreopt", RADV_DEBUG_NO_LOAD_STORE_OPT},
> +       {"nongg", RADV_DEBUG_NO_NGG},
>         {NULL, 0}
>  };
>
> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> index 69acfdaec7d..ff39c140572 100644
> --- a/src/amd/vulkan/radv_pipeline.c
> +++ b/src/amd/vulkan/radv_pipeline.c
> @@ -157,6 +157,8 @@ static uint32_t get_hash_flags(struct radv_device *device)
>
>         if (device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH)
>                 hash_flags |= RADV_HASH_SHADER_UNSAFE_MATH;
> +       if (device->instance->debug_flags & RADV_DEBUG_NO_NGG)
> +               hash_flags |= RADV_HASH_SHADER_NO_NGG;
>         if (device->instance->perftest_flags & RADV_PERFTEST_SISCHED)
>                 hash_flags |= RADV_HASH_SHADER_SISCHED;
>         return hash_flags;
> @@ -2253,7 +2255,8 @@ radv_fill_shader_keys(struct radv_device *device,
>                         keys[MESA_SHADER_VERTEX].vs.out.as_es = true;
>         }
>
> -       if (device->physical_device->rad_info.chip_class >= GFX10) {
> +       if (!(device->instance->debug_flags & RADV_DEBUG_NO_NGG) &&
> +           device->physical_device->rad_info.chip_class >= GFX10) {
>                 keys[MESA_SHADER_VERTEX].vs.out.as_ngg = true;
>         }
>
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index fd1f8972adc..21db7fbbbc9 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -1390,6 +1390,8 @@ struct radv_shader_module;
>  #define RADV_HASH_SHADER_IS_GEOM_COPY_SHADER (1 << 0)
>  #define RADV_HASH_SHADER_SISCHED             (1 << 1)
>  #define RADV_HASH_SHADER_UNSAFE_MATH         (1 << 2)
> +#define RADV_HASH_SHADER_NO_NGG              (1 << 3)
> +
>  void
>  radv_hash_shaders(unsigned char *hash,
>                   const VkPipelineShaderStageCreateInfo **stages,
> --
> 2.22.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev