From ab6d7929864b1c80a8de5b7cd58775f02fe1a7ff Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Sun, 13 Mar 2016 19:26:37 -0700 Subject: [PATCH] intel/compiler: Pass detailed dependency classes to invalidate_analysis() Have fun reading through the whole back-end optimizer to verify whether I've missed any dependency flags -- Or alternatively, just trust that any mistake here will trigger an assertion failure during analysis pass validation if it ever poses a problem for the consistency of any of the analysis passes managed by the framework. Reviewed-by: Matt Turner Part-of: --- src/intel/compiler/brw_dead_control_flow.cpp | 2 +- src/intel/compiler/brw_fs.cpp | 51 ++++++++++--------- .../compiler/brw_fs_cmod_propagation.cpp | 2 +- .../compiler/brw_fs_combine_constants.cpp | 2 +- .../compiler/brw_fs_copy_propagation.cpp | 3 +- src/intel/compiler/brw_fs_cse.cpp | 2 +- .../compiler/brw_fs_dead_code_eliminate.cpp | 2 +- src/intel/compiler/brw_fs_lower_pack.cpp | 2 +- src/intel/compiler/brw_fs_lower_regioning.cpp | 2 +- src/intel/compiler/brw_fs_reg_allocate.cpp | 2 +- .../compiler/brw_fs_register_coalesce.cpp | 2 +- src/intel/compiler/brw_fs_sel_peephole.cpp | 2 +- src/intel/compiler/brw_predicated_break.cpp | 2 +- .../compiler/brw_schedule_instructions.cpp | 4 +- src/intel/compiler/brw_vec4.cpp | 24 +++++---- .../compiler/brw_vec4_cmod_propagation.cpp | 2 +- .../compiler/brw_vec4_copy_propagation.cpp | 3 +- src/intel/compiler/brw_vec4_cse.cpp | 2 +- .../compiler/brw_vec4_dead_code_eliminate.cpp | 2 +- src/intel/compiler/brw_vec4_reg_allocate.cpp | 2 +- 20 files changed, 61 insertions(+), 54 deletions(-) diff --git a/src/intel/compiler/brw_dead_control_flow.cpp b/src/intel/compiler/brw_dead_control_flow.cpp index a52bb233d26..0d9253bab18 100644 --- a/src/intel/compiler/brw_dead_control_flow.cpp +++ b/src/intel/compiler/brw_dead_control_flow.cpp @@ -115,7 +115,7 @@ dead_control_flow_eliminate(backend_shader *s) } if (progress) - s->invalidate_analysis(DEPENDENCY_EVERYTHING); + s->invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 6e79405165e..e12650c83cc 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -2029,7 +2029,7 @@ fs_visitor::split_virtual_grfs() } } } - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | DEPENDENCY_VARIABLES); delete[] split_points; delete[] new_virtual_grf; @@ -2074,7 +2074,7 @@ fs_visitor::compact_virtual_grfs() } else { remap_table[i] = new_index; alloc.sizes[new_index] = alloc.sizes[i]; - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | DEPENDENCY_VARIABLES); ++new_index; } } @@ -2537,7 +2537,7 @@ fs_visitor::lower_constant_loads() inst->remove(block); } } - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } bool @@ -2817,7 +2817,8 @@ fs_visitor::opt_algebraic() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW | + DEPENDENCY_INSTRUCTION_DETAIL); return progress; } @@ -2868,7 +2869,7 @@ fs_visitor::opt_zero_samples() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL); return progress; } @@ -2965,7 +2966,7 @@ fs_visitor::opt_sampler_eot() * flag and submit a header together with the sampler message as required * by the hardware. */ - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return true; } @@ -3018,7 +3019,8 @@ fs_visitor::opt_register_renaming() } if (progress) { - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | + DEPENDENCY_VARIABLES); for (unsigned i = 0; i < ARRAY_SIZE(delta_xy); i++) { if (delta_xy[i].file == VGRF && remap[delta_xy[i].nr] != ~0u) { @@ -3066,7 +3068,7 @@ fs_visitor::opt_redundant_discard_jumps() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -3260,7 +3262,7 @@ fs_visitor::compute_to_mrf() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -3318,7 +3320,7 @@ fs_visitor::eliminate_find_live_channel() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL); return progress; } @@ -3466,7 +3468,7 @@ fs_visitor::remove_duplicate_mrf_writes() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -3515,7 +3517,7 @@ fs_visitor::remove_extra_rounding_modes() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -3696,7 +3698,7 @@ fs_visitor::insert_gen4_send_dependency_workarounds() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } /** @@ -3736,7 +3738,7 @@ fs_visitor::lower_uniform_pull_constant_loads() inst->header_size = 1; inst->mlen = 1; - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); } else { /* Before register allocation, we didn't tell the scheduler about the * MRF we use. We know it's safe to use this MRF because nothing @@ -3854,7 +3856,7 @@ fs_visitor::lower_load_payload() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -4154,7 +4156,7 @@ fs_visitor::lower_integer_multiplication() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -4184,7 +4186,7 @@ fs_visitor::lower_minmax() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -4273,7 +4275,7 @@ fs_visitor::lower_sub_sat() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -5985,7 +5987,7 @@ fs_visitor::lower_logical_sends() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -6870,7 +6872,7 @@ fs_visitor::lower_simd_width() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -6951,7 +6953,7 @@ fs_visitor::lower_barycentrics() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -7593,7 +7595,7 @@ fs_visitor::fixup_sends_duplicate_payload() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -7616,7 +7618,8 @@ fs_visitor::fixup_3src_null_dest() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | + DEPENDENCY_VARIABLES); } /** @@ -7759,7 +7762,7 @@ fs_visitor::fixup_nomask_control_flow() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } diff --git a/src/intel/compiler/brw_fs_cmod_propagation.cpp b/src/intel/compiler/brw_fs_cmod_propagation.cpp index 9f35c13dd6f..0b02b336d69 100644 --- a/src/intel/compiler/brw_fs_cmod_propagation.cpp +++ b/src/intel/compiler/brw_fs_cmod_propagation.cpp @@ -448,7 +448,7 @@ fs_visitor::opt_cmod_propagation() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_fs_combine_constants.cpp b/src/intel/compiler/brw_fs_combine_constants.cpp index ebedbb4cdf6..ec48a74ba0b 100644 --- a/src/intel/compiler/brw_fs_combine_constants.cpp +++ b/src/intel/compiler/brw_fs_combine_constants.cpp @@ -559,7 +559,7 @@ fs_visitor::opt_combine_constants() } ralloc_free(const_ctx); - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return true; } diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp index c75bdac81ee..262fc2c49ac 100644 --- a/src/intel/compiler/brw_fs_copy_propagation.cpp +++ b/src/intel/compiler/brw_fs_copy_propagation.cpp @@ -1067,7 +1067,8 @@ fs_visitor::opt_copy_propagation() ralloc_free(copy_prop_ctx); if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW | + DEPENDENCY_INSTRUCTION_DETAIL); return progress; } diff --git a/src/intel/compiler/brw_fs_cse.cpp b/src/intel/compiler/brw_fs_cse.cpp index 97a8e146013..ffc6f03d0fe 100644 --- a/src/intel/compiler/brw_fs_cse.cpp +++ b/src/intel/compiler/brw_fs_cse.cpp @@ -389,7 +389,7 @@ fs_visitor::opt_cse() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } diff --git a/src/intel/compiler/brw_fs_dead_code_eliminate.cpp b/src/intel/compiler/brw_fs_dead_code_eliminate.cpp index d1b2d907bdc..8e30e6de6ce 100644 --- a/src/intel/compiler/brw_fs_dead_code_eliminate.cpp +++ b/src/intel/compiler/brw_fs_dead_code_eliminate.cpp @@ -144,7 +144,7 @@ fs_visitor::dead_code_eliminate() ralloc_free(flag_live); if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_fs_lower_pack.cpp b/src/intel/compiler/brw_fs_lower_pack.cpp index 011a326ac1e..ac7b61de6f0 100644 --- a/src/intel/compiler/brw_fs_lower_pack.cpp +++ b/src/intel/compiler/brw_fs_lower_pack.cpp @@ -49,7 +49,7 @@ fs_visitor::lower_pack() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_fs_lower_regioning.cpp b/src/intel/compiler/brw_fs_lower_regioning.cpp index 24542584ce4..9db2c540afa 100644 --- a/src/intel/compiler/brw_fs_lower_regioning.cpp +++ b/src/intel/compiler/brw_fs_lower_regioning.cpp @@ -454,7 +454,7 @@ fs_visitor::lower_regioning() progress |= lower_instruction(this, block, inst); if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp b/src/intel/compiler/brw_fs_reg_allocate.cpp index ffc3f21af72..f8ef23e1504 100644 --- a/src/intel/compiler/brw_fs_reg_allocate.cpp +++ b/src/intel/compiler/brw_fs_reg_allocate.cpp @@ -1208,7 +1208,7 @@ fs_reg_alloc::assign_regs(bool allow_spilling, bool spill_all) } if (spilled) - fs->invalidate_analysis(DEPENDENCY_EVERYTHING); + fs->invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); /* Get the chosen virtual registers for each node, and map virtual * regs in the register classes back down to real hardware reg diff --git a/src/intel/compiler/brw_fs_register_coalesce.cpp b/src/intel/compiler/brw_fs_register_coalesce.cpp index 8a87619dbe1..15699658bc7 100644 --- a/src/intel/compiler/brw_fs_register_coalesce.cpp +++ b/src/intel/compiler/brw_fs_register_coalesce.cpp @@ -290,7 +290,7 @@ fs_visitor::register_coalesce() } } - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } return progress; diff --git a/src/intel/compiler/brw_fs_sel_peephole.cpp b/src/intel/compiler/brw_fs_sel_peephole.cpp index 5343d98d90e..b36a048601f 100644 --- a/src/intel/compiler/brw_fs_sel_peephole.cpp +++ b/src/intel/compiler/brw_fs_sel_peephole.cpp @@ -215,7 +215,7 @@ fs_visitor::opt_peephole_sel() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } diff --git a/src/intel/compiler/brw_predicated_break.cpp b/src/intel/compiler/brw_predicated_break.cpp index cc29b029b45..f5f40aaabb3 100644 --- a/src/intel/compiler/brw_predicated_break.cpp +++ b/src/intel/compiler/brw_predicated_break.cpp @@ -138,7 +138,7 @@ opt_predicated_break(backend_shader *s) } if (progress) - s->invalidate_analysis(DEPENDENCY_EVERYTHING); + s->invalidate_analysis(DEPENDENCY_BLOCKS | DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_schedule_instructions.cpp b/src/intel/compiler/brw_schedule_instructions.cpp index 826f2e771e3..64a43c1156b 100644 --- a/src/intel/compiler/brw_schedule_instructions.cpp +++ b/src/intel/compiler/brw_schedule_instructions.cpp @@ -1839,7 +1839,7 @@ fs_visitor::schedule_instructions(instruction_scheduler_mode mode) cfg->num_blocks, mode); sched.run(cfg); - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } void @@ -1848,5 +1848,5 @@ vec4_visitor::opt_schedule_instructions() vec4_instruction_scheduler sched(this, prog_data->total_grf); sched.run(cfg); - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); } diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 18676d4c4ca..de2149f416b 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -496,7 +496,7 @@ vec4_visitor::opt_vector_float() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -577,7 +577,7 @@ vec4_visitor::opt_reduce_swizzle() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL); return progress; } @@ -904,7 +904,8 @@ vec4_visitor::opt_algebraic() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW | + DEPENDENCY_INSTRUCTION_DETAIL); return progress; } @@ -1474,7 +1475,7 @@ vec4_visitor::opt_register_coalesce() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -1525,7 +1526,7 @@ vec4_visitor::eliminate_find_live_channel() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL); return progress; } @@ -1601,7 +1602,7 @@ vec4_visitor::split_virtual_grfs() } } } - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | DEPENDENCY_VARIABLES); } void @@ -1904,7 +1905,7 @@ vec4_visitor::lower_minmax() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -2040,7 +2041,8 @@ vec4_visitor::fixup_3src_null_dest() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DETAIL | + DEPENDENCY_VARIABLES); } void @@ -2368,7 +2370,7 @@ vec4_visitor::lower_simd_width() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } @@ -2525,7 +2527,7 @@ vec4_visitor::scalarize_df() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } @@ -2568,7 +2570,7 @@ vec4_visitor::lower_64bit_mad_to_mul_add() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } diff --git a/src/intel/compiler/brw_vec4_cmod_propagation.cpp b/src/intel/compiler/brw_vec4_cmod_propagation.cpp index 5123f2cf6bd..be0f957aeba 100644 --- a/src/intel/compiler/brw_vec4_cmod_propagation.cpp +++ b/src/intel/compiler/brw_vec4_cmod_propagation.cpp @@ -357,7 +357,7 @@ vec4_visitor::opt_cmod_propagation() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_vec4_copy_propagation.cpp b/src/intel/compiler/brw_vec4_copy_propagation.cpp index 68087339c55..597e75c8b89 100644 --- a/src/intel/compiler/brw_vec4_copy_propagation.cpp +++ b/src/intel/compiler/brw_vec4_copy_propagation.cpp @@ -559,7 +559,8 @@ vec4_visitor::opt_copy_propagation(bool do_constant_prop) } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTION_DATA_FLOW | + DEPENDENCY_INSTRUCTION_DETAIL); return progress; } diff --git a/src/intel/compiler/brw_vec4_cse.cpp b/src/intel/compiler/brw_vec4_cse.cpp index d0dbd23ff07..2a4217249e8 100644 --- a/src/intel/compiler/brw_vec4_cse.cpp +++ b/src/intel/compiler/brw_vec4_cse.cpp @@ -317,7 +317,7 @@ vec4_visitor::opt_cse() } if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); return progress; } diff --git a/src/intel/compiler/brw_vec4_dead_code_eliminate.cpp b/src/intel/compiler/brw_vec4_dead_code_eliminate.cpp index 730d4349443..5975f1f6437 100644 --- a/src/intel/compiler/brw_vec4_dead_code_eliminate.cpp +++ b/src/intel/compiler/brw_vec4_dead_code_eliminate.cpp @@ -183,7 +183,7 @@ vec4_visitor::dead_code_eliminate() ralloc_free(flag_live); if (progress) - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS); return progress; } diff --git a/src/intel/compiler/brw_vec4_reg_allocate.cpp b/src/intel/compiler/brw_vec4_reg_allocate.cpp index 34514a46db9..4e4f3431c6d 100644 --- a/src/intel/compiler/brw_vec4_reg_allocate.cpp +++ b/src/intel/compiler/brw_vec4_reg_allocate.cpp @@ -540,7 +540,7 @@ vec4_visitor::spill_reg(unsigned spill_reg_nr) } } - invalidate_analysis(DEPENDENCY_EVERYTHING); + invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES); } } /* namespace brw */ -- 2.30.2