intel/fs: Rename PLACEHOLDER_HALT to HALT_TARGET

It's a bit more explicit and will play more nicely with what we're about
to do.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5071>
This commit is contained in:
Jason Ekstrand
2020-11-19 09:32:27 -06:00
parent f3ad928190
commit e76e359007
9 changed files with 29 additions and 23 deletions

View File

@@ -552,6 +552,13 @@ enum opcode {
SHADER_OPCODE_INTERLOCK, SHADER_OPCODE_INTERLOCK,
/** Target for a HALT
*
* All HALT instructions in a shader must target the same jump point and
* that point is denoted by a HALT_TARGET instruction.
*/
SHADER_OPCODE_HALT_TARGET,
VEC4_OPCODE_MOV_BYTES, VEC4_OPCODE_MOV_BYTES,
VEC4_OPCODE_PACK_BYTES, VEC4_OPCODE_PACK_BYTES,
VEC4_OPCODE_UNPACK_UNIFORM, VEC4_OPCODE_UNPACK_UNIFORM,
@@ -581,7 +588,6 @@ enum opcode {
FS_OPCODE_DISCARD_JUMP, FS_OPCODE_DISCARD_JUMP,
FS_OPCODE_SET_SAMPLE_ID, FS_OPCODE_SET_SAMPLE_ID,
FS_OPCODE_PACK_HALF_2x16_SPLIT, FS_OPCODE_PACK_HALF_2x16_SPLIT,
FS_OPCODE_PLACEHOLDER_HALT,
FS_OPCODE_INTERPOLATE_AT_SAMPLE, FS_OPCODE_INTERPOLATE_AT_SAMPLE,
FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET, FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET,
FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET, FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET,

View File

@@ -3035,21 +3035,21 @@ fs_visitor::opt_redundant_discard_jumps()
bblock_t *last_bblock = cfg->blocks[cfg->num_blocks - 1]; bblock_t *last_bblock = cfg->blocks[cfg->num_blocks - 1];
fs_inst *placeholder_halt = NULL; fs_inst *halt_target = NULL;
foreach_inst_in_block_reverse(fs_inst, inst, last_bblock) { foreach_inst_in_block_reverse(fs_inst, inst, last_bblock) {
if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) { if (inst->opcode == SHADER_OPCODE_HALT_TARGET) {
placeholder_halt = inst; halt_target = inst;
break; break;
} }
} }
if (!placeholder_halt) if (!halt_target)
return false; return false;
/* Delete any HALTs immediately before the placeholder halt. */ /* Delete any HALTs immediately before the halt target. */
for (fs_inst *prev = (fs_inst *) placeholder_halt->prev; for (fs_inst *prev = (fs_inst *) halt_target->prev;
!prev->is_head_sentinel() && prev->opcode == FS_OPCODE_DISCARD_JUMP; !prev->is_head_sentinel() && prev->opcode == FS_OPCODE_DISCARD_JUMP;
prev = (fs_inst *) placeholder_halt->prev) { prev = (fs_inst *) halt_target->prev) {
prev->remove(last_bblock); prev->remove(last_bblock);
progress = true; progress = true;
} }
@@ -7943,7 +7943,7 @@ fs_visitor::fixup_3src_null_dest()
* Find the first instruction in the program that might start a region of * Find the first instruction in the program that might start a region of
* divergent control flow due to a HALT jump. There is no * divergent control flow due to a HALT jump. There is no
* find_halt_control_flow_region_end(), the region of divergence extends until * find_halt_control_flow_region_end(), the region of divergence extends until
* the only FS_OPCODE_PLACEHOLDER_HALT in the program. * the only SHADER_OPCODE_HALT_TARGET in the program.
*/ */
static const fs_inst * static const fs_inst *
find_halt_control_flow_region_start(const fs_visitor *v) find_halt_control_flow_region_start(const fs_visitor *v)
@@ -7952,7 +7952,7 @@ find_halt_control_flow_region_start(const fs_visitor *v)
brw_wm_prog_data(v->prog_data)->uses_kill) { brw_wm_prog_data(v->prog_data)->uses_kill) {
foreach_block_and_inst(block, fs_inst, inst, v->cfg) { foreach_block_and_inst(block, fs_inst, inst, v->cfg) {
if (inst->opcode == FS_OPCODE_DISCARD_JUMP || if (inst->opcode == FS_OPCODE_DISCARD_JUMP ||
inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) inst->opcode == SHADER_OPCODE_HALT_TARGET)
return inst; return inst;
} }
} }
@@ -8012,7 +8012,7 @@ fs_visitor::fixup_nomask_control_flow()
case BRW_OPCODE_WHILE: case BRW_OPCODE_WHILE:
case BRW_OPCODE_ENDIF: case BRW_OPCODE_ENDIF:
case FS_OPCODE_PLACEHOLDER_HALT: case SHADER_OPCODE_HALT_TARGET:
depth++; depth++;
break; break;
@@ -8528,7 +8528,7 @@ fs_visitor::run_fs(bool allow_spilling, bool do_rep_send)
return false; return false;
if (wm_prog_data->uses_kill) if (wm_prog_data->uses_kill)
bld.emit(FS_OPCODE_PLACEHOLDER_HALT); bld.emit(SHADER_OPCODE_HALT_TARGET);
if (wm_key->alpha_test_func) if (wm_key->alpha_test_func)
emit_alpha_test(); emit_alpha_test();

View File

@@ -562,7 +562,7 @@ private:
struct brw_reg dst, struct brw_reg src, struct brw_reg dst, struct brw_reg src,
unsigned swiz); unsigned swiz);
bool patch_discard_jumps_to_fb_writes(); bool patch_halt_jumps();
const struct brw_compiler *compiler; const struct brw_compiler *compiler;
void *log_data; /* Passed to compiler->*_log functions */ void *log_data; /* Passed to compiler->*_log functions */

View File

@@ -325,7 +325,7 @@ fs_visitor::opt_cse_local(const fs_live_variables &live, bblock_t *block, int &i
* SHADER_OPCODE_FIND_LIVE_CHANNEL. * SHADER_OPCODE_FIND_LIVE_CHANNEL.
*/ */
if (inst->opcode == FS_OPCODE_DISCARD_JUMP || if (inst->opcode == FS_OPCODE_DISCARD_JUMP ||
inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) inst->opcode == SHADER_OPCODE_HALT_TARGET)
aeb.make_empty(); aeb.make_empty();
foreach_in_list_safe(aeb_entry, entry, &aeb) { foreach_in_list_safe(aeb_entry, entry, &aeb) {

View File

@@ -222,7 +222,7 @@ public:
}; };
bool bool
fs_generator::patch_discard_jumps_to_fb_writes() fs_generator::patch_halt_jumps()
{ {
if (this->discard_halt_patches.is_empty()) if (this->discard_halt_patches.is_empty())
return false; return false;
@@ -2529,11 +2529,11 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width,
generate_pack_half_2x16_split(inst, dst, src[0], src[1]); generate_pack_half_2x16_split(inst, dst, src[0], src[1]);
break; break;
case FS_OPCODE_PLACEHOLDER_HALT: case SHADER_OPCODE_HALT_TARGET:
/* This is the place where the final HALT needs to be inserted if /* This is the place where the final HALT needs to be inserted if
* we've emitted any discards. If not, this will emit no code. * we've emitted any discards. If not, this will emit no code.
*/ */
if (!patch_discard_jumps_to_fb_writes()) { if (!patch_halt_jumps()) {
if (unlikely(debug_flag)) { if (unlikely(debug_flag)) {
disasm_info->use_tail = true; disasm_info->use_tail = true;
} }

View File

@@ -76,7 +76,7 @@ namespace {
case BRW_OPCODE_SYNC: case BRW_OPCODE_SYNC:
case BRW_OPCODE_DO: case BRW_OPCODE_DO:
case SHADER_OPCODE_UNDEF: case SHADER_OPCODE_UNDEF:
case FS_OPCODE_PLACEHOLDER_HALT: case SHADER_OPCODE_HALT_TARGET:
case FS_OPCODE_SCHEDULING_FENCE: case FS_OPCODE_SCHEDULING_FENCE:
return 0; return 0;
default: default:

View File

@@ -1098,7 +1098,7 @@ namespace {
} }
case SHADER_OPCODE_UNDEF: case SHADER_OPCODE_UNDEF:
case FS_OPCODE_PLACEHOLDER_HALT: case SHADER_OPCODE_HALT_TARGET:
case FS_OPCODE_SCHEDULING_FENCE: case FS_OPCODE_SCHEDULING_FENCE:
return calculate_desc(info, unit_null, 0, 0, 0, 0, 0, return calculate_desc(info, unit_null, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0); 0, 0, 0, 0, 0, 0);
@@ -1552,7 +1552,7 @@ namespace {
issue_instruction(st, s->devinfo, inst); issue_instruction(st, s->devinfo, inst);
if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT && discard_count) if (inst->opcode == SHADER_OPCODE_HALT_TARGET && discard_count)
st.weight /= discard_weight; st.weight /= discard_weight;
elapsed += (st.unit_ready[unit_fe] - clock0) * st.weight; elapsed += (st.unit_ready[unit_fe] - clock0) * st.weight;

View File

@@ -1047,7 +1047,7 @@ instruction_scheduler::add_dep(schedule_node *before, schedule_node *after)
static bool static bool
is_scheduling_barrier(const backend_instruction *inst) is_scheduling_barrier(const backend_instruction *inst)
{ {
return inst->opcode == FS_OPCODE_PLACEHOLDER_HALT || return inst->opcode == SHADER_OPCODE_HALT_TARGET ||
inst->is_control_flow() || inst->is_control_flow() ||
inst->has_side_effects(); inst->has_side_effects();
} }

View File

@@ -453,8 +453,8 @@ brw_instruction_name(const struct gen_device_info *devinfo, enum opcode op)
case FS_OPCODE_PACK_HALF_2x16_SPLIT: case FS_OPCODE_PACK_HALF_2x16_SPLIT:
return "pack_half_2x16_split"; return "pack_half_2x16_split";
case FS_OPCODE_PLACEHOLDER_HALT: case SHADER_OPCODE_HALT_TARGET:
return "placeholder_halt"; return "halt_target";
case FS_OPCODE_INTERPOLATE_AT_SAMPLE: case FS_OPCODE_INTERPOLATE_AT_SAMPLE:
return "interp_sample"; return "interp_sample";