r600/sfn: Don't reuse registers for workgroup ID and local invocation ID

This fixes a number of compute shader tests. I'm not sure why though.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7142>
This commit is contained in:
Gert Wollny 2020-09-30 20:14:39 +02:00 committed by Marge Bot
parent bafb2bb551
commit ed66eafb6d
4 changed files with 13 additions and 7 deletions

View File

@ -359,10 +359,6 @@ register_live_range temp_access::get_required_live_range()
}
result.is_array_elm = is_array_element;
/* This fixes a few tests, but it is not clear why. */
if (result.end != result.begin)
++result.end;
return result;
}
@ -785,7 +781,10 @@ void LiverangeEvaluator::run(const Shader& shader,
sfn_log << SfnLog::merge << "Record INPUT write for "
<< g << " in " << temp_acc.size() << " temps\n";
temp_acc[g.sel()].record_write(line, cur_scope, 1 << g.chan(), false);
temp_acc[g.sel()].record_read(line, cur_scope, 1 << g.chan(), false);
if (g.keep_alive())
temp_acc[g.sel()].record_read(0x7fffff, cur_scope, 1 << g.chan(), false);
else
temp_acc[g.sel()].record_read(line, cur_scope, 1 << g.chan(), false);
}
}
}

View File

@ -51,11 +51,13 @@ bool ComputeShaderFromNir::do_allocate_reserved_registers()
for (int i = 0; i < 3; ++i) {
auto tmp = new GPRValue(thread_id_sel, i);
tmp->set_as_input();
tmp->set_keep_alive();
m_local_invocation_id[i] = PValue(tmp);
inject_register(tmp->sel(), i, m_local_invocation_id[i], false);
tmp = new GPRValue(wg_id_sel, i);
tmp->set_as_input();
tmp->set_keep_alive();
m_workgroup_id[i] = PValue(tmp);
inject_register(tmp->sel(), i, m_workgroup_id[i], false);
}

View File

@ -39,7 +39,8 @@ GPRValue::GPRValue(uint32_t sel, uint32_t chan, int base_offset):
m_sel(sel),
m_base_offset(base_offset),
m_input(false),
m_pin_to_channel(false)
m_pin_to_channel(false),
m_keep_alive(false)
{
}
@ -48,7 +49,8 @@ GPRValue::GPRValue(uint32_t sel, uint32_t chan):
m_sel(sel),
m_base_offset(0),
m_input(false),
m_pin_to_channel(false)
m_pin_to_channel(false),
m_keep_alive(false)
{
}

View File

@ -54,6 +54,8 @@ public:
void set_as_input(){ m_input = true; }
bool is_input() const {return m_input; }
void set_keep_alive() { m_keep_alive = true; }
bool keep_alive() const {return m_keep_alive; }
void set_pin_to_channel() override { m_pin_to_channel = true;}
bool pin_to_channel() const { return m_pin_to_channel;}
@ -65,6 +67,7 @@ private:
bool m_base_offset;
bool m_input;
bool m_pin_to_channel;
bool m_keep_alive;
};
class GPRVector : public Value {