diff options
author | Daniel Schürmann <daniel@schuermann.dev> | 2022-10-21 11:09:46 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-10-25 09:08:08 +0000 |
commit | a36e27e507d4a16678ccd0e873883956a7e6302a (patch) | |
tree | 893a8430c44397e66ade9834870c68e05b6bf0be /src/amd/compiler/aco_ir.h | |
parent | 43d93c32c94016cbbee775b3b0c75a64fe583f4c (diff) | |
download | mesa-a36e27e507d4a16678ccd0e873883956a7e6302a.tar.gz |
aco: change thread_local memory resource to pointer
Apparently the TLS constructor doesn't work well if RADV
is instantiated multiple times and/or used by a program with
already existing threads.
Fixes: a128d444cbf4f74b0bdd4a8ae3f1cd2a52dee122 ('aco: use monotonic_buffer_resource for instructions')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19219>
Diffstat (limited to 'src/amd/compiler/aco_ir.h')
-rw-r--r-- | src/amd/compiler/aco_ir.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index a06c3bc7507..9220fec588e 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -1778,7 +1778,7 @@ struct Pseudo_reduction_instruction : public Instruction { static_assert(sizeof(Pseudo_reduction_instruction) == sizeof(Instruction) + 4, "Unexpected padding"); -extern thread_local aco::monotonic_buffer_resource instruction_buffer; +extern thread_local aco::monotonic_buffer_resource* instruction_buffer; struct instr_deleter_functor { /* Don't yet free any instructions. They will be de-allocated @@ -1796,7 +1796,7 @@ create_instruction(aco_opcode opcode, Format format, uint32_t num_operands, { std::size_t size = sizeof(T) + num_operands * sizeof(Operand) + num_definitions * sizeof(Definition); - void* data = instruction_buffer.allocate(size, alignof(uint32_t)); + void* data = instruction_buffer->allocate(size, alignof(uint32_t)); memset(data, 0, size); T* inst = (T*)data; @@ -2155,6 +2155,7 @@ enum class CompilationProgress { class Program final { public: + aco::monotonic_buffer_resource m{65536}; std::vector<Block> blocks; std::vector<RegClass> temp_rc = {s1}; RegisterDemand max_reg_demand = RegisterDemand(); |