summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Perry <[email protected]>2019-10-08 14:47:00 +0200
committerTimur Kristóf <[email protected]>2019-10-10 09:57:53 +0200
commitd63c175897e31e2a78eb346362a7c90a2fec5f13 (patch)
treea32db5d4f82beffd2e6c05e4f55cac57744be27e
parent83993f535eb90874ca2256ddbd35bce4e407c13a (diff)
aco: pad code with s_code_end on GFX10
Signed-off-by: Rhys Perry <[email protected]> Reviewed-By: Timur Kristóf <[email protected]> Reviewed-by: Daniel Schürmann <[email protected]>
-rw-r--r--src/amd/compiler/aco_assembler.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/amd/compiler/aco_assembler.cpp b/src/amd/compiler/aco_assembler.cpp
index 5a82d44d74b..76361241e4b 100644
--- a/src/amd/compiler/aco_assembler.cpp
+++ b/src/amd/compiler/aco_assembler.cpp
@@ -4,6 +4,7 @@
#include "aco_ir.h"
#include "common/sid.h"
#include "ac_shader_util.h"
+#include "util/u_math.h"
namespace aco {
@@ -668,16 +669,26 @@ unsigned emit_program(Program* program,
}
fix_branches(ctx, code);
+
+ unsigned exec_size = code.size() * sizeof(uint32_t);
+
+ if (program->chip_class >= GFX10) {
+ /* Pad output with s_code_end so instruction prefetching doesn't cause
+ * page faults */
+ unsigned final_size = align(code.size() + 3 * 16, 16);
+ while (code.size() < final_size)
+ code.push_back(0xbf9f0000u);
+ }
+
fix_constaddrs(ctx, code);
- unsigned constant_data_offset = code.size() * sizeof(uint32_t);
while (program->constant_data.size() % 4u)
program->constant_data.push_back(0);
/* Copy constant data */
code.insert(code.end(), (uint32_t*)program->constant_data.data(),
(uint32_t*)(program->constant_data.data() + program->constant_data.size()));
- return constant_data_offset;
+ return exec_size;
}
}