From 617d4810c1c3c7d430873a23185eedbefd40d558 Mon Sep 17 00:00:00 2001 From: Ahmed Hesham Date: Sat, 23 May 2026 21:30:01 +0000 Subject: [PATCH] pan/bi: Fix function temp lowering with 64-bit pointers OpenCL-CTS `test_basic vload_private` fails with the following assertion: ``` src/compiler/nir/nir_lower_explicit_io.c:1649: lower_explicit_io_deref: Assertion `addr->bit_size == deref->def.bit_size' failed. ``` Use `nir_address_format_32bit_offset_as_64bit` when the shader has 64-bit pointers. The scratch offset is still 32-bit, but the NIR address value now matches the 64-bit derefs being lowered. Fixes: 01e6a0555cb ("pan/compiler: Rework scratch memory strategy") Signed-off-by: Ahmed Hesham Reviewed-by: Christoph Pillmayer Part-of: --- src/panfrost/compiler/bifrost/bifrost_nir.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/panfrost/compiler/bifrost/bifrost_nir.c b/src/panfrost/compiler/bifrost/bifrost_nir.c index effaa263fdf..7e84d7dde7d 100644 --- a/src/panfrost/compiler/bifrost/bifrost_nir.c +++ b/src/panfrost/compiler/bifrost/bifrost_nir.c @@ -984,8 +984,13 @@ bifrost_postprocess_nir(nir_shader *nir, */ NIR_PASS(_, nir, nir_lower_vars_to_explicit_types, nir_var_function_temp, glsl_get_natural_size_align_bytes); + + nir_address_format scratch_addr_format = + nir_get_ptr_bitsize(nir) == 64 ? nir_address_format_32bit_offset_as_64bit + : nir_address_format_32bit_offset; + NIR_PASS(_, nir, nir_lower_explicit_io, nir_var_function_temp, - nir_address_format_32bit_offset); + scratch_addr_format); } nir_lower_mem_access_bit_sizes_options mem_size_options = {