Module: Mesa
Branch: master
Commit: d97c0bdd5558e4e00ede38afac879606aff5f04b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d97c0bdd5558e4e00ede38afac879606aff5f04b

Author: Daniel Schürmann <[email protected]>
Date:   Thu Oct 31 13:25:44 2019 +0100

aco: fix immediate offset for spills if scratch is used

Fixes: 86786999189c43b4a2c8e1c1a18b55cd2f369fff "aco: implement VGPR spilling"

Reviewed-by: Rhys Perry <[email protected]>

---

 src/amd/compiler/aco_spill.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp
index 1f3f5ea3b52..9f687da4b98 100644
--- a/src/amd/compiler/aco_spill.cpp
+++ b/src/amd/compiler/aco_spill.cpp
@@ -1530,12 +1530,12 @@ void assign_spill_slots(spill_ctx& ctx, unsigned 
spills_to_vgpr) {
                /* spill vgpr */
                ctx.program->config->spilled_vgprs += (*it)->operands[0].size();
                uint32_t spill_slot = vgpr_slot[spill_id];
-               bool add_offset = ctx.program->config->scratch_bytes_per_wave + 
vgpr_spill_slots * 4 > 4096;
-               unsigned base_offset = add_offset ? 0 : 
ctx.program->config->scratch_bytes_per_wave;
+               bool add_offset_to_sgpr = 
ctx.program->config->scratch_bytes_per_wave / ctx.program->wave_size + 
vgpr_spill_slots * 4 > 4096;
+               unsigned base_offset = add_offset_to_sgpr ? 0 : 
ctx.program->config->scratch_bytes_per_wave / ctx.program->wave_size;
 
                /* check if the scratch resource descriptor already exists */
                if (scratch_rsrc == Temp()) {
-                  unsigned offset = 
ctx.program->config->scratch_bytes_per_wave - base_offset;
+                  unsigned offset = add_offset_to_sgpr ? 
ctx.program->config->scratch_bytes_per_wave : 0;
                   scratch_rsrc = load_scratch_resource(ctx, scratch_offset,
                                                        
last_top_level_block_idx == block.index ?
                                                        instructions : 
ctx.program->blocks[last_top_level_block_idx].instructions,
@@ -1615,12 +1615,12 @@ void assign_spill_slots(spill_ctx& ctx, unsigned 
spills_to_vgpr) {
             if (vgpr_slot.find(spill_id) != vgpr_slot.end()) {
                /* reload vgpr */
                uint32_t spill_slot = vgpr_slot[spill_id];
-               bool add_offset = ctx.program->config->scratch_bytes_per_wave + 
vgpr_spill_slots * 4 > 4096;
-               unsigned base_offset = add_offset ? 0 : 
ctx.program->config->scratch_bytes_per_wave;
+               bool add_offset_to_sgpr = 
ctx.program->config->scratch_bytes_per_wave / ctx.program->wave_size + 
vgpr_spill_slots * 4 > 4096;
+               unsigned base_offset = add_offset_to_sgpr ? 0 : 
ctx.program->config->scratch_bytes_per_wave / ctx.program->wave_size;
 
                /* check if the scratch resource descriptor already exists */
                if (scratch_rsrc == Temp()) {
-                  unsigned offset = 
ctx.program->config->scratch_bytes_per_wave - base_offset;
+                  unsigned offset = add_offset_to_sgpr ? 
ctx.program->config->scratch_bytes_per_wave : 0;
                   scratch_rsrc = load_scratch_resource(ctx, scratch_offset,
                                                        
last_top_level_block_idx == block.index ?
                                                        instructions : 
ctx.program->blocks[last_top_level_block_idx].instructions,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to