diff --git a/src/asahi/compiler/agx_pressure_schedule.c b/src/asahi/compiler/agx_pressure_schedule.c index d7f144d1a673..130a4292a26d 100644 --- a/src/asahi/compiler/agx_pressure_schedule.c +++ b/src/asahi/compiler/agx_pressure_schedule.c @@ -1213,6 +1213,31 @@ ilp_instr_pipe(const agx_instr *I) } } +/* Mark hoisted loads feeding SSA value v as consumed, walking through any + * transitive COLLECT chains (which regroup split/collected channels without + * consuming them). */ +static void +ilp_mark_consumed_ssa(unsigned v, const int *load_node, + agx_instr *const *collect_def, bool *consumed, + unsigned *consumed_loads) +{ + const int l = load_node[v]; + if (l >= 0) { + if (!consumed[l]) { + consumed[l] = true; + (*consumed_loads)++; + } + return; + } + const agx_instr *col = collect_def[v]; + if (!col) + return; + agx_foreach_ssa_src(col, cj) { + ilp_mark_consumed_ssa(col->src[cj].value, load_node, collect_def, + consumed, consumed_loads); + } +} + static bool ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, bool native_uniforms, unsigned alu_latency, @@ -1317,6 +1342,7 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, unsigned *uses_left = NULL; bool *dies = NULL; signed live = 0; + signed eff_fwd_cap = fwd_cap; if (fwd_cap > 0) { uses_left = rzalloc_array(memctx, unsigned, ctx->alloc); dies = rzalloc_array(memctx, bool, ctx->alloc); @@ -1338,6 +1364,21 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, agx_foreach_ssa_src(I, si) dies[I->src[si].value] = false; } + /* Loop-carried PHIs in loop headers are already live on block entry; do + * not charge live ones against the forward budget for temporaries added + * inside this block. Dead PHIs contribute 0 net live halves, and non-loop + * merge PHIs keep the original fwd_cap brake intact. */ + if (block->loop_header) { + for (unsigned i = 0; i < n; ++i) { + if (nodes[i]->instr->op != AGX_OPCODE_PHI) + continue; + agx_foreach_ssa_dest(nodes[i]->instr, d) { + const unsigned v = nodes[i]->instr->dest[d].value; + if (uses_left[v] > 0 || !dies[v]) + eff_fwd_cap += agx_index_size_16(nodes[i]->instr->dest[d]); + } + } + } } /* With loads_in_flight, the window starts at the number of hoisted loads @@ -1348,11 +1389,13 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, const bool in_flight = hoist_samples && loads_in_flight; unsigned consumed_loads = 0; int *load_node = NULL; + agx_instr **collect_def = NULL; bool *consumed = NULL; if (in_flight) { load_node = ralloc_array(memctx, int, MAX2(ctx->alloc, 1)); + collect_def = rzalloc_array(memctx, agx_instr *, MAX2(ctx->alloc, 1)); consumed = rzalloc_array(memctx, bool, n); - if (!load_node || !consumed) + if (!load_node || !collect_def || !consumed) return false; for (unsigned v = 0; v < ctx->alloc; ++v) load_node[v] = -1; @@ -1362,10 +1405,51 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, load_node[nodes[i]->instr->dest[d].value] = i; } else if (nodes[i]->instr->op == AGX_OPCODE_SPLIT && nodes[i]->instr->src[0].type == AGX_INDEX_NORMAL) { - const int l = load_node[nodes[i]->instr->src[0].value]; + const unsigned sv = nodes[i]->instr->src[0].value; + const int l = load_node[sv]; if (l >= 0) { agx_foreach_ssa_dest(nodes[i]->instr, d) load_node[nodes[i]->instr->dest[d].value] = l; + } else if (collect_def[sv]) { + agx_instr *col = collect_def[sv]; + bool exact_channels = col->nr_srcs == nodes[i]->instr->nr_dests; + if (exact_channels) { + agx_foreach_ssa_dest(nodes[i]->instr, d) { + if (agx_index_size_16(col->src[d]) != + agx_index_size_16(nodes[i]->instr->dest[d])) { + exact_channels = false; + break; + } + } + } + if (exact_channels) { + agx_foreach_ssa_dest(nodes[i]->instr, d) { + if (col->src[d].type != AGX_INDEX_NORMAL) + continue; + const unsigned cv = col->src[d].value; + const unsigned dv = nodes[i]->instr->dest[d].value; + if (load_node[cv] >= 0) + load_node[dv] = load_node[cv]; + else if (collect_def[cv]) + collect_def[dv] = collect_def[cv]; + } + } else { + agx_foreach_ssa_dest(nodes[i]->instr, d) + collect_def[nodes[i]->instr->dest[d].value] = col; + } + } + } else if (nodes[i]->instr->op == AGX_OPCODE_COLLECT) { + bool from_load = false; + agx_foreach_ssa_src(nodes[i]->instr, si) { + const unsigned sv = nodes[i]->instr->src[si].value; + if (load_node[sv] >= 0 || collect_def[sv]) { + from_load = true; + break; + } + } + if (from_load) { + agx_foreach_ssa_dest(nodes[i]->instr, d) + collect_def[nodes[i]->instr->dest[d].value] = nodes[i]->instr; } } } @@ -1389,16 +1473,39 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, int best = -1; unsigned best_t = 0; signed best_grow = 0; + signed best_dest_grow = 0; bool best_fits = true; unsigned i; BITSET_FOREACH_SET(i, ready_bits, n) { const unsigned t = MAX2(ready[i], cycle); + signed dest_grow = 0; signed grow = 0; if (fwd_cap > 0) { - agx_foreach_ssa_dest(nodes[i]->instr, d) - grow += agx_index_size_16(nodes[i]->instr->dest[d]); + const agx_instr *I = nodes[i]->instr; + agx_foreach_ssa_dest(I, d) + dest_grow += agx_index_size_16(I->dest[d]); + grow = dest_grow; + agx_foreach_ssa_src(I, si) { + const unsigned v = I->src[si].value; + if (!dies[v]) + continue; + unsigned occ = 0; + bool seen_before = false; + agx_foreach_ssa_src(I, sj) { + if (I->src[sj].value == v) { + if (sj < si) { + seen_before = true; + break; + } + occ++; + } + } + if (!seen_before && uses_left[v] == occ) + grow -= agx_index_size_16(I->src[si]); + } } - const bool fits = fwd_cap <= 0 || grow == 0 || live + grow <= fwd_cap; + const bool fits = + fwd_cap <= 0 || grow <= 0 || live + grow <= eff_fwd_cap; bool better; if (best < 0) better = true; @@ -1467,6 +1574,7 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, best = i; best_t = t; best_grow = grow; + best_dest_grow = dest_grow; best_fits = fits; } } @@ -1477,7 +1585,7 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, if (fwd_cap > 0) { const agx_instr *B = nodes[best]->instr; - live += best_grow; + live += best_dest_grow; agx_foreach_ssa_src(B, si) { const unsigned v = B->src[si].value; if (--uses_left[v] == 0 && dies[v]) @@ -1492,13 +1600,11 @@ ilp_schedule_block(agx_context *ctx, agx_block *block, void *memctx, order[step] = nodes[best]; issued_samples += ilp_is_hoisted(ctx, nodes[best]->instr, hoist_loads); - if (in_flight && nodes[best]->instr->op != AGX_OPCODE_SPLIT) { + if (in_flight && nodes[best]->instr->op != AGX_OPCODE_SPLIT && + nodes[best]->instr->op != AGX_OPCODE_COLLECT) { agx_foreach_ssa_src(nodes[best]->instr, si) { - const int l = load_node[nodes[best]->instr->src[si].value]; - if (l >= 0 && !consumed[l]) { - consumed[l] = true; - consumed_loads++; - } + ilp_mark_consumed_ssa(nodes[best]->instr->src[si].value, load_node, + collect_def, consumed, &consumed_loads); } } issued_writes += nodes[best]->instr->op == AGX_OPCODE_IMAGE_WRITE || diff --git a/src/asahi/compiler/test/test-m5-copy-schedule.cpp b/src/asahi/compiler/test/test-m5-copy-schedule.cpp index 07353143890d..3dad955fadf6 100644 --- a/src/asahi/compiler/test/test-m5-copy-schedule.cpp +++ b/src/asahi/compiler/test/test-m5-copy-schedule.cpp @@ -1123,3 +1123,333 @@ TEST(M5CopySchedule, FragmentDiscardSkipsDeviceLoadIlp) EXPECT_EQ(loads_before_first_add(s.body), 1u); ralloc_free(s.mem); } + +/* Loop-carried PHIs (such as cooperative-matrix accumulators) are already live + * at block entry and must not consume the forward pressure cap meant for + * temporaries added inside the block. With >= 88 halves of loop PHIs, a wide + * vec4 device_load should still hoist ahead of independent scalar ALU. */ +TEST(M5CopySchedule, LoopPhisDoNotStarveWideDeviceLoadHoisting) +{ + copy_shader s; + copy_shader_init(&s, MESA_SHADER_COMPUTE, true); + agx_builder *b = s.b; + + /* Entry block: initialize 48 32-bit loop-carried PHIs = 96 halves + * (> AGX_ILP_FS_SAMPLE_HALVES). */ + agx_index addr = agx_preload(b, agx_register(2, AGX_SIZE_64)); + agx_index inits[48]; + for (unsigned i = 0; i < 48; ++i) + inits[i] = agx_mov_imm(b, 32, i); + + b->cursor = agx_after_block(s.body); + agx_index phis[48]; + for (unsigned i = 0; i < 48; ++i) { + agx_instr *phi = agx_phi_to(b, agx_temp(b->shader, AGX_SIZE_32), 2); + phi->src[0] = inits[i]; + phi->src[1] = phi->dest[0]; + phis[i] = phi->dest[0]; + } + + agx_index l0 = agx_temp(b->shader, AGX_SIZE_16); + agx_device_load_to(b, l0, addr, agx_immediate(0), AGX_FORMAT_I16, 1, 0, false); + agx_index a = agx_iadd(b, l0, agx_immediate(1), 0); + for (unsigned k = 0; k < 6; ++k) + a = agx_iadd(b, a, agx_immediate(k + 2), 0); + + agx_index l1 = agx_vec_temp(b->shader, AGX_SIZE_32, 4); + agx_device_load_to(b, l1, addr, agx_immediate(16), AGX_FORMAT_I32, 0xf, 0, false); + agx_index l2 = agx_vec_temp(b->shader, AGX_SIZE_32, 4); + agx_device_load_to(b, l2, addr, agx_immediate(32), AGX_FORMAT_I32, 0xf, 0, false); + agx_index l3 = agx_vec_temp(b->shader, AGX_SIZE_32, 4); + agx_device_load_to(b, l3, addr, agx_immediate(48), AGX_FORMAT_I32, 0xf, 0, false); + + agx_instr *s1 = agx_split(b, 4, l1); + agx_instr *s2 = agx_split(b, 4, l2); + agx_instr *s3 = agx_split(b, 4, l3); + for (unsigned c = 0; c < 4; ++c) { + s1->dest[c] = agx_temp(b->shader, AGX_SIZE_32); + s2->dest[c] = agx_temp(b->shader, AGX_SIZE_32); + s3->dest[c] = agx_temp(b->shader, AGX_SIZE_32); + } + agx_index sum = agx_iadd(b, s1->dest[0], s2->dest[0], 0); + sum = agx_iadd(b, sum, s3->dest[0], 0); + sum = agx_iadd(b, sum, phis[0], 0); + agx_unit_test(b, a); + agx_unit_test(b, sum); + for (unsigned i = 1; i < 48; ++i) + agx_unit_test(b, phis[i]); + + agx_ilp_schedule(b->shader); + EXPECT_GE(loads_before_first_add(s.body), 4u); + ralloc_free(s.mem); +} + +/* COLLECT of hoisted local_load splits only regroups channels and must not + * advance in-flight load consumption before the real consumer executes. */ +TEST(M5CopySchedule, CollectDoesNotAdvanceInFlightLoadConsumption) +{ + copy_shader s; + copy_shader_init(&s, MESA_SHADER_COMPUTE, false); + agx_builder *b = s.b; + b->cursor = agx_after_block(s.body); + agx_index base = agx_preload(b, agx_register(2, AGX_SIZE_16)); + agx_index dst_addr = agx_preload(b, agx_register(4, AGX_SIZE_64)); + + for (unsigned g = 0; g < 3; ++g) { + agx_index chans[4]; + for (unsigned j = 0; j < 4; ++j) { + agx_index ld = agx_vec_temp(b->shader, AGX_SIZE_16, 2); + agx_local_load_to(b, ld, agx_immediate((g * 4 + j) * 4), base, + AGX_FORMAT_I16, 0x3); + agx_instr *sp = agx_split(b, 2, ld); + sp->dest[0] = agx_temp(b->shader, AGX_SIZE_16); + sp->dest[1] = agx_temp(b->shader, AGX_SIZE_16); + chans[j] = sp->dest[0]; + } + agx_index vec = agx_vec_temp(b->shader, AGX_SIZE_16, 4); + agx_instr *col = agx_collect_to(b, vec, 4); + for (unsigned j = 0; j < 4; ++j) + col->src[j] = chans[j]; + agx_device_store(b, vec, dst_addr, agx_immediate(g * 8), + AGX_FORMAT_I16, 0xf, 0, false); + } + + agx_ilp_schedule(b->shader); + unsigned loads_before_first_consumer = 0; + agx_foreach_instr_in_block(s.body, I) { + if (I->op == AGX_OPCODE_DEVICE_STORE) + break; + if (I->op == AGX_OPCODE_LOCAL_LOAD) + loads_before_first_consumer++; + } + EXPECT_EQ(loads_before_first_consumer, 4u); + ralloc_free(s.mem); +} + +/* Net register growth (dest halves minus dying SSA sources) lets an + * accumulator-updating op with net <= 0 fit under fwd_cap and beat a narrower + * growing load once live >= fwd_cap. */ +TEST(M5CopySchedule, NetGrowthPrefersRegisterReleasingOpOverGrowingLoad) +{ + copy_shader s; + copy_shader_init(&s, MESA_SHADER_COMPUTE, false); + agx_builder *b = s.b; + agx_block *entry = s.body; + agx_block *then_blk = agx_test_block(b->shader); + agx_block *else_blk = agx_test_block(b->shader); + agx_block *merge = agx_test_block(b->shader); + agx_block *after = agx_test_block(b->shader); + agx_block_add_successor(entry, then_blk); + agx_block_add_successor(entry, else_blk); + agx_block_add_successor(then_blk, merge); + agx_block_add_successor(else_blk, merge); + agx_block_add_successor(merge, after); + + b->cursor = agx_after_block(entry); + agx_index base = agx_preload(b, agx_register(2, AGX_SIZE_16)); + agx_index dst_addr = agx_preload(b, agx_register(4, AGX_SIZE_64)); + agx_index inits[46]; + for (unsigned i = 0; i < 46; ++i) + inits[i] = agx_mov_imm(b, 32, i + 1); + + /* 46 non-loop merge PHIs live-out into after => live = 92 > fwd_cap (88) + * right after PHIs at the top of merge. */ + b->cursor = agx_after_block(merge); + agx_index phis[46]; + for (unsigned i = 0; i < 46; ++i) { + agx_instr *phi = agx_phi_to(b, agx_temp(b->shader, AGX_SIZE_32), 2); + phi->src[0] = inits[i]; + phi->src[1] = inits[i]; + phis[i] = phi->dest[0]; + } + + /* Two 32-bit loads feeding a 32-bit iadd (dest=+2, dying=-4 => net=-2 <= 0). */ + agx_index a = agx_temp(b->shader, AGX_SIZE_32); + agx_local_load_to(b, a, agx_immediate(0), base, AGX_FORMAT_I32, 0x1); + agx_index c = agx_temp(b->shader, AGX_SIZE_32); + agx_local_load_to(b, c, agx_immediate(4), base, AGX_FORMAT_I32, 0x1); + + /* Narrower 16-bit loads (dest=+1, net=+1 > 0) that look smaller by dest-only + * size than the 32-bit iadd (dest=+2). */ + agx_index narrow[4]; + for (unsigned i = 0; i < 4; ++i) { + narrow[i] = agx_temp(b->shader, AGX_SIZE_16); + agx_local_load_to(b, narrow[i], agx_immediate(16 + i * 2), base, + AGX_FORMAT_I16, 0x1); + } + + agx_index sum = agx_iadd(b, a, c, 0); + agx_device_store(b, sum, dst_addr, agx_immediate(0), AGX_FORMAT_I32, 0x1, 0, + false); + for (unsigned i = 0; i < 4; ++i) { + agx_device_store(b, narrow[i], dst_addr, agx_immediate(8 + i * 2), + AGX_FORMAT_I16, 0x1, 0, false); + } + + b->cursor = agx_after_block(after); + for (unsigned i = 0; i < 46; ++i) + agx_unit_test(b, phis[i]); + + agx_ilp_schedule(b->shader); + /* With net growth, once a and c have loaded, iadd (net=-2, fits=true) must + * run ahead of at least one narrower growing 16-bit load (net=+1, !fits). */ + unsigned iadd_pos = 0, last_load_pos = 0, pos = 0; + agx_foreach_instr_in_block(merge, I) { + if (I->op == AGX_OPCODE_IADD) + iadd_pos = pos; + else if (I->op == AGX_OPCODE_LOCAL_LOAD) + last_load_pos = pos; + pos++; + } + EXPECT_LT(iadd_pos, last_load_pos); + ralloc_free(s.mem); +} + +/* COLLECT -> SPLIT and nested COLLECT -> COLLECT chains must still mark the + * underlying hoisted loads consumed when the real consumer executes, so the + * in-flight hoist window does not leak slots and stall later loads. */ +TEST(M5CopySchedule, CollectSplitAndNestedCollectConsumeHoistedLoads) +{ + for (unsigned mode = 0; mode < 2; ++mode) { + SCOPED_TRACE(mode == 0 ? "collect-to-split" : "nested-collect"); + copy_shader s; + copy_shader_init(&s, MESA_SHADER_COMPUTE, false); + agx_builder *b = s.b; + b->cursor = agx_after_block(s.body); + agx_index base = agx_preload(b, agx_register(2, AGX_SIZE_16)); + agx_index dst_addr = agx_preload(b, agx_register(4, AGX_SIZE_64)); + + agx_index chans[4]; + for (unsigned j = 0; j < 4; ++j) { + agx_index ld = agx_vec_temp(b->shader, AGX_SIZE_16, 2); + agx_local_load_to(b, ld, agx_immediate(j * 4), base, AGX_FORMAT_I16, + 0x3); + agx_instr *sp = agx_split(b, 2, ld); + sp->dest[0] = agx_temp(b->shader, AGX_SIZE_16); + sp->dest[1] = agx_temp(b->shader, AGX_SIZE_16); + chans[j] = sp->dest[0]; + } + if (mode == 0) { + agx_index vec = agx_vec_temp(b->shader, AGX_SIZE_16, 4); + agx_instr *col = agx_collect_to(b, vec, 4); + for (unsigned j = 0; j < 4; ++j) + col->src[j] = chans[j]; + agx_instr *sp2 = agx_split(b, 4, vec); + for (unsigned j = 0; j < 4; ++j) { + sp2->dest[j] = agx_temp(b->shader, AGX_SIZE_16); + agx_device_store(b, sp2->dest[j], dst_addr, agx_immediate(j * 2), + AGX_FORMAT_I16, 0x1, 0, false); + } + } else { + agx_index lo = agx_vec_temp(b->shader, AGX_SIZE_16, 2); + agx_instr *c0 = agx_collect_to(b, lo, 2); + c0->src[0] = chans[0]; + c0->src[1] = chans[1]; + agx_index hi = agx_vec_temp(b->shader, AGX_SIZE_16, 2); + agx_instr *c1 = agx_collect_to(b, hi, 2); + c1->src[0] = chans[2]; + c1->src[1] = chans[3]; + agx_index vec = agx_vec_temp(b->shader, AGX_SIZE_16, 4); + agx_instr *c2 = agx_collect_to(b, vec, 2); + c2->src[0] = lo; + c2->src[1] = hi; + agx_device_store(b, vec, dst_addr, agx_immediate(0), AGX_FORMAT_I16, + 0xf, 0, false); + } + + agx_index b1_loads[4]; + for (unsigned j = 0; j < 4; ++j) { + b1_loads[j] = agx_temp(b->shader, AGX_SIZE_32); + agx_local_load_to(b, b1_loads[j], agx_immediate(32 + j * 4), base, + AGX_FORMAT_I32, 0x1); + agx_index v = agx_iadd(b, b1_loads[j], agx_immediate(1), 0); + agx_device_store(b, v, dst_addr, agx_immediate(32 + j * 4), + AGX_FORMAT_I32, 0x1, 0, false); + } + + agx_ilp_schedule(b->shader); + unsigned total_loads_before_b1_iadd = 0; + agx_foreach_instr_in_block(s.body, I) { + if (I->op == AGX_OPCODE_IADD) + break; + if (I->op == AGX_OPCODE_LOCAL_LOAD) + total_loads_before_b1_iadd++; + } + EXPECT_EQ(total_loads_before_b1_iadd, 8u); + ralloc_free(s.mem); + } +} + +/* Non-loop merge PHIs must NOT inflate eff_fwd_cap, preserving the original + * forward pressure brake on straight-line if/else merge blocks. */ +TEST(M5CopySchedule, NonLoopMergePhisKeepOriginalFwdCap) +{ + copy_shader s; + copy_shader_init(&s, MESA_SHADER_COMPUTE, false); + agx_builder *b = s.b; + agx_block *entry = s.body; + agx_block *then_blk = agx_test_block(b->shader); + agx_block *else_blk = agx_test_block(b->shader); + agx_block *merge = agx_test_block(b->shader); + agx_block *after = agx_test_block(b->shader); + agx_block_add_successor(entry, then_blk); + agx_block_add_successor(entry, else_blk); + agx_block_add_successor(then_blk, merge); + agx_block_add_successor(else_blk, merge); + agx_block_add_successor(merge, after); + ASSERT_FALSE(merge->loop_header); + + b->cursor = agx_after_block(entry); + agx_index addr = agx_preload(b, agx_register(2, AGX_SIZE_64)); + agx_index inits[48]; + for (unsigned i = 0; i < 48; ++i) + inits[i] = agx_mov_imm(b, 32, i); + + b->cursor = agx_after_block(merge); + agx_index phis[48]; + for (unsigned i = 0; i < 48; ++i) { + agx_instr *phi = agx_phi_to(b, agx_temp(b->shader, AGX_SIZE_32), 2); + phi->src[0] = inits[i]; + phi->src[1] = inits[i]; + phis[i] = phi->dest[0]; + } + + agx_index l0 = agx_temp(b->shader, AGX_SIZE_16); + agx_device_load_to(b, l0, addr, agx_immediate(0), AGX_FORMAT_I16, 1, 0, + false); + agx_index a = agx_iadd(b, l0, agx_immediate(1), 0); + for (unsigned k = 0; k < 6; ++k) + a = agx_iadd(b, a, agx_immediate(k + 2), 0); + + agx_index l1 = agx_vec_temp(b->shader, AGX_SIZE_32, 4); + agx_device_load_to(b, l1, addr, agx_immediate(16), AGX_FORMAT_I32, 0xf, 0, + false); + agx_index l2 = agx_vec_temp(b->shader, AGX_SIZE_32, 4); + agx_device_load_to(b, l2, addr, agx_immediate(32), AGX_FORMAT_I32, 0xf, 0, + false); + agx_index l3 = agx_vec_temp(b->shader, AGX_SIZE_32, 4); + agx_device_load_to(b, l3, addr, agx_immediate(48), AGX_FORMAT_I32, 0xf, 0, + false); + + agx_instr *s1 = agx_split(b, 4, l1); + agx_instr *s2 = agx_split(b, 4, l2); + agx_instr *s3 = agx_split(b, 4, l3); + for (unsigned c = 0; c < 4; ++c) { + s1->dest[c] = agx_temp(b->shader, AGX_SIZE_32); + s2->dest[c] = agx_temp(b->shader, AGX_SIZE_32); + s3->dest[c] = agx_temp(b->shader, AGX_SIZE_32); + } + agx_index sum = agx_iadd(b, s1->dest[0], s2->dest[0], 0); + sum = agx_iadd(b, sum, s3->dest[0], 0); + sum = agx_iadd(b, sum, phis[0], 0); + agx_unit_test(b, a); + agx_unit_test(b, sum); + + b->cursor = agx_after_block(after); + for (unsigned i = 1; i < 48; ++i) + agx_unit_test(b, phis[i]); + + agx_ilp_schedule(b->shader); + EXPECT_EQ(loads_before_first_add(merge), 1u); + ralloc_free(s.mem); +}