mask_type_exact = 1 << 1,
mask_type_wqm = 1 << 2,
mask_type_loop = 1 << 3, /* active lanes of a loop */
- mask_type_initial = 1 << 4, /* initially active lanes */
};
struct wqm_ctx {
}
if (ctx.handle_wqm) {
- ctx.info[0].exec.emplace_back(Temp(0, bld.lm), mask_type_global | mask_type_exact | mask_type_initial);
+ ctx.info[0].exec.emplace_back(Temp(0, bld.lm), mask_type_global | mask_type_exact);
/* if this block only needs WQM, initialize already */
if (ctx.info[0].block_needs == WQM)
transition_to_WQM(ctx, bld, 0);
state = Exact;
}
- if (instr->opcode == aco_opcode::p_is_helper || instr->opcode == aco_opcode::p_load_helper) {
+ if (instr->opcode == aco_opcode::p_is_helper) {
Definition dst = instr->definitions[0];
assert(dst.size() == bld.lm.size());
if (state == Exact) {
instr->definitions[0] = dst;
} else {
std::pair<Temp, uint8_t>& exact_mask = ctx.info[block->index].exec[0];
- if (instr->opcode == aco_opcode::p_load_helper &&
- !(ctx.info[block->index].exec[0].second & mask_type_initial)) {
- /* find last initial exact mask */
- for (int i = block->index; i >= 0; i--) {
- if (ctx.program->blocks[i].kind & block_kind_top_level &&
- ctx.info[i].exec[0].second & mask_type_initial) {
- exact_mask = ctx.info[i].exec[0];
- break;
- }
- }
- }
-
- assert(instr->opcode == aco_opcode::p_is_helper || exact_mask.second & mask_type_initial);
assert(exact_mask.second & mask_type_exact);
instr.reset(create_instruction<SOP2_instruction>(bld.w64or32(Builder::s_andn2), Format::SOP2, 2, 2));
} else if (instr->opcode == aco_opcode::p_demote_to_helper) {
/* turn demote into discard_if with only exact masks */
assert((ctx.info[block->index].exec[0].second & (mask_type_exact | mask_type_global)) == (mask_type_exact | mask_type_global));
- ctx.info[block->index].exec[0].second &= ~mask_type_initial;
int num;
Temp cond, exit_cond;
emit_wqm(bld, wqm_tmp, dst);
break;
}
- case nir_intrinsic_load_helper_invocation: {
- Temp dst = get_ssa_temp(ctx, &instr->dest.ssa);
- bld.pseudo(aco_opcode::p_load_helper, Definition(dst));
- ctx->block->kind |= block_kind_needs_lowering;
- ctx->program->needs_exact = true;
- break;
- }
+ case nir_intrinsic_load_helper_invocation:
case nir_intrinsic_is_helper_invocation: {
+ /* load_helper() after demote() get lowered to is_helper().
+ * Otherwise, these two behave the same. */
Temp dst = get_ssa_temp(ctx, &instr->dest.ssa);
bld.pseudo(aco_opcode::p_is_helper, Definition(dst));
ctx->block->kind |= block_kind_needs_lowering;