zink: rip out unused kernel push constant

this was for supporting clover, but I don't care anymore

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19327>
This commit is contained in:
Mike Blumenkrantz 2022-10-26 14:18:57 -04:00 committed by Marge Bot
parent 719ce10b86
commit 82029aed88
4 changed files with 2 additions and 84 deletions

View file

@ -73,70 +73,6 @@ fields[member_idx].offset = offsetof(struct zink_gfx_push_constant, field);
#undef PUSHCONST_MEMBER
}
static void
create_cs_pushconst(nir_shader *nir)
{
#define PUSHCONST_MEMBER(member_idx, field) \
fields[member_idx].type = \
glsl_array_type(glsl_uint_type(), SIZEOF_FIELD(struct zink_cs_push_constant, field) / sizeof(uint32_t), 0); \
fields[member_idx].name = ralloc_asprintf(nir, #field); \
fields[member_idx].offset = offsetof(struct zink_cs_push_constant, field);
nir_variable *pushconst;
/* create compatible layout for the ntv push constant loader */
struct glsl_struct_field *fields = rzalloc_array(nir, struct glsl_struct_field, ZINK_CS_PUSHCONST_MAX);
PUSHCONST_MEMBER(ZINK_CS_PUSHCONST_WORK_DIM, work_dim);
pushconst = nir_variable_create(nir, nir_var_mem_push_const,
glsl_struct_type(fields, ZINK_CS_PUSHCONST_MAX, "struct", false),
"cs_pushconst");
pushconst->data.location = INT_MAX; //doesn't really matter
#undef PUSHCONST_MEMBER
}
static bool
reads_work_dim(nir_shader *shader)
{
return BITSET_TEST(shader->info.system_values_read, SYSTEM_VALUE_WORK_DIM);
}
static bool
lower_work_dim_instr(nir_builder *b, nir_instr *in, void *data)
{
if (in->type != nir_instr_type_intrinsic)
return false;
nir_intrinsic_instr *instr = nir_instr_as_intrinsic(in);
if (instr->intrinsic != nir_intrinsic_load_work_dim)
return false;
if (instr->intrinsic == nir_intrinsic_load_work_dim) {
b->cursor = nir_after_instr(&instr->instr);
nir_intrinsic_instr *load = nir_intrinsic_instr_create(b->shader, nir_intrinsic_load_push_constant);
load->src[0] = nir_src_for_ssa(nir_imm_int(b, ZINK_CS_PUSHCONST_WORK_DIM));
nir_intrinsic_set_range(load, 3 * sizeof(uint32_t));
load->num_components = 1;
nir_ssa_dest_init(&load->instr, &load->dest, 1, 32, "work_dim");
nir_builder_instr_insert(b, &load->instr);
nir_ssa_def_rewrite_uses(&instr->dest.ssa, &load->dest.ssa);
}
return true;
}
static bool
lower_work_dim(nir_shader *shader)
{
if (shader->info.stage != MESA_SHADER_KERNEL)
return false;
if (!reads_work_dim(shader))
return false;
return nir_shader_instructions_pass(shader, lower_work_dim_instr, nir_metadata_dominance, NULL);
}
static bool
lower_64bit_vertex_attribs_instr(nir_builder *b, nir_instr *instr, void *data)
{
@ -3450,9 +3386,7 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
NIR_PASS_V(nir, nir_lower_indirect_derefs, indirect_derefs_modes,
UINT32_MAX);
if (nir->info.stage == MESA_SHADER_KERNEL)
create_cs_pushconst(nir);
else
if (nir->info.stage < MESA_SHADER_COMPUTE)
create_gfx_pushconst(nir);
if (nir->info.stage == MESA_SHADER_TESS_CTRL ||
@ -3462,7 +3396,6 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir,
if (nir->info.stage < MESA_SHADER_FRAGMENT)
have_psiz = check_psiz(nir);
NIR_PASS_V(nir, lower_basevertex);
NIR_PASS_V(nir, lower_work_dim);
NIR_PASS_V(nir, nir_lower_regs_to_ssa);
NIR_PASS_V(nir, lower_baseinstance);
NIR_PASS_V(nir, lower_sparse);

View file

@ -979,11 +979,6 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
if (ctx->di.any_bindless_dirty && ctx->curr_compute->base.dd.bindless)
zink_descriptors_update_bindless(ctx);
if (BITSET_TEST(ctx->curr_compute->shader->nir->info.system_values_read, SYSTEM_VALUE_WORK_DIM))
VKCTX(CmdPushConstants)(batch->state->cmdbuf, ctx->curr_compute->base.layout, VK_SHADER_STAGE_COMPUTE_BIT,
offsetof(struct zink_cs_push_constant, work_dim), sizeof(uint32_t),
&info->work_dim);
batch->work_count++;
zink_batch_no_rp(ctx);
if (info->indirect) {

View file

@ -793,12 +793,7 @@ zink_pipeline_layout_create(struct zink_screen *screen, VkDescriptorSetLayout *d
plci.setLayoutCount = num_dsl;
VkPushConstantRange pcr[3] = {0};
if (is_compute) {
pcr[0].stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
pcr[0].offset = 0;
pcr[0].size = sizeof(struct zink_cs_push_constant);
plci.pushConstantRangeCount = 1;
} else {
if (!is_compute) {
pcr[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
pcr[0].offset = offsetof(struct zink_gfx_push_constant, draw_mode_is_indexed);
pcr[0].size = 2 * sizeof(unsigned);

View file

@ -814,11 +814,6 @@ enum zink_gfx_push_constant_member {
ZINK_GFX_PUSHCONST_MAX
};
/* create_cs_pushconst must be kept in sync with this struct */
struct zink_cs_push_constant {
unsigned work_dim;
};
/* The order of the enums MUST match the order of the zink_cs_push_constant
* members.
*/