mirror of https://gitlab.freedesktop.org/mesa/mesa
aco/spill: Insert p_start_linear_vgpr right after p_logical_end
If p_start_linear_vgpr allocates a VGPR that is already blocked, RA will try moving the blocking VGPR somewhere else. If p_start_linear_vgpr is inserted right before the branch, that move will be inserted after exec has been overwritten, which might cause the move to be skipped for some threads. Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28041>
This commit is contained in:
parent
84c1870b65
commit
590ea76104
|
@ -103,11 +103,16 @@ setup_reduce_temp(Program* program)
|
|||
* would insert at the end instead of using this one. */
|
||||
} else {
|
||||
assert(last_top_level_block_idx < block.index);
|
||||
/* insert before the branch at last top level block */
|
||||
/* insert after p_logical_end of the last top-level block */
|
||||
std::vector<aco_ptr<Instruction>>& instructions =
|
||||
program->blocks[last_top_level_block_idx].instructions;
|
||||
instructions.insert(std::next(instructions.begin(), instructions.size() - 1),
|
||||
std::move(create));
|
||||
auto insert_point =
|
||||
std::find_if(instructions.rbegin(), instructions.rend(),
|
||||
[](const auto& iter) {
|
||||
return iter->opcode == aco_opcode::p_logical_end;
|
||||
})
|
||||
.base();
|
||||
instructions.insert(insert_point, std::move(create));
|
||||
inserted_at = last_top_level_block_idx;
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +151,13 @@ setup_reduce_temp(Program* program)
|
|||
assert(last_top_level_block_idx < block.index);
|
||||
std::vector<aco_ptr<Instruction>>& instructions =
|
||||
program->blocks[last_top_level_block_idx].instructions;
|
||||
instructions.insert(std::next(instructions.begin(), instructions.size() - 1),
|
||||
std::move(create));
|
||||
auto insert_point =
|
||||
std::find_if(instructions.rbegin(), instructions.rend(),
|
||||
[](const auto& iter) {
|
||||
return iter->opcode == aco_opcode::p_logical_end;
|
||||
})
|
||||
.base();
|
||||
instructions.insert(insert_point, std::move(create));
|
||||
vtmp_inserted_at = last_top_level_block_idx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1604,10 +1604,16 @@ assign_spill_slots(spill_ctx& ctx, unsigned spills_to_vgpr)
|
|||
instructions.emplace_back(std::move(create));
|
||||
} else {
|
||||
assert(last_top_level_block_idx < block.index);
|
||||
/* insert before the branch at last top level block */
|
||||
/* insert after p_logical_end of the last top-level block */
|
||||
std::vector<aco_ptr<Instruction>>& block_instrs =
|
||||
ctx.program->blocks[last_top_level_block_idx].instructions;
|
||||
block_instrs.insert(std::prev(block_instrs.end()), std::move(create));
|
||||
auto insert_point =
|
||||
std::find_if(block_instrs.rbegin(), block_instrs.rend(),
|
||||
[](const auto& iter) {
|
||||
return iter->opcode == aco_opcode::p_logical_end;
|
||||
})
|
||||
.base();
|
||||
block_instrs.insert(insert_point, std::move(create));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1644,10 +1650,16 @@ assign_spill_slots(spill_ctx& ctx, unsigned spills_to_vgpr)
|
|||
instructions.emplace_back(std::move(create));
|
||||
} else {
|
||||
assert(last_top_level_block_idx < block.index);
|
||||
/* insert before the branch at last top level block */
|
||||
/* insert after p_logical_end of the last top-level block */
|
||||
std::vector<aco_ptr<Instruction>>& block_instrs =
|
||||
ctx.program->blocks[last_top_level_block_idx].instructions;
|
||||
block_instrs.insert(std::prev(block_instrs.end()), std::move(create));
|
||||
auto insert_point =
|
||||
std::find_if(block_instrs.rbegin(), block_instrs.rend(),
|
||||
[](const auto& iter) {
|
||||
return iter->opcode == aco_opcode::p_logical_end;
|
||||
})
|
||||
.base();
|
||||
block_instrs.insert(insert_point, std::move(create));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue