From f7e405bf7cbfd2f3ff8f75d91a82d2371f70d100 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 2 Jan 2020 19:13:53 +0000 Subject: [PATCH] aco: ensure predecessors' p_logical_end is in WQM when a p_phi is in WQM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want any copies to be in WQM. I don't know if this fixes any real application, but I can create a vkrunner test than reproduces the issue. Signed-off-by: Rhys Perry Fixes: 93c8ebfa780 ('aco: Initial commit of independent AMD compiler') Reviewed-by: Daniel Schürmann Part-of: (cherry picked from commit 2d7386a2d037497656aa9c601091fc4dd6d3ced2) --- .pick_status.json | 2 +- src/amd/compiler/aco_insert_exec_mask.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2fae71d010f..73cc770bde3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -94,7 +94,7 @@ "description": "aco: ensure predecessors' p_logical_end is in WQM when a p_phi is in WQM", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "93c8ebfa780ebd1495095e794731881aef29e7d3" }, diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp index 67c5f237cf3..2dd35843410 100644 --- a/src/amd/compiler/aco_insert_exec_mask.cpp +++ b/src/amd/compiler/aco_insert_exec_mask.cpp @@ -83,6 +83,7 @@ struct block_info { std::vector instr_needs; uint8_t block_needs; uint8_t ever_again_needs; + bool logical_end_wqm; /* more... */ }; @@ -231,8 +232,16 @@ void get_block_needs(wqm_ctx &ctx, exec_ctx &exec_ctx, Block* block) /* ensure the condition controlling the control flow for this phi is in WQM */ if (needs == WQM && instr->opcode == aco_opcode::p_phi) { - for (unsigned pred_idx : block->logical_preds) + for (unsigned pred_idx : block->logical_preds) { mark_block_wqm(ctx, pred_idx); + exec_ctx.info[pred_idx].logical_end_wqm = true; + ctx.worklist.insert(pred_idx); + } + } + + if (instr->opcode == aco_opcode::p_logical_end && info.logical_end_wqm) { + assert(needs == Unspecified); + needs = WQM; } instr_needs[i] = needs;