From: Tony Wasserka Date: Wed, 21 Jul 2021 15:19:13 +0000 (+0200) Subject: aco/spill: Use arena allocator for spills X-Git-Tag: upstream/23.3.3~6903 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89c86af39e690548150e6c586394d534e8b8c95f;p=platform%2Fupstream%2Fmesa.git aco/spill: Use arena allocator for spills Gives a marginal speedup. Co-authored-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 5f85212..8e9c091 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -69,9 +69,9 @@ struct spill_ctx { aco::monotonic_buffer_resource memory; std::vector> register_demand; - std::vector> renames; - std::vector> spills_entry; - std::vector> spills_exit; + std::vector> renames; + std::vector> spills_entry; + std::vector> spills_exit; std::vector processed; std::stack> loop_header; @@ -83,7 +83,7 @@ struct spill_ctx { std::vector>> interferences; std::vector> affinities; std::vector is_reloaded; - std::unordered_map remat; + aco::unordered_map remat; std::set unused_remats; unsigned wave_size; @@ -94,12 +94,13 @@ struct spill_ctx { spill_ctx(const RegisterDemand target_pressure_, Program* program_, std::vector> register_demand_) : target_pressure(target_pressure_), program(program_), memory(), - register_demand(std::move(register_demand_)), renames(program->blocks.size()), - spills_entry(program->blocks.size()), spills_exit(program->blocks.size()), + register_demand(std::move(register_demand_)), renames(program->blocks.size(), aco::map(memory)), + spills_entry(program->blocks.size(), aco::unordered_map(memory)), + spills_exit(program->blocks.size(), aco::unordered_map(memory)), processed(program->blocks.size(), false), next_use_distances_start(program->blocks.size(), next_use_distance_startend_type(memory)), next_use_distances_end(program->blocks.size(), next_use_distance_startend_type(memory)), - wave_size(program->wave_size), sgpr_spill_slots(0), vgpr_spill_slots(0) + remat(memory), wave_size(program->wave_size), sgpr_spill_slots(0), vgpr_spill_slots(0) {} void add_affinity(uint32_t first, uint32_t second) @@ -1329,7 +1330,7 @@ spill_block(spill_ctx& ctx, unsigned block_idx) Block* loop_header = ctx.loop_header.top(); /* preserve original renames at end of loop header block */ - std::map renames = std::move(ctx.renames[loop_header->index]); + aco::map renames = std::move(ctx.renames[loop_header->index]); /* add coupling code to all loop header predecessors */ add_coupling_code(ctx, loop_header, loop_header->index); @@ -1676,7 +1677,7 @@ assign_spill_slots_helper(spill_ctx& ctx, RegType type, std::vector& is_as void end_unused_spill_vgprs(spill_ctx& ctx, Block& block, std::vector& vgpr_spill_temps, const std::vector& slots, - const std::unordered_map& spills) + const aco::unordered_map& spills) { std::vector is_used(vgpr_spill_temps.size()); for (std::pair pair : spills) { diff --git a/src/amd/compiler/aco_util.h b/src/amd/compiler/aco_util.h index 5f9630f..9659f5a 100644 --- a/src/amd/compiler/aco_util.h +++ b/src/amd/compiler/aco_util.h @@ -520,7 +520,7 @@ private: * as memory resource. The advantage of this specialization is the absence of * virtual function calls and the propagation on swap, copy- and move assignment. */ -template class monotonic_allocator final { +template class monotonic_allocator { public: monotonic_allocator() = delete; monotonic_allocator(monotonic_buffer_resource& m) : memory_resource(m) {}