[Mesa-dev] [PATCH 04/15] radv: add debug flags for syncing shaders after every draw call
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Sep 12 10:35:41 UTC 2017
To improve GPU hangs detection when shaders are stucked.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/amd/vulkan/radv_cmd_buffer.c | 15 +++++++++++++++
src/amd/vulkan/radv_debug.h | 1 +
src/amd/vulkan/radv_device.c | 1 +
3 files changed, 17 insertions(+)
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 22d8adc5c8..edf44dabe1 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -32,6 +32,7 @@
#include "sid.h"
#include "gfx9d.h"
#include "vk_format.h"
+#include "radv_debug.h"
#include "radv_meta.h"
#include "ac_debug.h"
@@ -367,6 +368,20 @@ void radv_cmd_buffer_trace_emit(struct radv_cmd_buffer *cmd_buffer)
static void
radv_cmd_buffer_after_draw(struct radv_cmd_buffer *cmd_buffer)
{
+ if (cmd_buffer->device->debug_flags & RADV_DEBUG_SYNC_SHADERS) {
+ enum radv_cmd_flush_bits flags;
+
+ /* Force wait for graphics/compute engines to be idle. */
+ flags = RADV_CMD_FLAG_PS_PARTIAL_FLUSH |
+ RADV_CMD_FLAG_CS_PARTIAL_FLUSH;
+
+ si_cs_emit_cache_flush(cmd_buffer->cs, false,
+ cmd_buffer->device->physical_device->rad_info.chip_class,
+ NULL, 0,
+ radv_cmd_buffer_uses_mec(cmd_buffer),
+ flags);
+ }
+
radv_cmd_buffer_trace_emit(cmd_buffer);
}
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index e45c987e6a..5c9cbade47 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -40,6 +40,7 @@ enum {
RADV_DEBUG_DUMP_SPIRV = 0x400,
RADV_DEBUG_VM_FAULTS = 0x800,
RADV_DEBUG_ZERO_VRAM = 0x1000,
+ RADV_DEBUG_SYNC_SHADERS = 0x2000,
};
enum {
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 6b96a3da4a..5101bd7cb2 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -413,6 +413,7 @@ static const struct debug_control radv_debug_options[] = {
{"spirv", RADV_DEBUG_DUMP_SPIRV},
{"vmfaults", RADV_DEBUG_VM_FAULTS},
{"zerovram", RADV_DEBUG_ZERO_VRAM},
+ {"syncshaders", RADV_DEBUG_SYNC_SHADERS},
{NULL, 0}
};
--
2.14.1
More information about the mesa-dev
mailing list