浏览代码

aco: check if SALU instructions are predeceeded by exec when calculating WQM needs

Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
master
Daniel Schürmann 5 年前
父节点
当前提交
8657eede8a
共有 3 个文件被更改,包括 13 次插入10 次删除
  1. 1
    8
      src/amd/compiler/aco_insert_NOPs.cpp
  2. 3
    2
      src/amd/compiler/aco_insert_exec_mask.cpp
  3. 9
    0
      src/amd/compiler/aco_ir.h

+ 1
- 8
src/amd/compiler/aco_insert_NOPs.cpp 查看文件

@@ -115,13 +115,6 @@ bool VALU_writes_sgpr(aco_ptr<Instruction>& instr)
return false;
}

bool instr_reads_exec(const aco_ptr<Instruction>& instr)
{
return std::any_of(instr->operands.begin(), instr->operands.end(), [](const Operand &op) -> bool {
return op.physReg() == exec_lo || op.physReg() == exec_hi;
});
}

bool instr_writes_exec(const aco_ptr<Instruction>& instr)
{
return std::any_of(instr->definitions.begin(), instr->definitions.end(), [](const Definition &def) -> bool {
@@ -445,7 +438,7 @@ void handle_instruction_gfx10(NOP_ctx_gfx10 &ctx, aco_ptr<Instruction>& instr,
/* VcmpxExecWARHazard
* Handle any VALU instruction writing the exec mask after it was read by a non-VALU instruction.
*/
if (!instr->isVALU() && instr_reads_exec(instr)) {
if (!instr->isVALU() && instr->reads_exec()) {
ctx.has_nonVALU_exec_read = true;
} else if (instr->isVALU()) {
if (instr_writes_exec(instr)) {

+ 3
- 2
src/amd/compiler/aco_insert_exec_mask.cpp 查看文件

@@ -95,6 +95,8 @@ struct exec_ctx {
};

bool pred_by_exec_mask(aco_ptr<Instruction>& instr) {
if (instr->isSALU())
return instr->reads_exec();
if (instr->format == Format::SMEM || instr->isSALU())
return false;
if (instr->format == Format::PSEUDO_BARRIER)
@@ -200,8 +202,7 @@ void get_block_needs(wqm_ctx &ctx, exec_ctx &exec_ctx, Block* block)
ctx.wqm = false;
}

for (int i = block->instructions.size() - 1; i >= 0; --i)
{
for (int i = block->instructions.size() - 1; i >= 0; --i) {
aco_ptr<Instruction>& instr = block->instructions[i];

WQMState needs = needs_exact(instr) ? Exact : Unspecified;

+ 9
- 0
src/amd/compiler/aco_ir.h 查看文件

@@ -616,6 +616,15 @@ struct Instruction {
}

constexpr bool usesModifiers() const noexcept;

constexpr bool reads_exec() const noexcept
{
for (const Operand& op : operands) {
if (op.isFixed() && op.physReg() == exec)
return true;
}
return false;
}
};

struct SOPK_instruction : public Instruction {

正在加载...
取消
保存