intel: split URB space between task and mesh proportionally to entry sizes
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Wed, 12 Apr 2023 14:17:52 +0000 (16:17 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 14 Apr 2023 15:43:50 +0000 (15:43 +0000)
Improves performance by 0.5-2.5% in vk_meshlet_cadscene
depending on the model.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22445>

src/intel/common/intel_urb_config.c

index be9c68f..d19645c 100644 (file)
@@ -323,19 +323,24 @@ intel_get_mesh_urb_config(const struct intel_device_info *devinfo,
 
    float task_urb_share = 0.0f;
    if (r.task_entry_size_64b > 0) {
-      /* By default, assign 10% to TASK and 90% to MESH, since we expect MESH
-       * to use larger URB entries since it contains all the vertex and
-       * primitive data.  Environment variable allow us to tweak it.
+      /* By default, split memory between TASK and MESH proportionally to
+       * their entry sizes. Environment variable allow us to tweak it.
        *
        * TODO(mesh): Re-evaluate if this is a good default once there are more
        * workloads.
        */
       static int task_urb_share_percentage = -1;
-      if (task_urb_share_percentage < 0) {
+      if (task_urb_share_percentage == -1) {
          task_urb_share_percentage =
-            MIN2(debug_get_num_option("INTEL_MESH_TASK_URB_SHARE", 10), 100);
+            MIN2(debug_get_num_option("INTEL_MESH_TASK_URB_SHARE", -2), 100);
+      }
+
+      if (task_urb_share_percentage >= 0) {
+         task_urb_share = task_urb_share_percentage / 100.0f;
+      } else {
+         task_urb_share = 1.0f * r.task_entry_size_64b /
+                          (r.task_entry_size_64b + r.mesh_entry_size_64b);
       }
-      task_urb_share = task_urb_share_percentage / 100.0f;
    }
 
    const unsigned one_task_urb_kb = ALIGN(r.task_entry_size_64b * 64, 1024) / 1024;