Mesa (master): aco/gfx10: Update constant addresses in fix_branches_gfx10.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Oct 21 15:27:12 UTC 2019
Module: Mesa
Branch: master
Commit: 7e5f87b5330c919c141d887cd347c6363e1293e3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e5f87b5330c919c141d887cd347c6363e1293e3
Author: Timur Kristóf <timur.kristof at gmail.com>
Date: Wed Oct 16 15:05:56 2019 +0200
aco/gfx10: Update constant addresses in fix_branches_gfx10.
Due to a bug in GFX10 hardware, s_nop instructions must be added
if a branch is at 0x3f. We already do this, but forgot to also update
the constant addresses that come after this instruction.
Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
---
src/amd/compiler/aco_assembler.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/amd/compiler/aco_assembler.cpp b/src/amd/compiler/aco_assembler.cpp
index 648031651a8..ea7295816db 100644
--- a/src/amd/compiler/aco_assembler.cpp
+++ b/src/amd/compiler/aco_assembler.cpp
@@ -624,7 +624,8 @@ static void fix_branches_gfx10(asm_context& ctx, std::vector<uint32_t>& out)
if (gfx10_3f_bug) {
/* Insert an s_nop after the branch */
constexpr uint32_t s_nop_0 = 0xbf800000u;
- auto out_pos = std::next(out.begin(), buggy_branch_it->first + 1);
+ int s_nop_pos = buggy_branch_it->first + 1;
+ auto out_pos = std::next(out.begin(), s_nop_pos);
out.insert(out_pos, s_nop_0);
/* Update the offset of each affected block */
@@ -636,6 +637,16 @@ static void fix_branches_gfx10(asm_context& ctx, std::vector<uint32_t>& out)
/* Update the branches following the current one */
for (auto branch_it = std::next(buggy_branch_it); branch_it != ctx.branches.end(); ++branch_it)
branch_it->first++;
+
+ /* Find first constant address after the inserted instruction */
+ auto caddr_it = std::find_if(ctx.constaddrs.begin(), ctx.constaddrs.end(), [s_nop_pos](const int &caddr_pos) -> bool {
+ return caddr_pos >= s_nop_pos;
+ });
+
+ /* Update the locations of constant addresses */
+ for (; caddr_it != ctx.constaddrs.end(); ++caddr_it)
+ (*caddr_it)++;
+
}
} while (gfx10_3f_bug);
}
More information about the mesa-commit
mailing list