r600/sfn: Make use of four clause local registers

The hardware is actually configures like this, but for fma64
we have to sacrifice a "normal" register to allocate z and w
channels, even though the result written there is not used.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24638>
This commit is contained in:
Gert Wollny 2023-08-07 15:10:26 +02:00 committed by Marge Bot
parent c9739e8912
commit 16bef14dd4
5 changed files with 12 additions and 11 deletions

View file

@ -1334,14 +1334,14 @@ int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
}
/* number of gpr == the last gpr used in any alu */
for (i = 0; i < 3; i++) {
if (nalu->src[i].sel >= bc->ngpr && nalu->src[i].sel < 124) {
if (nalu->src[i].sel >= bc->ngpr && nalu->src[i].sel < 123) {
bc->ngpr = nalu->src[i].sel + 1;
}
if (nalu->src[i].sel == V_SQ_ALU_SRC_LITERAL)
r600_bytecode_special_constants(nalu->src[i].value,
&nalu->src[i].sel);
}
if (nalu->dst.write && nalu->dst.sel >= bc->ngpr && nalu->dst.sel < 124) {
if (nalu->dst.write && nalu->dst.sel >= bc->ngpr && nalu->dst.sel < 123) {
bc->ngpr = nalu->dst.sel + 1;
}
list_addtail(&nalu->list, &bc->cf_last->alu);

View file

@ -34,9 +34,10 @@
namespace r600 {
// We sacrifice 123 for dummy dests
static const int g_registers_end = 123;
static const int g_clause_local_start = 124;
static const int g_clause_local_end = 126;
static const int g_clause_local_end = 128;
/* ALU op2 instructions 17:7 top three bits always zero. */
enum EAluOp {

View file

@ -1217,7 +1217,7 @@ bool
AssamblerVisitor::copy_dst(r600_bytecode_alu_dst& dst, const Register& d, bool write)
{
if (write && d.sel() > g_clause_local_end) {
R600_ERR("shader_from_nir: Don't support more then 124 GPRs + 2 claus "
R600_ERR("shader_from_nir: Don't support more then 123 GPRs + 4 clause "
"local, but try using %d\n",
d.sel());
m_result = false;
@ -1306,7 +1306,7 @@ EncodeSourceVisitor::EncodeSourceVisitor(r600_bytecode_alu_src& s, r600_bytecode
void
EncodeSourceVisitor::visit(const Register& value)
{
assert(value.sel() < g_clause_local_end && "Only have 124 reisters + 4 clause local");
assert(value.sel() < g_clause_local_end && "Only have 123 reisters + 4 clause local");
}
void

View file

@ -114,7 +114,7 @@ group_allocation(LiveRangeMap& lrm,
if (group.priority > 0)
color = 0;
while (color < 124) {
while (color < g_registers_end) {
/* Find the coloring for the first channel */
bool color_in_use = false;
int comp = start_comp;
@ -181,7 +181,7 @@ group_allocation(LiveRangeMap& lrm,
break;
}
if (color == 124)
if (color == g_registers_end)
return false;
}
@ -206,7 +206,7 @@ scalar_allocation(LiveRangeMap& lrm, const Interference& interference)
int color = 0;
while (color < 124) {
while (color < g_registers_end) {
bool color_in_use = false;
for (auto adj : adjecency) {
if (live_ranges[adj].m_color == color) {
@ -223,7 +223,7 @@ scalar_allocation(LiveRangeMap& lrm, const Interference& interference)
r.m_color = color;
break;
}
if (color == 124)
if (color == g_registers_end)
return false;
}
}

View file

@ -329,7 +329,7 @@ private:
uint32_t m_nowrite_idx;
RegisterVec4 m_dummy_dest_pinned{
126, pin_chan, {0, 1, 2, 3}
g_registers_end, pin_chan, {0, 1, 2, 3}
};
ChannelCounts m_channel_counts;
uint32_t m_required_array_registers{0};