aco: Use std::vector for the underlying container of std::stack
By default, std::stack uses std::deque to allocate its elements, which has poor cache efficiency. std::vector makes appending elements more expensive (due to potential reallocations), but in the changed contexts the element count should always be low anyway. Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>
This commit is contained in:
@@ -847,7 +847,7 @@ void
|
||||
mitigate_hazards(Program* program)
|
||||
{
|
||||
std::vector<Ctx> all_ctx(program->blocks.size());
|
||||
std::stack<unsigned> loop_header_indices;
|
||||
std::stack<unsigned, std::vector<unsigned>> loop_header_indices;
|
||||
|
||||
for (unsigned i = 0; i < program->blocks.size(); i++) {
|
||||
Block& block = program->blocks[i];
|
||||
|
||||
@@ -767,7 +767,7 @@ insert_wait_states(Program* program)
|
||||
std::vector<wait_ctx> in_ctx(program->blocks.size(), wait_ctx(program));
|
||||
std::vector<wait_ctx> out_ctx(program->blocks.size(), wait_ctx(program));
|
||||
|
||||
std::stack<unsigned> loop_header_indices;
|
||||
std::stack<unsigned, std::vector<unsigned>> loop_header_indices;
|
||||
unsigned loop_progress = 0;
|
||||
|
||||
for (unsigned i = 0; i < program->blocks.size();) {
|
||||
|
||||
@@ -11811,7 +11811,7 @@ select_gs_copy_shader(Program* program, struct nir_shader* gs_shader, ac_shader_
|
||||
Temp vtx_offset = bld.vop2(aco_opcode::v_lshlrev_b32, bld.def(v1), Operand::c32(2u),
|
||||
get_arg(&ctx, ctx.args->ac.vertex_id));
|
||||
|
||||
std::stack<if_context> if_contexts;
|
||||
std::stack<if_context, std::vector<if_context>> if_contexts;
|
||||
|
||||
for (unsigned stream = 0; stream < 4; stream++) {
|
||||
if (stream_id.isConstant() && stream != stream_id.constantValue())
|
||||
|
||||
@@ -56,7 +56,7 @@ struct spill_ctx {
|
||||
std::vector<std::map<Temp, uint32_t>> spills_entry;
|
||||
std::vector<std::map<Temp, uint32_t>> spills_exit;
|
||||
std::vector<bool> processed;
|
||||
std::stack<Block*> loop_header;
|
||||
std::stack<Block*, std::vector<Block*>> loop_header;
|
||||
std::vector<std::map<Temp, std::pair<uint32_t, uint32_t>>> next_use_distances_start;
|
||||
std::vector<std::map<Temp, std::pair<uint32_t, uint32_t>>> next_use_distances_end;
|
||||
std::vector<std::pair<RegClass, std::unordered_set<uint32_t>>> interferences;
|
||||
|
||||
Reference in New Issue
Block a user