[llvm] 7ba61ea - [AMDGPU] More precise limit on SALU cycles in s_delay_alu instructions
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 5 00:17:18 PST 2023
Author: Jay Foad
Date: 2023-03-05T08:14:15Z
New Revision: 7ba61eaf34c34f1bec6bfa920f3cfa5e5174eb71
URL: https://github.com/llvm/llvm-project/commit/7ba61eaf34c34f1bec6bfa920f3cfa5e5174eb71
DIFF: https://github.com/llvm/llvm-project/commit/7ba61eaf34c34f1bec6bfa920f3cfa5e5174eb71.diff
LOG: [AMDGPU] More precise limit on SALU cycles in s_delay_alu instructions
This just tweaks the fix for D145232 to make the limit more precise, so
that we could actually emit a delay of 3 SALU cycles (the maximum) if we
had any SALU instructions that required it.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
index 57d0fdacf7cf7..a3a13062a1e11 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
@@ -83,9 +83,9 @@ class AMDGPUInsertDelayAlu : public MachineFunctionPass {
// an s_delay_alu instruction.
static constexpr unsigned TRANS_MAX = 4;
- // The maximum number of SALU cycles we can encode in an s_delay_alu
- // instruction.
- static constexpr unsigned SALU_CYCLES_MAX = 3;
+ // One larger than the maximum number of SALU cycles we can encode in an
+ // s_delay_alu instruction.
+ static constexpr unsigned SALU_CYCLES_MAX = 4;
// If it was written by a (non-TRANS) VALU, remember how many clock cycles
// are left until it completes, and how many other (non-TRANS) VALU we have
@@ -284,6 +284,7 @@ class AMDGPUInsertDelayAlu : public MachineFunctionPass {
// Wait for an SALU instruction.
if (Delay.SALUCycles) {
+ assert(Delay.SALUCycles < DelayInfo::SALU_CYCLES_MAX);
if (Imm & 0x780) {
// We have already encoded a VALU and a TRANS delay. There's no room in
// the encoding for an SALU delay as well, so just drop it.
More information about the llvm-commits
mailing list