anv: add an option to disable push constant space reallocation

Already called in genX(batch_emit_push_constants_alloc) above.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39584>
This commit is contained in:
Lionel Landwerlin 2026-04-28 12:38:21 +03:00 committed by Marge Bot
parent a21da01994
commit 718a5d48b8
6 changed files with 28 additions and 23 deletions

View file

@ -34,6 +34,7 @@ static const driOptionDescription anv_dri_options[] = {
DRI_CONF_NO_16BIT(false)
DRI_CONF_INTEL_BINDING_TABLE_BLOCK_SIZE(BINDING_TABLE_POOL_DEFAULT_BLOCK_SIZE,
1024, 128 * 1024)
DRI_CONF_INTEL_DISABLE_PUSH_CONSTANT_ALLOC(true)
DRI_CONF_INTEL_ENABLE_WA_14018912822(false)
DRI_CONF_INTEL_ENABLE_WA_14024015672_MSAA(false)
DRI_CONF_INTEL_SAMPLER_ROUTE_TO_LSC(false)
@ -292,6 +293,8 @@ anv_init_dri_options(struct anv_instance *instance)
driQueryOptionb(&instance->dri_options, "anv_barrier_post_typed_clear_shader");
instance->barrier_post_untyped_clear_shader =
driQueryOptionb(&instance->dri_options, "anv_barrier_post_untyped_clear_shader");
instance->disable_push_constant_alloc =
driQueryOptionb(&instance->dri_options, "intel_disable_push_constant_alloc");
if (instance->vk.app_info.engine_name &&
!strcmp(instance->vk.app_info.engine_name, "DXVK")) {

View file

@ -1785,6 +1785,7 @@ struct anv_instance {
*/
unsigned binding_table_block_size;
bool disable_lto;
bool disable_push_constant_alloc;
enum brw_divergent_atomics_flags enable_opt_divergent_atomics;
bool force_sampler_prefetch;
bool force_compute_surface_prefetch;

View file

@ -42,8 +42,8 @@ batch_emit_push_constants_alloc(struct anv_batch *batch,
VkShaderStageFlags stages)
{
const unsigned push_constant_kb =
(stages & VK_SHADER_STAGE_MESH_BIT_EXT) ?
device->info->mesh_max_constant_urb_size_kb :
/* GFX_VERx10 >= 125 ? */
/* devinfo->mesh_max_constant_urb_size_kb : */
device->info->max_constant_urb_size_kb;
/* On Gfx12.5 there is no more push constant allocation required */
@ -107,10 +107,12 @@ genX(batch_emit_push_constants_alloc)(struct anv_batch *batch,
static void
cmd_buffer_alloc_gfx_push_constants(struct anv_cmd_buffer *cmd_buffer)
{
if (cmd_buffer->device->physical->instance->disable_push_constant_alloc)
return;
struct anv_cmd_graphics_state *gfx = &cmd_buffer->state.gfx;
const VkShaderStageFlags stages =
genX(push_constant_alloc_stages)(gfx->active_stages);
if (stages == cmd_buffer->state.gfx.push_constant_stages)
return;

View file

@ -783,6 +783,16 @@ init_render_queue_state(struct anv_queue *queue, bool is_companion_rcs_batch)
}
#endif
if (device->physical->instance->disable_push_constant_alloc) {
genX(batch_emit_push_constants_alloc)(
batch, device,
VK_SHADER_STAGE_VERTEX_BIT |
VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT |
VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT |
VK_SHADER_STAGE_GEOMETRY_BIT |
VK_SHADER_STAGE_FRAGMENT_BIT);
}
anv_batch_emit(batch, GENX(MI_BATCH_BUFFER_END), bbe);
result = batch->status;

View file

@ -273,27 +273,12 @@ genX(emit_simpler_shader_init_fragment)(struct anv_simple_shader *state)
anv_batch_emit(batch, GENX(3DSTATE_PRIMITIVE_REPLICATION), pr);
#endif
VkShaderStageFlags push_stages =
genX(push_constant_alloc_stages)(VK_SHADER_STAGE_FRAGMENT_BIT);
genX(batch_emit_push_constants_alloc)(batch, device, push_stages);
state->cmd_buffer->state.gfx.push_constant_stages = push_stages;
#if GFX_VERx10 == 125
/* DG2: Wa_22011440098
* MTL: Wa_18022330953
*
* In 3D mode, after programming push constant alloc command immediately
* program push constant command(ZERO length) without any commit between
* them.
*
* Note that Wa_16011448509 isn't needed here as all address bits are zero.
*/
anv_batch_emit(batch, GENX(3DSTATE_CONSTANT_ALL), c) {
/* Update empty push constants for all stages (bitmask = 11111b) */
c.ShaderUpdateEnable = 0x1f;
c.MOCS = anv_mocs(device, NULL, 0);
if (!device->physical->instance->disable_push_constant_alloc) {
VkShaderStageFlags push_stages =
genX(push_constant_alloc_stages)(VK_SHADER_STAGE_FRAGMENT_BIT);
genX(batch_emit_push_constants_alloc)(batch, device, push_stages);
state->cmd_buffer->state.gfx.push_constant_stages = push_stages;
}
#endif
#if GFX_VER == 9
/* Allocate a binding table for Gfx9 because the HW does not have a null-rt

View file

@ -361,6 +361,10 @@
DRI_CONF_OPT_I(intel_binding_table_block_size, def, min, max, \
"Intel binding table block allocation size (3DSTATE_BINDING_TABLE_POOL_ALLOC)")
#define DRI_CONF_INTEL_DISABLE_PUSH_CONSTANT_ALLOC(def) \
DRI_CONF_OPT_B(intel_disable_push_constant_alloc, def, \
"Disable push constant space allocations")
#define DRI_CONFIG_INTEL_TBIMR(def) \
DRI_CONF_OPT_B(intel_tbimr, def, "Enable TBIMR tiled rendering")