diff options
author | Iago Toral Quiroga <itoral@igalia.com> | 2023-03-09 19:05:19 +0100 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-10-13 22:37:44 +0000 |
commit | d25aec0d386bee7f628e336c9b5939011bb7edc3 (patch) | |
tree | 1c00732d3ca6beb669c056c887dd1790a341e466 /src/broadcom | |
parent | 8a698888031d3d59e1b25386bd78f6e59182723f (diff) | |
download | mesa-d25aec0d386bee7f628e336c9b5939011bb7edc3.tar.gz mesa-d25aec0d386bee7f628e336c9b5939011bb7edc3.tar.bz2 mesa-d25aec0d386bee7f628e336c9b5939011bb7edc3.zip |
v3d,v3dv: fix compute for V3D 7.1.6+
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
Diffstat (limited to 'src/broadcom')
-rw-r--r-- | src/broadcom/vulkan/v3dv_cmd_buffer.c | 25 | ||||
-rw-r--r-- | src/broadcom/vulkan/v3dv_private.h | 3 | ||||
-rw-r--r-- | src/broadcom/vulkan/v3dv_queue.c | 2 |
3 files changed, 24 insertions, 6 deletions
diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index d22d7a081c6..dc01a0fa06e 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -4124,6 +4124,7 @@ cmd_buffer_emit_pre_dispatch(struct v3dv_cmd_buffer *cmd_buffer) void v3dv_cmd_buffer_rewrite_indirect_csd_job( + struct v3dv_device *device, struct v3dv_csd_indirect_cpu_job_info *info, const uint32_t *wg_counts) { @@ -4143,8 +4144,15 @@ v3dv_cmd_buffer_rewrite_indirect_csd_job( submit->cfg[1] = wg_counts[1] << V3D_CSD_CFG012_WG_COUNT_SHIFT; submit->cfg[2] = wg_counts[2] << V3D_CSD_CFG012_WG_COUNT_SHIFT; - submit->cfg[4] = DIV_ROUND_UP(info->wg_size, 16) * - (wg_counts[0] * wg_counts[1] * wg_counts[2]) - 1; + uint32_t num_batches = DIV_ROUND_UP(info->wg_size, 16) * + (wg_counts[0] * wg_counts[1] * wg_counts[2]); + /* V3D 7.1.6 and later don't subtract 1 from the number of batches */ + if (device->devinfo.ver < 71 || + (device->devinfo.ver == 71 && device->devinfo.rev < 6)) { + submit->cfg[4] = num_batches - 1; + } else { + submit->cfg[4] = num_batches; + } assert(submit->cfg[4] != ~0); if (info->needs_wg_uniform_rewrite) { @@ -4177,6 +4185,7 @@ cmd_buffer_create_csd_job(struct v3dv_cmd_buffer *cmd_buffer, uint32_t **wg_uniform_offsets_out, uint32_t *wg_size_out) { + struct v3dv_device *device = cmd_buffer->device; struct v3dv_pipeline *pipeline = cmd_buffer->state.compute.pipeline; assert(pipeline && pipeline->shared_data->variants[BROADCOM_SHADER_COMPUTE]); struct v3dv_shader_variant *cs_variant = @@ -4235,18 +4244,26 @@ cmd_buffer_create_csd_job(struct v3dv_cmd_buffer *cmd_buffer, if (wg_size_out) *wg_size_out = wg_size; - submit->cfg[4] = num_batches - 1; + /* V3D 7.1.6 and later don't subtract 1 from the number of batches */ + if (device->devinfo.ver < 71 || + (device->devinfo.ver == 71 && device->devinfo.rev < 6)) { + submit->cfg[4] = num_batches - 1; + } else { + submit->cfg[4] = num_batches; + } assert(submit->cfg[4] != ~0); assert(pipeline->shared_data->assembly_bo); struct v3dv_bo *cs_assembly_bo = pipeline->shared_data->assembly_bo; submit->cfg[5] = cs_assembly_bo->offset + cs_variant->assembly_offset; - submit->cfg[5] |= V3D_CSD_CFG5_PROPAGATE_NANS; if (cs_variant->prog_data.base->single_seg) submit->cfg[5] |= V3D_CSD_CFG5_SINGLE_SEG; if (cs_variant->prog_data.base->threads == 4) submit->cfg[5] |= V3D_CSD_CFG5_THREADING; + /* V3D 7.x has made the PROPAGATE_NANS bit in CFG5 reserved */ + if (device->devinfo.ver < 71) + submit->cfg[5] |= V3D_CSD_CFG5_PROPAGATE_NANS; if (cs_variant->prog_data.cs->shared_size > 0) { job->csd.shared_memory = diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index c46ffbcf9be..01651534b12 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -1816,7 +1816,8 @@ void v3dv_cmd_buffer_copy_query_results(struct v3dv_cmd_buffer *cmd_buffer, void v3dv_cmd_buffer_add_tfu_job(struct v3dv_cmd_buffer *cmd_buffer, struct drm_v3d_submit_tfu *tfu); -void v3dv_cmd_buffer_rewrite_indirect_csd_job(struct v3dv_csd_indirect_cpu_job_info *info, +void v3dv_cmd_buffer_rewrite_indirect_csd_job(struct v3dv_device *device, + struct v3dv_csd_indirect_cpu_job_info *info, const uint32_t *wg_counts); void v3dv_cmd_buffer_add_private_obj(struct v3dv_cmd_buffer *cmd_buffer, diff --git a/src/broadcom/vulkan/v3dv_queue.c b/src/broadcom/vulkan/v3dv_queue.c index bb7880a33c1..a0942cf1c96 100644 --- a/src/broadcom/vulkan/v3dv_queue.c +++ b/src/broadcom/vulkan/v3dv_queue.c @@ -354,7 +354,7 @@ handle_csd_indirect_cpu_job(struct v3dv_queue *queue, if (memcmp(group_counts, info->csd_job->csd.wg_count, sizeof(info->csd_job->csd.wg_count)) != 0) { - v3dv_cmd_buffer_rewrite_indirect_csd_job(info, group_counts); + v3dv_cmd_buffer_rewrite_indirect_csd_job(queue->device, info, group_counts); } return VK_SUCCESS; |