mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
pvr, pco: switch to usc generated zero-init workgroup memory shaders
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37439>
This commit is contained in:
parent
c2127bf4f7
commit
585cca9b2f
6 changed files with 42 additions and 35 deletions
|
|
@ -59,3 +59,10 @@ usclib_barrier(uint num_slots, uint counter_offset)
|
|||
|
||||
nir_mutex_pco(PCO_MUTEX_ID_BARRIER, PCO_MUTEX_OP_RELEASE_WAKEUP);
|
||||
}
|
||||
|
||||
void
|
||||
usclib_zero_init_wg_mem(uint count)
|
||||
{
|
||||
for (unsigned u = 0; u < count; ++u)
|
||||
nir_store_shared(0, u * sizeof(uint32_t), 0, 0x1, 4, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,19 +61,3 @@ void pvr_hard_code_get_idfwdf_program(
|
|||
*usc_shareds_out = 12U;
|
||||
*usc_temps_out = 4U;
|
||||
}
|
||||
|
||||
void pvr_hard_code_get_zero_wgmem_program(
|
||||
UNUSED const struct pvr_device_info *const dev_info,
|
||||
UNUSED unsigned start,
|
||||
UNUSED unsigned count,
|
||||
struct util_dynarray *program_out,
|
||||
uint32_t *usc_temps_out)
|
||||
{
|
||||
uint32_t shader[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
mesa_loge("No hard coded zero wg memory program. Returning empty program.");
|
||||
|
||||
util_dynarray_append_mem(program_out, sizeof(shader), &shader[0]);
|
||||
|
||||
*usc_temps_out = 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,4 @@ void pvr_hard_code_get_idfwdf_program(
|
|||
uint32_t *usc_shareds_out,
|
||||
uint32_t *usc_temps_out);
|
||||
|
||||
void pvr_hard_code_get_zero_wgmem_program(
|
||||
const struct pvr_device_info *const dev_info,
|
||||
unsigned start,
|
||||
unsigned count,
|
||||
struct util_dynarray *program_out,
|
||||
uint32_t *usc_temps_out);
|
||||
|
||||
#endif /* PVR_HARDCODE_SHADERS_H */
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "pvr_private.h"
|
||||
#include "pvr_robustness.h"
|
||||
#include "pvr_types.h"
|
||||
#include "pvr_usc.h"
|
||||
#include "util/log.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/ralloc.h"
|
||||
|
|
@ -1037,23 +1038,19 @@ static VkResult pvr_compute_pipeline_compile(
|
|||
|
||||
if (compute_pipeline->cs_data.cs.zero_shmem) {
|
||||
uint32_t start = compute_pipeline->cs_data.cs.shmem.start;
|
||||
uint32_t count = start + compute_pipeline->cs_data.cs.shmem.count;
|
||||
struct util_dynarray usc_program;
|
||||
uint32_t count = compute_pipeline->cs_data.cs.shmem.count;
|
||||
pco_shader *zero_init_shader =
|
||||
pvr_usc_zero_init_wg_mem(pco_ctx, start, count);
|
||||
|
||||
util_dynarray_init(&usc_program, NULL);
|
||||
pvr_hard_code_get_zero_wgmem_program(
|
||||
&device->pdevice->dev_info,
|
||||
start,
|
||||
count,
|
||||
&usc_program,
|
||||
&compute_state->coeff_update_shader_temps);
|
||||
compute_state->coeff_update_shader_temps =
|
||||
pco_shader_data(zero_init_shader)->common.temps;
|
||||
|
||||
result = pvr_gpu_upload_usc(device,
|
||||
usc_program.data,
|
||||
usc_program.size,
|
||||
pco_shader_binary_data(zero_init_shader),
|
||||
pco_shader_binary_size(zero_init_shader),
|
||||
cache_line_size,
|
||||
&compute_state->coeff_update_shader_bo);
|
||||
util_dynarray_fini(&usc_program);
|
||||
ralloc_free(zero_init_shader);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_free_shader;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "pco/pco_common.h"
|
||||
#include "pco/pco_data.h"
|
||||
#include "pco_uscgen_programs.h"
|
||||
#include "pco/usclib/pco_usclib.h"
|
||||
#include "pvr_common.h"
|
||||
#include "pvr_formats.h"
|
||||
#include "pvr_private.h"
|
||||
|
|
@ -1296,3 +1297,25 @@ pco_shader *pvr_uscgen_clear_attach(pco_ctx *ctx,
|
|||
|
||||
return build_shader(ctx, b.shader, &data);
|
||||
}
|
||||
|
||||
pco_shader *
|
||||
pvr_usc_zero_init_wg_mem(pco_ctx *ctx, unsigned start, unsigned count)
|
||||
{
|
||||
pco_data data = {
|
||||
.cs.shmem.start = start,
|
||||
.cs.shmem.count = count,
|
||||
.common.uses.usclib = true,
|
||||
};
|
||||
|
||||
nir_builder b = nir_builder_init_simple_shader(MESA_SHADER_COMPUTE,
|
||||
pco_nir_options(),
|
||||
"zero_init_wg_mem(%u, %u)",
|
||||
start,
|
||||
count);
|
||||
|
||||
usclib_zero_init_wg_mem(&b, nir_imm_int(&b, count));
|
||||
|
||||
nir_jump(&b, nir_jump_return);
|
||||
|
||||
return build_shader(ctx, b.shader, &data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,4 +96,7 @@ pvr_uscgen_clear_attach_index(struct pvr_clear_attach_props *props)
|
|||
|
||||
#define PVR_NUM_CLEAR_ATTACH_SHADERS 20U
|
||||
|
||||
pco_shader *
|
||||
pvr_usc_zero_init_wg_mem(pco_ctx *ctx, unsigned start, unsigned count);
|
||||
|
||||
#endif /* PVR_USC_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue