From e76e3590072a60a20115cf69ca0b3aa442269f99 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 19 Nov 2020 09:32:27 -0600 Subject: [PATCH] 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 Part-of: --- src/intel/compiler/brw_eu_defines.h | 8 ++++++- src/intel/compiler/brw_fs.cpp | 22 +++++++++---------- src/intel/compiler/brw_fs.h | 2 +- src/intel/compiler/brw_fs_cse.cpp | 2 +- src/intel/compiler/brw_fs_generator.cpp | 6 ++--- src/intel/compiler/brw_fs_scoreboard.cpp | 2 +- src/intel/compiler/brw_ir_performance.cpp | 4 ++-- .../compiler/brw_schedule_instructions.cpp | 2 +- src/intel/compiler/brw_shader.cpp | 4 ++-- 9 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/intel/compiler/brw_eu_defines.h b/src/intel/compiler/brw_eu_defines.h index e518c8b0439..8af294aa25c 100644 --- a/src/intel/compiler/brw_eu_defines.h +++ b/src/intel/compiler/brw_eu_defines.h @@ -552,6 +552,13 @@ enum opcode { 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_PACK_BYTES, VEC4_OPCODE_UNPACK_UNIFORM, @@ -581,7 +588,6 @@ enum opcode { FS_OPCODE_DISCARD_JUMP, FS_OPCODE_SET_SAMPLE_ID, FS_OPCODE_PACK_HALF_2x16_SPLIT, - FS_OPCODE_PLACEHOLDER_HALT, FS_OPCODE_INTERPOLATE_AT_SAMPLE, FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET, FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET, diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index ea76a21fa17..e90cf879969 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -3035,21 +3035,21 @@ fs_visitor::opt_redundant_discard_jumps() 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) { - if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) { - placeholder_halt = inst; + if (inst->opcode == SHADER_OPCODE_HALT_TARGET) { + halt_target = inst; break; } } - if (!placeholder_halt) + if (!halt_target) return false; - /* Delete any HALTs immediately before the placeholder halt. */ - for (fs_inst *prev = (fs_inst *) placeholder_halt->prev; + /* Delete any HALTs immediately before the halt target. */ + for (fs_inst *prev = (fs_inst *) halt_target->prev; !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); 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 * divergent control flow due to a HALT jump. There is no * 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 * 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) { foreach_block_and_inst(block, fs_inst, inst, v->cfg) { if (inst->opcode == FS_OPCODE_DISCARD_JUMP || - inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) + inst->opcode == SHADER_OPCODE_HALT_TARGET) return inst; } } @@ -8012,7 +8012,7 @@ fs_visitor::fixup_nomask_control_flow() case BRW_OPCODE_WHILE: case BRW_OPCODE_ENDIF: - case FS_OPCODE_PLACEHOLDER_HALT: + case SHADER_OPCODE_HALT_TARGET: depth++; break; @@ -8528,7 +8528,7 @@ fs_visitor::run_fs(bool allow_spilling, bool do_rep_send) return false; if (wm_prog_data->uses_kill) - bld.emit(FS_OPCODE_PLACEHOLDER_HALT); + bld.emit(SHADER_OPCODE_HALT_TARGET); if (wm_key->alpha_test_func) emit_alpha_test(); diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index b3b280192dc..26b7c59c4cf 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -562,7 +562,7 @@ private: struct brw_reg dst, struct brw_reg src, unsigned swiz); - bool patch_discard_jumps_to_fb_writes(); + bool patch_halt_jumps(); const struct brw_compiler *compiler; void *log_data; /* Passed to compiler->*_log functions */ diff --git a/src/intel/compiler/brw_fs_cse.cpp b/src/intel/compiler/brw_fs_cse.cpp index 198bb5c4c5e..b5b844cec7f 100644 --- a/src/intel/compiler/brw_fs_cse.cpp +++ b/src/intel/compiler/brw_fs_cse.cpp @@ -325,7 +325,7 @@ fs_visitor::opt_cse_local(const fs_live_variables &live, bblock_t *block, int &i * SHADER_OPCODE_FIND_LIVE_CHANNEL. */ if (inst->opcode == FS_OPCODE_DISCARD_JUMP || - inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) + inst->opcode == SHADER_OPCODE_HALT_TARGET) aeb.make_empty(); foreach_in_list_safe(aeb_entry, entry, &aeb) { diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp index da5f69c45c7..1b64327e18b 100644 --- a/src/intel/compiler/brw_fs_generator.cpp +++ b/src/intel/compiler/brw_fs_generator.cpp @@ -222,7 +222,7 @@ public: }; bool -fs_generator::patch_discard_jumps_to_fb_writes() +fs_generator::patch_halt_jumps() { if (this->discard_halt_patches.is_empty()) 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]); break; - case FS_OPCODE_PLACEHOLDER_HALT: + case SHADER_OPCODE_HALT_TARGET: /* 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. */ - if (!patch_discard_jumps_to_fb_writes()) { + if (!patch_halt_jumps()) { if (unlikely(debug_flag)) { disasm_info->use_tail = true; } diff --git a/src/intel/compiler/brw_fs_scoreboard.cpp b/src/intel/compiler/brw_fs_scoreboard.cpp index 899b47542ba..7bdc8e82d90 100644 --- a/src/intel/compiler/brw_fs_scoreboard.cpp +++ b/src/intel/compiler/brw_fs_scoreboard.cpp @@ -76,7 +76,7 @@ namespace { case BRW_OPCODE_SYNC: case BRW_OPCODE_DO: case SHADER_OPCODE_UNDEF: - case FS_OPCODE_PLACEHOLDER_HALT: + case SHADER_OPCODE_HALT_TARGET: case FS_OPCODE_SCHEDULING_FENCE: return 0; default: diff --git a/src/intel/compiler/brw_ir_performance.cpp b/src/intel/compiler/brw_ir_performance.cpp index 6129dd4da61..dd6bbc54e68 100644 --- a/src/intel/compiler/brw_ir_performance.cpp +++ b/src/intel/compiler/brw_ir_performance.cpp @@ -1098,7 +1098,7 @@ namespace { } case SHADER_OPCODE_UNDEF: - case FS_OPCODE_PLACEHOLDER_HALT: + case SHADER_OPCODE_HALT_TARGET: case FS_OPCODE_SCHEDULING_FENCE: return calculate_desc(info, unit_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); @@ -1552,7 +1552,7 @@ namespace { 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; elapsed += (st.unit_ready[unit_fe] - clock0) * st.weight; diff --git a/src/intel/compiler/brw_schedule_instructions.cpp b/src/intel/compiler/brw_schedule_instructions.cpp index db6f6ac36b1..10148c50999 100644 --- a/src/intel/compiler/brw_schedule_instructions.cpp +++ b/src/intel/compiler/brw_schedule_instructions.cpp @@ -1047,7 +1047,7 @@ instruction_scheduler::add_dep(schedule_node *before, schedule_node *after) static bool 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->has_side_effects(); } diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp index fdbce3392fb..244e9bb2b1c 100644 --- a/src/intel/compiler/brw_shader.cpp +++ b/src/intel/compiler/brw_shader.cpp @@ -453,8 +453,8 @@ brw_instruction_name(const struct gen_device_info *devinfo, enum opcode op) case FS_OPCODE_PACK_HALF_2x16_SPLIT: return "pack_half_2x16_split"; - case FS_OPCODE_PLACEHOLDER_HALT: - return "placeholder_halt"; + case SHADER_OPCODE_HALT_TARGET: + return "halt_target"; case FS_OPCODE_INTERPOLATE_AT_SAMPLE: return "interp_sample";