v3d: Add and use a define for the number of channels in a QPU invocation.
authorEric Anholt <eric@anholt.net>
Thu, 11 Apr 2019 20:27:22 +0000 (13:27 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 12 Apr 2019 22:58:28 +0000 (15:58 -0700)
A shader invocation always executes 16 channels together, so we often end
up multiplying things by this magic 16 number.  Give it a name.

src/broadcom/common/v3d_limits.h
src/broadcom/compiler/vir.c
src/broadcom/compiler/vir_register_allocate.c

index e21ee246eff0bfd756c6302ca0d51859da3fbc73..77684762203aaa0a8fa8fc3e3f82eb6c6d202fea 100644 (file)
 #ifndef V3D_LIMITS_H
 #define V3D_LIMITS_H
 
+/* Number of channels a QPU thread executes in parallel.  Also known as
+ * gl_SubGroupSizeARB.
+ */
+#define V3D_CHANNELS 16
+
 #define V3D_MAX_FS_INPUTS 64
 #define V3D_MAX_VS_INPUTS 64
 
index 4f83f03c7b2b253401178753252397efd5341740..551542f33bb8b2c2486583ac751340f5b6e499bf 100644 (file)
@@ -628,7 +628,7 @@ v3d_vs_set_prog_data(struct v3d_compile *c,
          * batches.
          */
         assert(c->devinfo->vpm_size);
-        int sector_size = 16 * sizeof(uint32_t) * 8;
+        int sector_size = V3D_CHANNELS * sizeof(uint32_t) * 8;
         int vpm_size_in_sectors = c->devinfo->vpm_size / sector_size;
         int half_vpm = vpm_size_in_sectors / 2;
         int vpm_output_sectors = half_vpm - prog_data->vpm_input_size;
index a55b23f74ed79e0113d787a330e77aca85de1917..1ffb37f1a38794f7da72edbf8e2c22e5225fe50a 100644 (file)
@@ -205,7 +205,7 @@ v3d_spill_reg(struct v3d_compile *c, int spill_temp)
 
         if (!is_uniform) {
                 uint32_t spill_offset = c->spill_size;
-                c->spill_size += 16 * sizeof(uint32_t);
+                c->spill_size += V3D_CHANNELS * sizeof(uint32_t);
 
                 if (spill_offset == 0)
                         v3d_setup_spill_base(c);
@@ -624,7 +624,8 @@ v3d_register_allocate(struct v3d_compile *c, bool *spilled)
          * conformance tests to make sure that spilling works.
          */
         int force_register_spills = 0;
-        if (c->spill_size < 16 * sizeof(uint32_t) * force_register_spills) {
+        if (c->spill_size <
+            V3D_CHANNELS * sizeof(uint32_t) * force_register_spills) {
                 int node = v3d_choose_spill_node(c, g, temp_to_node);
                 if (node != -1) {
                         v3d_spill_reg(c, map[node].temp);