ac/sqtt: add ac_sqtt_se_is_disabled() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 26 Apr 2023 12:08:44 +0000 (14:08 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 28 Apr 2023 16:55:12 +0000 (16:55 +0000)
It can be shared between RADV and RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22732>

src/amd/common/ac_sqtt.c
src/amd/common/ac_sqtt.h
src/amd/vulkan/radv_sqtt.c
src/gallium/drivers/radeonsi/si_sqtt.c

index 235ee18..5e596fe 100644 (file)
@@ -251,3 +251,14 @@ ac_sqtt_get_next_cmdbuf_id(struct ac_thread_trace_data *data,
 
    return cb_id;
 }
+
+bool
+ac_sqtt_se_is_disabled(const struct radeon_info *info, unsigned se)
+{
+   /* FIXME: SQTT only works on SE0 for some unknown reasons. */
+   if (info->gfx_level == GFX11)
+      return se != 0;
+
+   /* No active CU on the SE means it is disabled. */
+   return info->cu_mask[se][0] == 0;
+}
index 758ea61..a3b0208 100644 (file)
@@ -560,4 +560,6 @@ bool ac_check_profile_state(const struct radeon_info *info);
 union rgp_sqtt_marker_cb_id ac_sqtt_get_next_cmdbuf_id(struct ac_thread_trace_data *data,
                                                        enum amd_ip_type ip_type);
 
+bool ac_sqtt_se_is_disabled(const struct radeon_info *info, unsigned se);
+
 #endif
index ab7c17b..0f5d413 100644 (file)
@@ -35,17 +35,6 @@ radv_is_instruction_timing_enabled(void)
    return debug_get_bool_option("RADV_THREAD_TRACE_INSTRUCTION_TIMING", true);
 }
 
-static bool
-radv_se_is_disabled(struct radv_device *device, unsigned se)
-{
-   /* FIXME: SQTT only works on SE0 for some unknown reasons. */
-   if (device->physical_device->rad_info.gfx_level == GFX11 && se != 0)
-      return true;
-
-   /* No active CU on the SE means it is disabled. */
-   return device->physical_device->rad_info.cu_mask[se][0] == 0;
-}
-
 static uint32_t
 gfx11_get_thread_trace_ctrl(struct radv_device *device, bool enable)
 {
@@ -102,7 +91,7 @@ radv_emit_thread_trace_start(struct radv_device *device, struct radeon_cmdbuf *c
       uint64_t shifted_va = data_va >> SQTT_BUFFER_ALIGN_SHIFT;
       int first_active_cu = ffs(device->physical_device->rad_info.cu_mask[se][0]);
 
-      if (radv_se_is_disabled(device, se))
+      if (ac_sqtt_se_is_disabled(rad_info, se))
          continue;
 
       /* Target SEx and SH0. */
@@ -353,7 +342,7 @@ radv_emit_thread_trace_stop(struct radv_device *device, struct radeon_cmdbuf *cs
    }
 
    for (unsigned se = 0; se < max_se; se++) {
-      if (radv_se_is_disabled(device, se))
+      if (ac_sqtt_se_is_disabled(&device->physical_device->rad_info, se))
          continue;
 
       /* Target SEi and SH0. */
@@ -835,7 +824,7 @@ radv_get_thread_trace(struct radv_queue *queue, struct ac_thread_trace *thread_t
       struct ac_thread_trace_se thread_trace_se = {0};
       int first_active_cu = ffs(device->physical_device->rad_info.cu_mask[se][0]);
 
-      if (radv_se_is_disabled(device, se))
+      if (ac_sqtt_se_is_disabled(rad_info, se))
          continue;
 
       if (!ac_is_thread_trace_complete(&device->physical_device->rad_info, &device->thread_trace,
index 3bbf3dc..5d2438e 100644 (file)
@@ -71,18 +71,6 @@ si_thread_trace_init_bo(struct si_context *sctx)
    return true;
 }
 
-static bool
-si_se_is_disabled(struct si_context* sctx, unsigned se)
-{
-   /* FIXME: SQTT only works on SE0 for some unknown reasons. */
-   if (sctx->screen->info.gfx_level == GFX11)
-      return se != 0;
-
-   /* No active CU on the SE means it is disabled. */
-   return sctx->screen->info.cu_mask[se][0] == 0;
-}
-
-
 static void
 si_emit_thread_trace_start(struct si_context* sctx,
                            struct radeon_cmdbuf *cs,
@@ -99,7 +87,7 @@ si_emit_thread_trace_start(struct si_context* sctx,
       uint64_t data_va = ac_thread_trace_get_data_va(&sctx->screen->info, sctx->thread_trace, va, se);
       uint64_t shifted_va = data_va >> SQTT_BUFFER_ALIGN_SHIFT;
 
-      if (si_se_is_disabled(sctx, se))
+      if (ac_sqtt_se_is_disabled(&sctx->screen->info, se))
          continue;
 
       /* Target SEx and SH0. */
@@ -390,7 +378,7 @@ si_emit_thread_trace_stop(struct si_context *sctx,
    }
 
    for (unsigned se = 0; se < max_se; se++) {
-      if (si_se_is_disabled(sctx, se))
+      if (ac_sqtt_se_is_disabled(&sctx->screen->info, se))
          continue;
 
       radeon_begin(cs);
@@ -640,7 +628,7 @@ si_get_thread_trace(struct si_context *sctx,
 
       struct ac_thread_trace_se thread_trace_se = {0};
 
-      if (si_se_is_disabled(sctx, se))
+      if (ac_sqtt_se_is_disabled(&sctx->screen->info, se))
          continue;
 
       if (!ac_is_thread_trace_complete(&sctx->screen->info, sctx->thread_trace, info)) {