Module: Mesa Branch: master Commit: beb292343a5c79e470add96a88abedbf1133be52 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=beb292343a5c79e470add96a88abedbf1133be52
Author: Daniel Schürmann <[email protected]> Date: Wed Feb 17 18:29:48 2021 +0100 aco/spill: refactor spill decision taking No fossil-db changes. Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196> --- src/amd/compiler/aco_spill.cpp | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index e10fb96fd19..8fcb5520483 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -1134,31 +1134,21 @@ void process_block(spill_ctx& ctx, unsigned block_idx, Block* block, unsigned distance = 0; Temp to_spill; bool do_rematerialize = false; - if (new_demand.vgpr - spilled_registers.vgpr > ctx.target_pressure.vgpr) { - for (std::pair<Temp, uint32_t> pair : local_next_use_distance[idx]) { - bool can_rematerialize = ctx.remat.count(pair.first); - if (pair.first.type() == RegType::vgpr && - ((pair.second > distance && can_rematerialize == do_rematerialize) || - (can_rematerialize && !do_rematerialize && pair.second > idx)) && - current_spills.find(pair.first) == current_spills.end() && - ctx.spills_exit[block_idx].find(pair.first) == ctx.spills_exit[block_idx].end()) { - to_spill = pair.first; - distance = pair.second; - do_rematerialize = can_rematerialize; - } - } - } else { - for (std::pair<Temp, uint32_t> pair : local_next_use_distance[idx]) { - bool can_rematerialize = ctx.remat.count(pair.first); - if (pair.first.type() == RegType::sgpr && - ((pair.second > distance && can_rematerialize == do_rematerialize) || - (can_rematerialize && !do_rematerialize && pair.second > idx)) && - current_spills.find(pair.first) == current_spills.end() && - ctx.spills_exit[block_idx].find(pair.first) == ctx.spills_exit[block_idx].end()) { - to_spill = pair.first; - distance = pair.second; - do_rematerialize = can_rematerialize; - } + RegType type = RegType::sgpr; + if (new_demand.vgpr - spilled_registers.vgpr > ctx.target_pressure.vgpr) + type = RegType::vgpr; + + for (std::pair<Temp, uint32_t> pair : local_next_use_distance[idx]) { + if (pair.first.type() != type) + continue; + bool can_rematerialize = ctx.remat.count(pair.first); + if (((pair.second > distance && can_rematerialize == do_rematerialize) || + (can_rematerialize && !do_rematerialize && pair.second > idx)) && + current_spills.find(pair.first) == current_spills.end() && + ctx.spills_exit[block_idx].find(pair.first) == ctx.spills_exit[block_idx].end()) { + to_spill = pair.first; + distance = pair.second; + do_rematerialize = can_rematerialize; } } _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
