From 318b83899056d02ee83817cf16201a128fb81443 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 14 Aug 2023 17:47:24 +0200 Subject: [PATCH] r600/sfn: Simplify dependency chain for index loads on EG Address loads that just load the index register don't need to chain up like loads if the address register that are used for indirect register loads. With the latter it is important that the load and the address register use are in the same clause. For index register loads this is scheduled accordingly. Signed-off-by: Gert Wollny Part-of: --- .../drivers/r600/sfn/sfn_split_address_loads.cpp | 12 +++++++----- .../sfn/tests/sfn_split_address_loads_test.cpp | 16 ++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp b/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp index b8002eef252..95115e188fa 100644 --- a/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_split_address_loads.cpp @@ -156,8 +156,11 @@ void AddressSplitVisitor::visit(AluInstr *instr) if (addr) { assert(!index); - if (!m_current_addr || !m_current_addr->equal_to(*addr)) + if (!m_current_addr || !m_current_addr->equal_to(*addr)) { load_ar(instr, addr); + for (auto na: m_prev_non_alu) + m_last_ar_load->add_required_instr(na); + } // Do this with a visitor to catch also local array values CollectDeps collector; @@ -205,8 +208,10 @@ auto AddressSplitVisitor::load_index_register_eg(Instr *instr, m_last_idx_load[idx_id] = new AluInstr(idx_op[idx_id], idx, m_vf.addr(), {}); m_current_block->insert(m_block_iterator, m_last_idx_load[idx_id]); for (auto&& i : m_last_idx_use[idx_id]) - m_last_idx_load[idx_id]->add_required_instr(i); + m_last_ar_load->add_required_instr(i); + m_last_idx_use[idx_id].clear(); + m_last_idx_load[idx_id]->add_required_instr(m_last_ar_load); m_last_ar_load->inc_ar_uses(); m_last_ar_use.push_back(m_last_idx_load[idx_id]); @@ -271,9 +276,6 @@ void AddressSplitVisitor::load_ar(Instr *instr, PRegister addr) for (auto& i : m_last_ar_use) { m_last_ar_load->add_required_instr(i); } - for (auto na: m_prev_non_alu) { - m_last_ar_load->add_required_instr(na); - } m_last_ar_use.clear(); } diff --git a/src/gallium/drivers/r600/sfn/tests/sfn_split_address_loads_test.cpp b/src/gallium/drivers/r600/sfn/tests/sfn_split_address_loads_test.cpp index 269f8b2e0dd..ac5e4e87b12 100644 --- a/src/gallium/drivers/r600/sfn/tests/sfn_split_address_loads_test.cpp +++ b/src/gallium/drivers/r600/sfn/tests/sfn_split_address_loads_test.cpp @@ -504,21 +504,17 @@ OUTPUT LOC:0 NAME:1 MASK:15 SHADER BLOCK_START ALU_GROUP_BEGIN - ALU MOV S0.x@free : KC0[1].x {W} - ALU MOV S0.y@free : KC0[1].y {WL} -ALU_GROUP_END -BLOCK_END -BLOCK_START - TEX SAMPLE S3.xyzw : S0.xy__ RID:0 SID:0 NNNN -BLOCK_END -BLOCK_START -ALU_GROUP_BEGIN - ALU MOVA_INT AR : KC0[0].x {L} + ALU MOVA_INT AR : KC0[0].x {} + ALU MOV S0.y@free : KC0[1].y {W} + ALU MOV S0.z@free : KC0[1].x {WL} ALU_GROUP_END ALU_GROUP_BEGIN ALU SET_CF_IDX0 IDX0 : AR {L} ALU_GROUP_END BLOCK_END +BLOCK_START + TEX SAMPLE S3.xyzw : S0.zy__ RID:0 SID:0 NNNN +BLOCK_END BLOCK_START ALU_GROUP_BEGIN ALU ADD S4.x@chgr : KC1[IDX0][0].x S3.x {W}