ir3: use nir_opt_offsets for SSBO accesses
Signed-off-by: Job Noorman <jnoorman@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28664>
This commit is contained in:
@@ -215,7 +215,7 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s)
|
|||||||
progress |= OPT(s, nir_lower_pack);
|
progress |= OPT(s, nir_lower_pack);
|
||||||
progress |= OPT(s, nir_opt_constant_folding);
|
progress |= OPT(s, nir_opt_constant_folding);
|
||||||
|
|
||||||
static const nir_opt_offsets_options offset_options = {
|
const nir_opt_offsets_options offset_options = {
|
||||||
/* How large an offset we can encode in the instr's immediate field.
|
/* How large an offset we can encode in the instr's immediate field.
|
||||||
*/
|
*/
|
||||||
.uniform_max = (1 << 9) - 1,
|
.uniform_max = (1 << 9) - 1,
|
||||||
@@ -225,7 +225,10 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s)
|
|||||||
*/
|
*/
|
||||||
.shared_max = (1 << 12) - 1,
|
.shared_max = (1 << 12) - 1,
|
||||||
|
|
||||||
.buffer_max = ~0,
|
.buffer_max = 0,
|
||||||
|
.max_offset_cb = ir3_nir_max_imm_offset,
|
||||||
|
.max_offset_data = compiler,
|
||||||
|
.allow_offset_wrap = true,
|
||||||
};
|
};
|
||||||
progress |= OPT(s, nir_opt_offsets, &offset_options);
|
progress |= OPT(s, nir_opt_offsets, &offset_options);
|
||||||
|
|
||||||
|
@@ -156,6 +156,8 @@ is_intrinsic_load(nir_intrinsic_op op)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t ir3_nir_max_imm_offset(nir_intrinsic_instr *intrin, const void *data);
|
||||||
|
|
||||||
ENDC;
|
ENDC;
|
||||||
|
|
||||||
#endif /* IR3_NIR_H_ */
|
#endif /* IR3_NIR_H_ */
|
||||||
|
@@ -287,3 +287,23 @@ ir3_nir_lower_io_offsets(nir_shader *shader)
|
|||||||
|
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
ir3_nir_max_imm_offset(nir_intrinsic_instr *intrin, const void *data)
|
||||||
|
{
|
||||||
|
const struct ir3_compiler *compiler = data;
|
||||||
|
|
||||||
|
if (!compiler->has_ssbo_imm_offsets)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
switch (intrin->intrinsic) {
|
||||||
|
case nir_intrinsic_load_ssbo_ir3:
|
||||||
|
if ((nir_intrinsic_access(intrin) & ACCESS_CAN_REORDER))
|
||||||
|
return 255; /* isam.v */
|
||||||
|
return 127; /* ldib.b */
|
||||||
|
case nir_intrinsic_store_ssbo_ir3:
|
||||||
|
return 127; /* stib.b */
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user