Skip to content

ir3: correctly set bit size for 64b constant @load_ubo

Job Noorman requested to merge jnoorman/mesa:ir3-load-const-64b into main

When lowering @load_constant to @load_ubo, the bit size is currently hard-coded to 32. This causes validation errors when lowering a constant with a 64b bit size.

This patch fixes this by setting the @load_ubo bit size correctly for 64b constants. This 64b load is later lowered to a 32b load by ir3_nir_lower_64b_intrinsics.

Relevant NIR from spec@arb_gpu_shader_fp64@execution@fs-indirect-temp-double-src after ir3_nir_lower_load_constant before this change:

    32    %1266 = @load_ubo (%1265 (0x1), %1263) (access=none, align_mul=16, align_offset=0, range_base=0, range=80)
...
    32      %25 = unpack_64_2x32_split_y %1266
error: src_bit_size == nir_alu_type_get_type_size(src_type) (../../src/compiler/nir/nir_validate.c:219)

With this patch this becomes:

    64    %1266 = @load_ubo (%1265 (0x1), %1263) (access=none, align_mul=16, align_offset=0, range_base=0, range=80)
...
    32      %25 = unpack_64_2x32_split_y %1266

And after ir3_nir_lower_64b_intrinsics:

    32x2  %1267 = @load_ubo (%1265 (0x1), %1263) (access=none, align_mul=16, align_offset=0, range_base=0, range=80)
    64    %1268 = pack_64_2x32 %1267
...
    64    %1271 = mov %1268
...
    32      %25 = unpack_64_2x32_split_y %1271

Fixes Piglit test:

  • spec@arb_gpu_shader_fp64@execution@fs-indirect-temp-double-src

This patch has no impact on shader-db.

Merge request reports