aco: use VOPC_SDWA on GFX9+
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 7 Jul 2021 09:37:49 +0000 (11:37 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 23 Aug 2021 10:31:40 +0000 (10:31 +0000)
Totals from 5138 (3.42% of 150170) affected shaders: (GFX10.3)
VGPRs: 409520 -> 409416 (-0.03%); split: -0.03%, +0.00%
CodeSize: 43056360 -> 43035696 (-0.05%); split: -0.06%, +0.02%
MaxWaves: 69296 -> 69310 (+0.02%)
Instrs: 8161016 -> 8153365 (-0.09%); split: -0.10%, +0.01%
Latency: 109397002 -> 109756208 (+0.33%); split: -0.05%, +0.38%
InvThroughput: 23238920 -> 23310761 (+0.31%); split: -0.11%, +0.42%
VClause: 135141 -> 135100 (-0.03%); split: -0.05%, +0.02%
SClause: 349511 -> 349489 (-0.01%); split: -0.01%, +0.00%
Copies: 388107 -> 387754 (-0.09%); split: -0.48%, +0.38%
Branches: 184629 -> 184503 (-0.07%); split: -0.08%, +0.01%
PreSGPRs: 258807 -> 258839 (+0.01%)
PreVGPRs: 372561 -> 372184 (-0.10%); split: -0.10%, +0.00%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12364>

src/amd/compiler/aco_ir.cpp

index b30ec36a073968f28abf35a59a0d3295cb0cd284..61cf3c2c43c38645e3192294f8e8a8bd297c99c0 100644 (file)
@@ -197,7 +197,7 @@ can_use_SDWA(chip_class chip, const aco_ptr<Instruction>& instr, bool pre_ra)
       VOP3_instruction& vop3 = instr->vop3();
       if (instr->format == Format::VOP3)
          return false;
-      if (vop3.clamp && instr->format == asVOP3(Format::VOPC) && chip != GFX8)
+      if (vop3.clamp && instr->isVOPC() && chip != GFX8)
          return false;
       if (vop3.omod && chip < GFX9)
          return false;
@@ -214,7 +214,7 @@ can_use_SDWA(chip_class chip, const aco_ptr<Instruction>& instr, bool pre_ra)
       }
    }
 
-   if (!instr->definitions.empty() && instr->definitions[0].bytes() > 4)
+   if (!instr->definitions.empty() && instr->definitions[0].bytes() > 4 && !instr->isVOPC())
       return false;
 
    if (!instr->operands.empty()) {
@@ -235,7 +235,7 @@ can_use_SDWA(chip_class chip, const aco_ptr<Instruction>& instr, bool pre_ra)
       return false;
 
    // TODO: return true if we know we will use vcc
-   if (!pre_ra && instr->isVOPC())
+   if (!pre_ra && instr->isVOPC() && chip == GFX8)
       return false;
    if (!pre_ra && instr->operands.size() >= 3 && !is_mac)
       return false;