On Wed, Oct 16, 2013 at 2:08 AM, Ian Romanick <[email protected]> wrote: > On 10/09/2013 12:06 AM, Chia-I Wu wrote: >> From: Chia-I Wu <[email protected]> >> >> FS_OPCODE_OVERWRITE_DST is used to indicate that the destination register is >> (completely) overwritten. No code is emitted, but the liveness analysis can >> use it as a hint to add the destination register to DEF bitset. This is >> needed because it is hard to figure out if some partial writes combined >> constitute a complete write during liveness analysis, while it is easier for >> the FS visitor to know if that is the case. > > What changed from v1 of the series? Just reordering (since some other > patches from the original series landed) and rebasing on current master? Yes, as said in my reply to Eric. I will send v3 shortly, and add notes as to what were changed.
> >> Signed-off-by: Chia-I Wu <[email protected]> >> --- >> src/mesa/drivers/dri/i965/brw_defines.h | 1 + >> src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 4 ++++ >> src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | 5 +++-- >> src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 3 ++- >> src/mesa/drivers/dri/i965/brw_shader.cpp | 3 +++ >> 5 files changed, 13 insertions(+), 3 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h >> b/src/mesa/drivers/dri/i965/brw_defines.h >> index c1e7f31..753a9ec 100644 >> --- a/src/mesa/drivers/dri/i965/brw_defines.h >> +++ b/src/mesa/drivers/dri/i965/brw_defines.h >> @@ -793,6 +793,7 @@ enum opcode { >> FS_OPCODE_UNPACK_HALF_2x16_SPLIT_X, >> FS_OPCODE_UNPACK_HALF_2x16_SPLIT_Y, >> FS_OPCODE_PLACEHOLDER_HALT, >> + FS_OPCODE_OVERWRITE_DST, >> >> VS_OPCODE_URB_WRITE, >> VS_OPCODE_SCRATCH_READ, >> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp >> b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp >> index dbfbc11..4b37784 100644 >> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp >> @@ -1547,6 +1547,10 @@ fs_generator::generate_code(exec_list *instructions) >> patch_discard_jumps_to_fb_writes(); >> break; >> >> + case FS_OPCODE_OVERWRITE_DST: >> + /* This is to help liveness analysis. */ >> + break; >> + >> default: >> if (inst->opcode < (int) ARRAY_SIZE(opcode_descs)) { >> _mesa_problem(ctx, "Unsupported opcode `%s' in FS", >> diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp >> b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp >> index f5daab2..13891f8 100644 >> --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp >> @@ -77,8 +77,9 @@ fs_live_variables::setup_def_use() >> * variable, and thus qualify for being in def[]. >> */ >> if (inst->dst.file == GRF && >> - inst->regs_written == v->virtual_grf_sizes[inst->dst.reg] && >> - !inst->is_partial_write()) { >> + (inst->opcode == FS_OPCODE_OVERWRITE_DST || >> + (inst->regs_written == v->virtual_grf_sizes[inst->dst.reg] && >> + !inst->is_partial_write()))) { >> int reg = inst->dst.reg; >> if (!BITSET_TEST(bd[b].use, reg)) >> BITSET_SET(bd[b].def, reg); >> diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp >> b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp >> index 5530683..4e59a10 100644 >> --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp >> @@ -562,7 +562,8 @@ fs_instruction_scheduler::calculate_deps() >> schedule_node *n = (schedule_node *)node; >> fs_inst *inst = (fs_inst *)n->inst; >> >> - if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT) >> + if (inst->opcode == FS_OPCODE_PLACEHOLDER_HALT || >> + inst->opcode == FS_OPCODE_OVERWRITE_DST) >> add_barrier_deps(n); >> >> /* read-after-write deps. */ >> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp >> b/src/mesa/drivers/dri/i965/brw_shader.cpp >> index 61c4bf5..e226c94 100644 >> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp >> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp >> @@ -485,6 +485,9 @@ brw_instruction_name(enum opcode op) >> case FS_OPCODE_PLACEHOLDER_HALT: >> return "placeholder_halt"; >> >> + case FS_OPCODE_OVERWRITE_DST: >> + return "overwrite_dst"; >> + >> case VS_OPCODE_URB_WRITE: >> return "vs_urb_write"; >> case VS_OPCODE_SCRATCH_READ: >> > -- [email protected] _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
