Mesa (main): aco/optimizer: prevent any overflow between SGPR and const offset on MUBUF
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 29 16:15:34 UTC 2022
Module: Mesa
Branch: main
Commit: 12d7f911c968fada2bfb03c33a211d1d09fe7573
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=12d7f911c968fada2bfb03c33a211d1d09fe7573
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Fri Mar 25 12:03:27 2022 +0100
aco/optimizer: prevent any overflow between SGPR and const offset on MUBUF
Apparently, if the SGPR offset + const offset overflows,
it doesn't work.
Totals from 145 (0.11% of 134913) affected shaders: (GFX10.3)
SpillSGPRs: 134 -> 104 (-22.39%)
CodeSize: 1632676 -> 1645916 (+0.81%); split: -0.03%, +0.84%
Instrs: 316920 -> 320252 (+1.05%); split: -0.01%, +1.07%
Latency: 1456285 -> 1459686 (+0.23%); split: -0.02%, +0.25%
InvThroughput: 165785 -> 166086 (+0.18%); split: -0.02%, +0.20%
VClause: 6815 -> 6875 (+0.88%); split: -0.03%, +0.91%
SClause: 19089 -> 19079 (-0.05%); split: -0.06%, +0.01%
PreSGPRs: 7302 -> 7304 (+0.03%); split: -0.01%, +0.04%
Fixes: KHR-GL45.shader_storage_buffer_object.basic-operations-case1-cs
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15866>
---
src/amd/compiler/aco_optimizer.cpp | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index e2f540c94e3..cddc3f194b1 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -1345,7 +1345,6 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
* addressing works significantly, this probably applies to swizzled
* MUBUF accesses. */
bool vaddr_prevent_overflow = mubuf.swizzled && ctx.program->chip_class < GFX9;
- bool saddr_prevent_overflow = mubuf.swizzled;
if (mubuf.offen && i == 1 && info.is_constant_or_literal(32) &&
mubuf.offset + info.val < 4096) {
@@ -1366,9 +1365,7 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
instr->operands[1].setTemp(base);
mubuf.offset += offset;
continue;
- } else if (i == 2 &&
- parse_base_offset(ctx, instr.get(), i, &base, &offset,
- saddr_prevent_overflow) &&
+ } else if (i == 2 && parse_base_offset(ctx, instr.get(), i, &base, &offset, true) &&
base.regClass() == s1 && mubuf.offset + offset < 4096) {
instr->operands[i].setTemp(base);
mubuf.offset += offset;
More information about the mesa-commit
mailing list