diff --git a/src/intel/compiler/jay/jay_from_nir.c b/src/intel/compiler/jay/jay_from_nir.c index f5ca76378d4..093707c8c55 100644 --- a/src/intel/compiler/jay/jay_from_nir.c +++ b/src/intel/compiler/jay/jay_from_nir.c @@ -2508,6 +2508,8 @@ jay_setup_payload(struct nir_to_jay_state *nj) UNREACHABLE("unimplemented shader stages"); } + s->payload_gprs = p.offsets[GPR]; + /* Lane ID calculations require &W and therefore are calculated in * uniform control flow to sidestep RA problems. The easy solution is * calculating the lane ID in the first block. diff --git a/src/intel/compiler/jay/jay_ir.h b/src/intel/compiler/jay/jay_ir.h index ca748228037..1f54ffbce58 100644 --- a/src/intel/compiler/jay/jay_ir.h +++ b/src/intel/compiler/jay/jay_ir.h @@ -783,7 +783,7 @@ typedef struct jay_shader { union brw_any_prog_data *prog_data; unsigned spills, fills; unsigned scratch_size; - unsigned push_grfs; + unsigned payload_gprs, push_grfs; /** * Ralloc linear context. Since we don't typically free as we go, diff --git a/src/intel/compiler/jay/jay_register_allocate.c b/src/intel/compiler/jay/jay_register_allocate.c index 3796ca0d95d..58dafccf60d 100644 --- a/src/intel/compiler/jay/jay_register_allocate.c +++ b/src/intel/compiler/jay/jay_register_allocate.c @@ -763,6 +763,8 @@ pick_regs(jay_ra_state *ra, if (file == UGPR && size > 16) { first = partition->large_ugpr_block.start; end = partition->large_ugpr_block.start + partition->large_ugpr_block.len; + } else if (file == GPR && size > 1 && ra->b.shader->payload_gprs < 8) { + first = align(ra->b.shader->payload_gprs, MAX2(size, alignment)); } /* Sources used by end-of-thread sends must be at the end of the file */ @@ -1421,12 +1423,6 @@ build_partition(jay_shader *shader, unsigned *blocks, unsigned n) if (file == UGPR) { ugpr_base += blocks[i]; } - - /* GPR partition blocks must be vector size aligned to avoid crossing */ - if (file == GPR && i != (n - 1)) { - unsigned max_vec = 8; - assert(util_is_aligned(blocks[i], max_vec * jay_grf_per_gpr(shader))); - } } } @@ -1516,11 +1512,13 @@ jay_partition_grf(jay_shader *shader) stride4_header_size = blocks[1] + blocks[3]; } else if (shader->stage == MESA_SHADER_FRAGMENT) { unsigned len0 = jay_grf_per_gpr(shader); + unsigned payload_grfs = shader->payload_gprs * len0; + unsigned blocks[] = { len0, /* UGPR: g0 (and maybe g1) */ - len0 * 8, /* GPR: Barycentrics */ + payload_grfs, /* GPR: Barycentrics */ uniform_grfs - len0, /* UGPR: Dispatch (eg push constants) & general */ - nonuniform_grfs - (len0 * 8), /* GPR: General & end-of-thread */ + nonuniform_grfs - payload_grfs, /* GPR: General & EOT */ }; build_partition(shader, blocks, ARRAY_SIZE(blocks)); dispatch_grf = blocks[0] + blocks[1];