r600/sfn: Shorten array elements live range

If an array is accessed indirectly, add a buffer live range of
one cycle before (for write) or after (for read), instead of pinning
the array from the start.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24036>
This commit is contained in:
Gert Wollny 2023-07-06 21:29:53 +02:00 committed by Marge Bot
parent 409486aa57
commit 8f3e298a58
4 changed files with 10 additions and 17 deletions

View file

@ -445,7 +445,7 @@ LiveRangeInstrVisitor::record_write(const Register *reg)
for (auto i = 0u; i < array.size(); ++i) {
auto& rav = m_register_access(array(i, reg->chan()));
rav.record_write(m_line, m_current_scope);
rav.record_write(m_line > 0 ? m_line - 1 : 0, m_current_scope);
}
} else {
auto& ra = m_register_access(*reg);
@ -476,7 +476,7 @@ LiveRangeInstrVisitor::record_read(const Register *reg, LiveRangeEntry::EUse use
for (auto i = 0u; i < array.size(); ++i) {
auto& rav = m_register_access(array(i, reg->chan()));
rav.record_read(m_line, m_current_scope, use);
rav.record_read(m_line + 1, m_current_scope, use);
}
} else {
sfn_log << SfnLog::merge << *reg << " read:" << m_line << "\n";

View file

@ -877,13 +877,6 @@ LocalArray::LocalArray(int base_sel, int nchannels, int size, int frac):
for (unsigned i = 0; i < m_size; ++i) {
PRegister reg = new Register(base_sel + i, c + frac, pin_array);
m_values[m_size * c + i] = new LocalArrayValue(reg, *this);
/* Pin the array register on the start, because currently we don't
* don't track the first write to an array element as write to all
* array elements, and it seems that the one can not just use
* registers that are not written to in an array for other purpouses
*/
m_values[m_size * c + i]->set_flag(Register::pin_start);
}
}
}

View file

@ -171,11 +171,11 @@ TEST_F(LiveRangeTests, SimpleArrayAccess)
LiveRangeMap expect = vf.prepare_live_range_map();
expect.set_life_range(*array->element(0, nullptr, 0), 0, 5);
expect.set_life_range(*array->element(0, nullptr, 1), 0, 5);
expect.set_life_range(*array->element(1, nullptr, 0), 0, 5);
expect.set_life_range(*array->element(0, nullptr, 0), 1, 5);
expect.set_life_range(*array->element(0, nullptr, 1), 1, 5);
expect.set_life_range(*array->element(1, nullptr, 0), 1, 4);
expect.set_life_range(*array->element(1, nullptr, 1), 0, 5);
expect.set_life_range(*array->element(1, nullptr, 1), 2, 4);
expect.set_life_range(*s1, 2, 3);

View file

@ -2152,12 +2152,12 @@ ALU_GROUP_BEGIN
ALU MOV A0[AR].y : L[2.0] {WL}
ALU_GROUP_END
ALU_GROUP_BEGIN
ALU MOV R2.x : A0[0].x {W}
ALU MOV R2.y : A0[0].y {WL}
ALU MOV R1.x : A0[0].x {W}
ALU MOV R1.y : A0[0].y {WL}
ALU_GROUP_END
ALU_GROUP_BEGIN
ALU MUL_IEEE R0.x : R2.x KC0[2].y {W}
ALU MUL_IEEE R0.y : R2.y KC0[2].y {WL}
ALU MUL_IEEE R0.x : R1.x KC0[2].y {W}
ALU MUL_IEEE R0.y : R1.y KC0[2].y {WL}
ALU_GROUP_END
BLOCK_END
BLOCK_START