summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2018-11-30 00:37:07 +0100
committerMarek Olšák <[email protected]>2019-07-03 15:51:12 -0400
commitc067aaa580d3be44503329968110e2629a9b2da6 (patch)
treef5363a943266a750abea6710145a3db114c77267 /src/amd
parent227c29a80dec4c3209d60a6e8bccf08864ec0e7f (diff)
amd/common/gfx10: pad shader buffers for instruction prefetch
Acked-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_rtld.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/amd/common/ac_rtld.c b/src/amd/common/ac_rtld.c
index ebf64d91658..55315913234 100644
--- a/src/amd/common/ac_rtld.c
+++ b/src/amd/common/ac_rtld.c
@@ -438,6 +438,25 @@ bool ac_rtld_open(struct ac_rtld_binary *binary,
binary->rx_size += rx_size;
+ if (i.info->chip_class >= GFX10) {
+ /* In gfx10, the SQ fetches up to 3 cache lines of 16 dwords
+ * ahead of the PC, configurable by SH_MEM_CONFIG and
+ * S_INST_PREFETCH. This can cause two issues:
+ *
+ * (1) Crossing a page boundary to an unmapped page. The logic
+ * does not distinguish between a required fetch and a "mere"
+ * prefetch and will fault.
+ *
+ * (2) Prefetching instructions that will be changed for a
+ * different shader.
+ *
+ * (2) is not currently an issue because we flush the I$ at IB
+ * boundaries, but (1) needs to be addressed. Due to buffer
+ * suballocation, we just play it safe.
+ */
+ binary->rx_size = align(binary->rx_size + 3 * 64, 64);
+ }
+
return true;
#undef report_if