From fb40b449cd8b71748f0b2b1bb790fe263b033feb Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 18 Sep 2024 14:39:10 -0700 Subject: [PATCH] intel/brw: Define ptl_register_blocks() helper. Since this calculation will be needed in many places to set up the state of each shader stage. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_compiler.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index ce6c5f5fd5b..52fb1458232 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -569,6 +569,17 @@ struct brw_stage_prog_data { u_printf_info *printf_info; }; +/** + * Convert a number of GRF registers used (grf_used in prog_data) into + * a number of GRF register blocks supported by the hardware on PTL+. + */ +static inline unsigned +ptl_register_blocks(unsigned grf_used) +{ + const unsigned n = DIV_ROUND_UP(grf_used, 32) - 1; + return (n < 6 ? n : 7); +} + static inline uint32_t * brw_stage_prog_data_add_params(struct brw_stage_prog_data *prog_data, unsigned nr_new_params)