summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schürmann <daniel@schuermann.dev>2024-08-28 11:40:47 +0200
committerMarge Bot <emma+marge@anholt.net>2024-09-02 15:31:52 +0000
commit6ada0170c497bfe6bf029373b5e95d21b940abfa (patch)
treeeb7ec34c484392697dc9f3cc16939056fd7b0b9c
parent709f60e71d1fcc3b2afd67da7ff20622f71ea5d2 (diff)
aco/ra: use arena allocator for hash maps
Also change Key types to uint32_t instead of unsigned. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30898>
-rw-r--r--src/amd/compiler/aco_register_allocation.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 619543d4603..7a28515e602 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -14,8 +14,6 @@
#include <bitset>
#include <map>
#include <optional>
-#include <set>
-#include <unordered_map>
#include <vector>
namespace aco {
@@ -90,12 +88,13 @@ struct ra_ctx {
Program* program;
Block* block = NULL;
+ aco::monotonic_buffer_resource memory;
std::vector<assignment> assignments;
- std::vector<std::unordered_map<unsigned, Temp>> renames;
+ std::vector<aco::unordered_map<uint32_t, Temp>> renames;
std::vector<uint32_t> loop_header;
- std::unordered_map<unsigned, Temp> orig_names;
- std::unordered_map<unsigned, Instruction*> vectors;
- std::unordered_map<unsigned, Instruction*> split_vectors;
+ aco::unordered_map<uint32_t, Temp> orig_names;
+ aco::unordered_map<uint32_t, Instruction*> vectors;
+ aco::unordered_map<uint32_t, Instruction*> split_vectors;
aco_ptr<Instruction> pseudo_dummy;
aco_ptr<Instruction> phi_dummy;
uint16_t max_used_sgpr = 0;
@@ -114,7 +113,8 @@ struct ra_ctx {
ra_ctx(Program* program_, ra_test_policy policy_)
: program(program_), assignments(program->peekAllocationId()),
- renames(program->blocks.size()), policy(policy_)
+ renames(program->blocks.size(), aco::unordered_map<uint32_t, Temp>(memory)),
+ orig_names(memory), vectors(memory), split_vectors(memory), policy(policy_)
{
pseudo_dummy.reset(create_instruction(aco_opcode::p_parallelcopy, Format::PSEUDO, 0, 0));
phi_dummy.reset(create_instruction(aco_opcode::p_linear_phi, Format::PSEUDO, 0, 0));
@@ -2370,7 +2370,7 @@ handle_loop_phis(ra_ctx& ctx, const IDSet& live_in, uint32_t loop_header_idx,
uint32_t loop_exit_idx)
{
Block& loop_header = ctx.program->blocks[loop_header_idx];
- std::unordered_map<unsigned, Temp> renames;
+ aco::unordered_map<uint32_t, Temp> renames(ctx.memory);
/* create phis for variables renamed during the loop */
for (unsigned t : live_in) {
@@ -2625,7 +2625,7 @@ void
get_affinities(ra_ctx& ctx)
{
std::vector<std::vector<Temp>> phi_resources;
- std::unordered_map<unsigned, unsigned> temp_to_phi_resources;
+ aco::unordered_map<uint32_t, uint32_t> temp_to_phi_resources(ctx.memory);
for (auto block_rit = ctx.program->blocks.rbegin(); block_rit != ctx.program->blocks.rend();
block_rit++) {