brw: Simplify choose_oword_block_size_dwords()

Just calculate the block size using util_logbase2() - it's simpler.

Also drop the name "oword" as this refers to legacy HDC messages,
rather than the newer LSC "vector size" field.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32315>
This commit is contained in:
Kenneth Graunke
2024-09-09 16:27:29 -07:00
committed by Marge Bot
parent e8c85f8476
commit 01680a66a9
+8 -15
View File
@@ -5112,21 +5112,14 @@ swizzle_nir_scratch_addr(nir_to_brw_state &ntb,
}
static unsigned
choose_oword_block_size_dwords(const struct intel_device_info *devinfo,
unsigned dwords)
choose_block_size_dwords(const intel_device_info *devinfo, unsigned dwords)
{
unsigned block;
if (devinfo->has_lsc && dwords >= 64) {
block = 64;
} else if (dwords >= 32) {
block = 32;
} else if (dwords >= 16) {
block = 16;
} else {
block = 8;
}
assert(block <= dwords);
return block;
const unsigned min_block = 8;
const unsigned max_block = devinfo->has_lsc ? 64 : 32;
const unsigned block = 1 << util_logbase2(dwords);
return CLAMP(block, min_block, max_block);
}
static brw_reg
@@ -7248,7 +7241,7 @@ fs_nir_emit_memory_access(nir_to_brw_state &ntb,
unsigned block_comps = components;
for (done = 0; done < total; done += block_comps) {
block_comps = choose_oword_block_size_dwords(devinfo, total - done);
block_comps = choose_block_size_dwords(devinfo, total - done);
const unsigned block_bytes = block_comps * (nir_bit_size / 8);
srcs[MEMORY_LOGICAL_COMPONENTS] = brw_imm_ud(block_comps);