[Mesa-dev] [PATCH] i965/vec4: dead_code_eliminate: update writemask on null_regs based on flag_live
Francisco Jerez
currojerez at riseup.net
Thu Oct 15 05:38:35 PDT 2015
Alejandro PiƱeiro <apinheiro at igalia.com> writes:
> ---
>
> This patch implements the idea proposed by Francisco Jerez. With this
> change, even adding the new condition pointed by Matt Turner on the
> "2/5 i965/vec4: adding vec4_cmod_propagation optimization", the shader-db
> numbers remain the same. So this patch would go before the optimization
> (so in this series it would be the patch 1.5).
>
> Note: Im not resending the patch 2/5, as Matt pointed that he granted
> the reviewed status with his suggested change. I can send it if needed
> in any case.
>
> .../drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
> index 8fc7a36..31ea128 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_dead_code_eliminate.cpp
> @@ -78,13 +78,19 @@ vec4_visitor::dead_code_eliminate()
> sizeof(BITSET_WORD));
>
> foreach_inst_in_block_reverse(vec4_instruction, inst, block) {
> - if (inst->dst.file == GRF && !inst->has_side_effects()) {
> + if ((inst->dst.file == GRF && !inst->has_side_effects()) ||
> + (inst->dst.is_null() && inst->writes_flag())){
> bool result_live[4] = { false };
>
> - for (unsigned i = 0; i < inst->regs_written; i++) {
> - for (int c = 0; c < 4; c++)
> - result_live[c] |= BITSET_TEST(
> - live, var_from_reg(alloc, offset(inst->dst, i), c));
> + if (inst->dst.file == GRF) {
> + for (unsigned i = 0; i < inst->regs_written; i++) {
> + for (int c = 0; c < 4; c++)
> + result_live[c] |= BITSET_TEST(
> + live, var_from_reg(alloc, offset(inst->dst, i), c));
> + }
> + } else {
> + for (unsigned c = 0; c < 4; c++)
> + result_live[c] |= BITSET_TEST(flag_live, c);
Sadly flag liveness is not kept track of per component -- I.e. the
flag_live bit-set and the flag live-out bitset calculated by liveness
analysis have only one bit representing the union of all components.
This won't work unless you fix that too.
> }
>
> /* If the instruction can't do writemasking, then it's all or
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151015/5d279fdb/attachment.sig>
More information about the mesa-dev
mailing list