hk: promote bindless textures
Totals from 26546 (49.43% of 53701) affected shaders: MaxWaves: 25656256 -> 25683456 (+0.11%); split: +0.11%, -0.00% Instrs: 16471320 -> 15911888 (-3.40%); split: -3.42%, +0.02% CodeSize: 116099620 -> 112036602 (-3.50%); split: -3.53%, +0.03% Spills: 63650 -> 63400 (-0.39%); split: -0.48%, +0.08% Fills: 42179 -> 41886 (-0.69%); split: -0.88%, +0.19% Scratch: 343540 -> 343040 (-0.15%); split: -0.16%, +0.01% ALU: 12932573 -> 12386766 (-4.22%); split: -4.25%, +0.03% FSCIB: 12931874 -> 12385806 (-4.22%); split: -4.25%, +0.03% IC: 3809190 -> 3807544 (-0.04%); split: -0.05%, +0.00% GPRs: 2015525 -> 2004665 (-0.54%); split: -0.56%, +0.02% Uniforms: 6215004 -> 5869441 (-5.56%); split: -5.57%, +0.01% Preamble instrs: 6592883 -> 6655742 (+0.95%); split: -0.08%, +1.03% Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35949>
This commit is contained in:
@@ -229,7 +229,6 @@ instr_cost(nir_instr *instr, const void *data)
|
||||
case nir_intrinsic_load_global_constant:
|
||||
case nir_intrinsic_load_constant_agx:
|
||||
case nir_intrinsic_load_ubo:
|
||||
case nir_intrinsic_bindless_image_agx:
|
||||
return 10.0;
|
||||
case nir_intrinsic_ddx:
|
||||
case nir_intrinsic_ddx_fine:
|
||||
@@ -238,6 +237,12 @@ instr_cost(nir_instr *instr, const void *data)
|
||||
case nir_intrinsic_ddy_fine:
|
||||
case nir_intrinsic_ddy_coarse:
|
||||
return 1.0;
|
||||
case nir_intrinsic_bindless_image_agx:
|
||||
/* It's worth promoting even with a constant source, but it doesn't
|
||||
* turn into instructions so should be less than any other normal
|
||||
* instruction... But just enough to get over the image rewrite_cost.
|
||||
*/
|
||||
return 2.5;
|
||||
default:
|
||||
/* Assume it's a sysval or something */
|
||||
return 0.0;
|
||||
|
||||
@@ -75,7 +75,7 @@ hk_dispatch_with_usc(struct hk_device *dev, struct hk_cs *cs,
|
||||
{
|
||||
struct agx_cdm_launch_word_0_packed launch;
|
||||
agx_pack(&launch, CDM_LAUNCH_WORD_0, cfg) {
|
||||
cfg.texture_state_register_count = 0;
|
||||
cfg.texture_state_register_count = info->texture_state_count;
|
||||
cfg.sampler_state_register_count = 1;
|
||||
cfg.uniform_register_count = info->push_count;
|
||||
cfg.preshader_register_count = info->nr_preamble_gprs;
|
||||
|
||||
@@ -916,7 +916,7 @@ hk_upload_shader(struct hk_device *dev, struct hk_shader *shader)
|
||||
cfg.preshader_register_count = shader->b.info.nr_preamble_gprs;
|
||||
cfg.sampler_state_register_count = agx_translate_sampler_state_count(
|
||||
shader->b.info.uses_txf ? 1 : 0, false);
|
||||
cfg.texture_state_register_count = 0;
|
||||
cfg.texture_state_register_count = shader->b.info.texture_state_count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1121,6 +1121,7 @@ hk_compile_nir(struct hk_device *dev, const VkAllocationCallbacks *pAllocator,
|
||||
.no_stop = nir->info.stage == MESA_SHADER_FRAGMENT,
|
||||
.has_scratch = !nir->info.internal,
|
||||
.promote_constants = true,
|
||||
.promote_textures = true,
|
||||
};
|
||||
|
||||
/* For now, sample shading is always dynamic. Indicate that. */
|
||||
@@ -1671,7 +1672,7 @@ hk_fast_link(struct hk_device *dev, bool fragment, struct hk_shader *main,
|
||||
cfg.cf_binding_count = s->b.cf.nr_bindings;
|
||||
cfg.uniform_register_count = main->b.info.push_count;
|
||||
cfg.preshader_register_count = main->b.info.nr_preamble_gprs;
|
||||
cfg.texture_state_register_count = 0;
|
||||
cfg.texture_state_register_count = main->b.info.texture_state_count;
|
||||
cfg.sampler_state_register_count =
|
||||
agx_translate_sampler_state_count(s->b.uses_txf ? 1 : 0, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user