pan/indirect_dispatch: Simplify empty command case
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 9 Jun 2021 16:00:20 +0000 (12:00 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 18:06:11 +0000 (18:06 +0000)
Job type is alone with bitsize in the bottom byte of the addressed
worse, so if we use an 8-bit store we avoid the RMW complexity.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>

src/panfrost/lib/pan_indirect_dispatch.c

index 3663b82..49729af 100644 (file)
@@ -178,11 +178,9 @@ pan_indirect_dispatch_init(struct panfrost_device *dev)
 
         nir_push_if(&b, nir_ieq(&b, num_wg_flat, zero));
         {
-                nir_ssa_def *job_type_ptr = nir_iadd(&b, job_hdr_ptr, nir_imm_int64(&b, 4 * 4));
-                nir_ssa_def *w4 = nir_load_global(&b, job_type_ptr, 4, 1, 32);
-                w4 = nir_iand_imm(&b, w4, ~0xfe);
-                w4 = nir_ior(&b, w4, nir_imm_int(&b, MALI_JOB_TYPE_NULL << 1));
-                nir_store_global(&b, job_type_ptr, 4, w4, 1);
+                nir_ssa_def *type_ptr = nir_iadd(&b, job_hdr_ptr, nir_imm_int64(&b, 4 * 4));
+                nir_ssa_def *ntype = nir_imm_intN_t(&b, (MALI_JOB_TYPE_NULL << 1) | 1, 8);
+                nir_store_global(&b, type_ptr, 1, ntype, 1);
         }
         nir_push_else(&b, NULL);
         {