[llvm] [AMDGPU][NFC] Move InstCounterType and Waitcnt to SIInsertWaitcnts.h (PR #187823)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 10:47:40 PDT 2026
https://github.com/vporpo updated https://github.com/llvm/llvm-project/pull/187823
>From 3f104c33bbd145d2ceb19cc7aa7d2d35c2dc1820 Mon Sep 17 00:00:00 2001
From: Vasileios Porpodas <vasileios.porpodas at amd.com>
Date: Fri, 20 Mar 2026 21:59:34 +0000
Subject: [PATCH 1/3] [AMDGPU] Move InstrCounterType and Waitcnt to new file
AMDGPUWaitcnt.h
Follow-up on the layering issue brought up by #187559.
To summarize, Utils/AMDGPUBaseInfo.h defines InstrCounterType but it's printer
relies on GCNSubTarget, which can't be included because it would violate
layering between `lib/Target/AMDGPU` and `lib/Target/AMDGPU/Utils`.
To fix this, this patch moves InstCounterType and its dependent Waitcnt
class to a new file AMDGPUWaitcnt.h. We also need to move a few
encoding and decoding functions that work on Waitcnt from AMDGPUBaseInfo
to AMDGPUWaitcnt.h/.cpp. Some of these relied on static functions
defined in AMDGPUInfo.cpp, like `unpackBits()`, so this patch introduced
new functions in AMDGPUBaseInfo: `decodeLoadcnt()`, `decodeStorecnt()` and
`decodeDscnt()`.
---
llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp | 91 +++++++++
llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h | 172 ++++++++++++++++++
llvm/lib/Target/AMDGPU/CMakeLists.txt | 1 +
.../lib/Target/AMDGPU/GCNHazardRecognizer.cpp | 1 +
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 1 +
.../Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 102 ++---------
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h | 163 ++---------------
7 files changed, 303 insertions(+), 228 deletions(-)
create mode 100644 llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp
create mode 100644 llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp b/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp
new file mode 100644
index 0000000000000..f328e1fd49fa1
--- /dev/null
+++ b/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp
@@ -0,0 +1,91 @@
+//===- AMDGPUWaitcnt.cpp --------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "AMDGPUWaitcnt.h"
+#include "Utils/AMDGPUBaseInfo.h"
+
+namespace llvm {
+
+namespace AMDGPU {
+
+iota_range<InstCounterType> inst_counter_types(InstCounterType MaxCounter) {
+ return enum_seq(LOAD_CNT, MaxCounter);
+}
+
+StringLiteral getInstCounterName(InstCounterType T) {
+ switch (T) {
+ case LOAD_CNT:
+ return "LOAD_CNT";
+ case DS_CNT:
+ return "DS_CNT";
+ case EXP_CNT:
+ return "EXP_CNT";
+ case STORE_CNT:
+ return "STORE_CNT";
+ case SAMPLE_CNT:
+ return "SAMPLE_CNT";
+ case BVH_CNT:
+ return "BVH_CNT";
+ case KM_CNT:
+ return "KM_CNT";
+ case X_CNT:
+ return "X_CNT";
+ case VA_VDST:
+ return "VA_VDST";
+ case VM_VSRC:
+ return "VM_VSRC";
+ default:
+ return "Unknown T";
+ }
+}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+void Waitcnt::dump() const { dbgs() << *this << "\n"; }
+#endif
+
+Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded) {
+ Waitcnt Decoded;
+ Decoded.set(LOAD_CNT, decodeVmcnt(Version, Encoded));
+ Decoded.set(EXP_CNT, decodeExpcnt(Version, Encoded));
+ Decoded.set(DS_CNT, decodeLgkmcnt(Version, Encoded));
+ return Decoded;
+}
+
+unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded) {
+ return encodeWaitcnt(Version, Decoded.get(LOAD_CNT), Decoded.get(EXP_CNT),
+ Decoded.get(DS_CNT));
+}
+
+Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt) {
+ Waitcnt Decoded;
+ Decoded.set(LOAD_CNT, decodeLoadcnt(Version, LoadcntDscnt));
+ Decoded.set(DS_CNT, decodeDscnt(Version, LoadcntDscnt));
+ return Decoded;
+}
+
+Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt) {
+ Waitcnt Decoded;
+ Decoded.set(STORE_CNT, decodeStorecnt(Version, StorecntDscnt));
+ Decoded.set(DS_CNT, decodeDscnt(Version, StorecntDscnt));
+ return Decoded;
+}
+
+unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded) {
+ return encodeLoadcntDscnt(Version, Decoded.get(LOAD_CNT),
+ Decoded.get(DS_CNT));
+}
+
+unsigned encodeStorecntDscnt(const IsaVersion &Version,
+ const Waitcnt &Decoded) {
+ return encodeStorecntDscnt(Version, Decoded.get(STORE_CNT),
+ Decoded.get(DS_CNT));
+}
+
+} // namespace AMDGPU
+
+} // namespace llvm
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h b/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h
new file mode 100644
index 0000000000000..38530a8a2f3f6
--- /dev/null
+++ b/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h
@@ -0,0 +1,172 @@
+//===- AMDGPUWaitcnt.h - Wait Counters used in SIInsertWaitcnts -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNT_H
+#define LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNT_H
+
+#include "llvm/ADT/Sequence.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/TargetParser/TargetParser.h"
+
+namespace llvm {
+
+namespace AMDGPU {
+
+enum InstCounterType {
+ LOAD_CNT = 0, // VMcnt prior to gfx12.
+ DS_CNT, // LKGMcnt prior to gfx12.
+ EXP_CNT, //
+ STORE_CNT, // VScnt in gfx10/gfx11.
+ NUM_NORMAL_INST_CNTS,
+ SAMPLE_CNT = NUM_NORMAL_INST_CNTS, // gfx12+ only.
+ BVH_CNT, // gfx12+ only.
+ KM_CNT, // gfx12+ only.
+ X_CNT, // gfx1250.
+ ASYNC_CNT, // gfx1250.
+ NUM_EXTENDED_INST_CNTS,
+ VA_VDST = NUM_EXTENDED_INST_CNTS, // gfx12+ expert mode only.
+ VM_VSRC, // gfx12+ expert mode only.
+ NUM_EXPERT_INST_CNTS,
+ NUM_INST_CNTS = NUM_EXPERT_INST_CNTS
+};
+
+StringLiteral getInstCounterName(InstCounterType T);
+
+// Return an iterator over all counters between LOAD_CNT (the first counter)
+// and \c MaxCounter (exclusive, default value yields an enumeration over
+// all counters).
+iota_range<InstCounterType>
+inst_counter_types(InstCounterType MaxCounter = NUM_INST_CNTS);
+
+} // namespace AMDGPU
+
+template <> struct enum_iteration_traits<AMDGPU::InstCounterType> {
+ static constexpr bool is_iterable = true;
+};
+
+namespace AMDGPU {
+
+/// Represents the counter values to wait for in an s_waitcnt instruction.
+///
+/// Large values (including the maximum possible integer) can be used to
+/// represent "don't care" waits.
+class Waitcnt {
+ std::array<unsigned, NUM_INST_CNTS> Cnt;
+
+public:
+ unsigned get(InstCounterType T) const { return Cnt[T]; }
+ void set(InstCounterType T, unsigned Val) { Cnt[T] = Val; }
+
+ Waitcnt() { fill(Cnt, ~0u); }
+ // Pre-gfx12 constructor.
+ Waitcnt(unsigned VmCnt, unsigned ExpCnt, unsigned LgkmCnt, unsigned VsCnt)
+ : Waitcnt() {
+ Cnt[LOAD_CNT] = VmCnt;
+ Cnt[EXP_CNT] = ExpCnt;
+ Cnt[DS_CNT] = LgkmCnt;
+ Cnt[STORE_CNT] = VsCnt;
+ }
+
+ // gfx12+ constructor.
+ Waitcnt(unsigned LoadCnt, unsigned ExpCnt, unsigned DsCnt, unsigned StoreCnt,
+ unsigned SampleCnt, unsigned BvhCnt, unsigned KmCnt, unsigned XCnt,
+ unsigned AsyncCnt, unsigned VaVdst, unsigned VmVsrc)
+ : Waitcnt() {
+ Cnt[LOAD_CNT] = LoadCnt;
+ Cnt[DS_CNT] = DsCnt;
+ Cnt[EXP_CNT] = ExpCnt;
+ Cnt[STORE_CNT] = StoreCnt;
+ Cnt[SAMPLE_CNT] = SampleCnt;
+ Cnt[BVH_CNT] = BvhCnt;
+ Cnt[KM_CNT] = KmCnt;
+ Cnt[X_CNT] = XCnt;
+ Cnt[ASYNC_CNT] = AsyncCnt;
+ Cnt[VA_VDST] = VaVdst;
+ Cnt[VM_VSRC] = VmVsrc;
+ }
+
+ bool hasWait() const {
+ return any_of(Cnt, [](unsigned Val) { return Val != ~0u; });
+ }
+
+ bool hasWaitExceptStoreCnt() const {
+ for (InstCounterType T : inst_counter_types()) {
+ if (T == STORE_CNT)
+ continue;
+ if (Cnt[T] != ~0u)
+ return true;
+ }
+ return false;
+ }
+
+ bool hasWaitStoreCnt() const { return Cnt[STORE_CNT] != ~0u; }
+
+ bool hasWaitDepctr() const {
+ return Cnt[VA_VDST] != ~0u || Cnt[VM_VSRC] != ~0u;
+ }
+
+ Waitcnt combined(const Waitcnt &Other) const {
+ // Does the right thing provided self and Other are either both pre-gfx12
+ // or both gfx12+.
+ Waitcnt Wait;
+ for (InstCounterType T : inst_counter_types())
+ Wait.Cnt[T] = std::min(Cnt[T], Other.Cnt[T]);
+ return Wait;
+ }
+
+ void print(raw_ostream &OS) const {
+ ListSeparator LS;
+ for (InstCounterType T : inst_counter_types())
+ OS << LS << getInstCounterName(T) << ": " << Cnt[T];
+ if (LS.unused())
+ OS << "none";
+ OS << '\n';
+ }
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+ LLVM_DUMP_METHOD void dump() const;
+#endif
+
+ friend raw_ostream &operator<<(raw_ostream &OS, const AMDGPU::Waitcnt &Wait) {
+ Wait.print(OS);
+ return OS;
+ }
+};
+
+Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded);
+
+unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded);
+
+// The following are only meaningful on targets that support
+// S_WAIT_LOADCNT_DSCNT and S_WAIT_STORECNT_DSCNT.
+
+/// \returns Decoded Waitcnt structure from given \p LoadcntDscnt for given
+/// isa \p Version.
+Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt);
+
+/// \returns Decoded Waitcnt structure from given \p StorecntDscnt for given
+/// isa \p Version.
+Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt);
+
+/// \returns \p Loadcnt and \p Dscnt components of \p Decoded encoded as an
+/// immediate that can be used with S_WAIT_LOADCNT_DSCNT for given isa
+/// \p Version.
+unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded);
+
+/// \returns \p Storecnt and \p Dscnt components of \p Decoded encoded as an
+/// immediate that can be used with S_WAIT_STORECNT_DSCNT for given isa
+/// \p Version.
+unsigned encodeStorecntDscnt(const IsaVersion &Version, const Waitcnt &Decoded);
+
+} // namespace AMDGPU
+
+} // namespace llvm
+
+#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNT_H
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index cda288e012925..dd60d7520e7f1 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -119,6 +119,7 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUTargetMachine.cpp
AMDGPUTargetObjectFile.cpp
AMDGPUTargetTransformInfo.cpp
+ AMDGPUWaitcnt.cpp
AMDGPUWaitSGPRHazards.cpp
AMDGPUUnifyDivergentExitNodes.cpp
R600MachineCFGStructurizer.cpp
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
index 4c23ec4d4aca2..da5184f37ce75 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "GCNHazardRecognizer.h"
+#include "AMDGPUWaitcnt.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 4524628554fc4..7739d788b253f 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -24,6 +24,7 @@
//===----------------------------------------------------------------------===//
#include "AMDGPU.h"
+#include "AMDGPUWaitcnt.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
index 749cead8a20fb..f36fcbc1842c6 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
@@ -199,41 +199,6 @@ namespace llvm {
namespace AMDGPU {
-iota_range<InstCounterType> inst_counter_types(InstCounterType MaxCounter) {
- return enum_seq(LOAD_CNT, MaxCounter);
-}
-
-StringLiteral getInstCounterName(InstCounterType T) {
- switch (T) {
- case LOAD_CNT:
- return "LOAD_CNT";
- case DS_CNT:
- return "DS_CNT";
- case EXP_CNT:
- return "EXP_CNT";
- case STORE_CNT:
- return "STORE_CNT";
- case SAMPLE_CNT:
- return "SAMPLE_CNT";
- case BVH_CNT:
- return "BVH_CNT";
- case KM_CNT:
- return "KM_CNT";
- case X_CNT:
- return "X_CNT";
- case VA_VDST:
- return "VA_VDST";
- case VM_VSRC:
- return "VM_VSRC";
- default:
- return "Unknown T";
- }
-}
-
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-void Waitcnt::dump() const { dbgs() << *this << "\n"; }
-#endif
-
/// \returns true if the target supports signed immediate offset for SMRD
/// instructions.
bool hasSMRDSignedImmOffset(const MCSubtargetInfo &ST) {
@@ -1887,6 +1852,21 @@ unsigned decodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt) {
getLgkmcntBitWidth(Version.Major));
}
+unsigned decodeLoadcnt(const IsaVersion &Version, unsigned Waitcnt) {
+ return unpackBits(Waitcnt, getLoadcntStorecntBitShift(Version.Major),
+ getLoadcntBitWidth(Version.Major));
+}
+
+unsigned decodeStorecnt(const IsaVersion &Version, unsigned Waitcnt) {
+ return unpackBits(Waitcnt, getLoadcntStorecntBitShift(Version.Major),
+ getStorecntBitWidth(Version.Major));
+}
+
+unsigned decodeDscnt(const IsaVersion &Version, unsigned Waitcnt) {
+ return unpackBits(Waitcnt, getDscntBitShift(Version.Major),
+ getDscntBitWidth(Version.Major));
+}
+
void decodeWaitcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned &Vmcnt,
unsigned &Expcnt, unsigned &Lgkmcnt) {
Vmcnt = decodeVmcnt(Version, Waitcnt);
@@ -1894,14 +1874,6 @@ void decodeWaitcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned &Vmcnt,
Lgkmcnt = decodeLgkmcnt(Version, Waitcnt);
}
-Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded) {
- Waitcnt Decoded;
- Decoded.set(LOAD_CNT, decodeVmcnt(Version, Encoded));
- Decoded.set(EXP_CNT, decodeExpcnt(Version, Encoded));
- Decoded.set(DS_CNT, decodeLgkmcnt(Version, Encoded));
- return Decoded;
-}
-
unsigned encodeVmcnt(const IsaVersion &Version, unsigned Waitcnt,
unsigned Vmcnt) {
Waitcnt = packBits(Vmcnt, Waitcnt, getVmcntBitShiftLo(Version.Major),
@@ -1932,11 +1904,6 @@ unsigned encodeWaitcnt(const IsaVersion &Version, unsigned Vmcnt,
return Waitcnt;
}
-unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded) {
- return encodeWaitcnt(Version, Decoded.get(LOAD_CNT), Decoded.get(EXP_CNT),
- Decoded.get(DS_CNT));
-}
-
static unsigned getCombinedCountBitMask(const IsaVersion &Version,
bool IsStore) {
unsigned Dscnt = getBitMask(getDscntBitShift(Version.Major),
@@ -1951,26 +1918,6 @@ static unsigned getCombinedCountBitMask(const IsaVersion &Version,
return Dscnt | Loadcnt;
}
-Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt) {
- Waitcnt Decoded;
- Decoded.set(LOAD_CNT, unpackBits(LoadcntDscnt,
- getLoadcntStorecntBitShift(Version.Major),
- getLoadcntBitWidth(Version.Major)));
- Decoded.set(DS_CNT, unpackBits(LoadcntDscnt, getDscntBitShift(Version.Major),
- getDscntBitWidth(Version.Major)));
- return Decoded;
-}
-
-Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt) {
- Waitcnt Decoded;
- Decoded.set(STORE_CNT, unpackBits(StorecntDscnt,
- getLoadcntStorecntBitShift(Version.Major),
- getStorecntBitWidth(Version.Major)));
- Decoded.set(DS_CNT, unpackBits(StorecntDscnt, getDscntBitShift(Version.Major),
- getDscntBitWidth(Version.Major)));
- return Decoded;
-}
-
static unsigned encodeLoadcnt(const IsaVersion &Version, unsigned Waitcnt,
unsigned Loadcnt) {
return packBits(Loadcnt, Waitcnt, getLoadcntStorecntBitShift(Version.Major),
@@ -1989,33 +1936,22 @@ static unsigned encodeDscnt(const IsaVersion &Version, unsigned Waitcnt,
getDscntBitWidth(Version.Major));
}
-static unsigned encodeLoadcntDscnt(const IsaVersion &Version, unsigned Loadcnt,
- unsigned Dscnt) {
+unsigned encodeLoadcntDscnt(const IsaVersion &Version, unsigned Loadcnt,
+ unsigned Dscnt) {
unsigned Waitcnt = getCombinedCountBitMask(Version, false);
Waitcnt = encodeLoadcnt(Version, Waitcnt, Loadcnt);
Waitcnt = encodeDscnt(Version, Waitcnt, Dscnt);
return Waitcnt;
}
-unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded) {
- return encodeLoadcntDscnt(Version, Decoded.get(LOAD_CNT),
- Decoded.get(DS_CNT));
-}
-
-static unsigned encodeStorecntDscnt(const IsaVersion &Version,
- unsigned Storecnt, unsigned Dscnt) {
+unsigned encodeStorecntDscnt(const IsaVersion &Version, unsigned Storecnt,
+ unsigned Dscnt) {
unsigned Waitcnt = getCombinedCountBitMask(Version, true);
Waitcnt = encodeStorecnt(Version, Waitcnt, Storecnt);
Waitcnt = encodeDscnt(Version, Waitcnt, Dscnt);
return Waitcnt;
}
-unsigned encodeStorecntDscnt(const IsaVersion &Version,
- const Waitcnt &Decoded) {
- return encodeStorecntDscnt(Version, Decoded.get(STORE_CNT),
- Decoded.get(DS_CNT));
-}
-
//===----------------------------------------------------------------------===//
// Custom Operand Values
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
index 9fa0a07ed7558..2220ce390bb45 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
@@ -1091,127 +1091,6 @@ getIntegerVecAttribute(const Function &F, StringRef Name, unsigned Size);
/// Checks if \p Val is inside \p MD, a !range-like metadata.
bool hasValueInRangeLikeMetadata(const MDNode &MD, int64_t Val);
-enum InstCounterType {
- LOAD_CNT = 0, // VMcnt prior to gfx12.
- DS_CNT, // LKGMcnt prior to gfx12.
- EXP_CNT, //
- STORE_CNT, // VScnt in gfx10/gfx11.
- NUM_NORMAL_INST_CNTS,
- SAMPLE_CNT = NUM_NORMAL_INST_CNTS, // gfx12+ only.
- BVH_CNT, // gfx12+ only.
- KM_CNT, // gfx12+ only.
- X_CNT, // gfx1250.
- ASYNC_CNT, // gfx1250.
- NUM_EXTENDED_INST_CNTS,
- VA_VDST = NUM_EXTENDED_INST_CNTS, // gfx12+ expert mode only.
- VM_VSRC, // gfx12+ expert mode only.
- NUM_EXPERT_INST_CNTS,
- NUM_INST_CNTS = NUM_EXPERT_INST_CNTS
-};
-
-StringLiteral getInstCounterName(InstCounterType T);
-
-// Return an iterator over all counters between LOAD_CNT (the first counter)
-// and \c MaxCounter (exclusive, default value yields an enumeration over
-// all counters).
-iota_range<InstCounterType>
-inst_counter_types(InstCounterType MaxCounter = NUM_INST_CNTS);
-
-} // namespace AMDGPU
-
-template <> struct enum_iteration_traits<AMDGPU::InstCounterType> {
- static constexpr bool is_iterable = true;
-};
-
-namespace AMDGPU {
-
-/// Represents the counter values to wait for in an s_waitcnt instruction.
-///
-/// Large values (including the maximum possible integer) can be used to
-/// represent "don't care" waits.
-class Waitcnt {
- std::array<unsigned, NUM_INST_CNTS> Cnt;
-
-public:
- unsigned get(InstCounterType T) const { return Cnt[T]; }
- void set(InstCounterType T, unsigned Val) { Cnt[T] = Val; }
-
- Waitcnt() { fill(Cnt, ~0u); }
- // Pre-gfx12 constructor.
- Waitcnt(unsigned VmCnt, unsigned ExpCnt, unsigned LgkmCnt, unsigned VsCnt)
- : Waitcnt() {
- Cnt[LOAD_CNT] = VmCnt;
- Cnt[EXP_CNT] = ExpCnt;
- Cnt[DS_CNT] = LgkmCnt;
- Cnt[STORE_CNT] = VsCnt;
- }
-
- // gfx12+ constructor.
- Waitcnt(unsigned LoadCnt, unsigned ExpCnt, unsigned DsCnt, unsigned StoreCnt,
- unsigned SampleCnt, unsigned BvhCnt, unsigned KmCnt, unsigned XCnt,
- unsigned AsyncCnt, unsigned VaVdst, unsigned VmVsrc)
- : Waitcnt() {
- Cnt[LOAD_CNT] = LoadCnt;
- Cnt[DS_CNT] = DsCnt;
- Cnt[EXP_CNT] = ExpCnt;
- Cnt[STORE_CNT] = StoreCnt;
- Cnt[SAMPLE_CNT] = SampleCnt;
- Cnt[BVH_CNT] = BvhCnt;
- Cnt[KM_CNT] = KmCnt;
- Cnt[X_CNT] = XCnt;
- Cnt[ASYNC_CNT] = AsyncCnt;
- Cnt[VA_VDST] = VaVdst;
- Cnt[VM_VSRC] = VmVsrc;
- }
-
- bool hasWait() const {
- return any_of(Cnt, [](unsigned Val) { return Val != ~0u; });
- }
-
- bool hasWaitExceptStoreCnt() const {
- for (InstCounterType T : inst_counter_types()) {
- if (T == STORE_CNT)
- continue;
- if (Cnt[T] != ~0u)
- return true;
- }
- return false;
- }
-
- bool hasWaitStoreCnt() const { return Cnt[STORE_CNT] != ~0u; }
-
- bool hasWaitDepctr() const {
- return Cnt[VA_VDST] != ~0u || Cnt[VM_VSRC] != ~0u;
- }
-
- Waitcnt combined(const Waitcnt &Other) const {
- // Does the right thing provided self and Other are either both pre-gfx12
- // or both gfx12+.
- Waitcnt Wait;
- for (InstCounterType T : inst_counter_types())
- Wait.Cnt[T] = std::min(Cnt[T], Other.Cnt[T]);
- return Wait;
- }
-
- void print(raw_ostream &OS) const {
- ListSeparator LS;
- for (InstCounterType T : inst_counter_types())
- OS << LS << getInstCounterName(T) << ": " << Cnt[T];
- if (LS.unused())
- OS << "none";
- OS << '\n';
- }
-
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- LLVM_DUMP_METHOD void dump() const;
-#endif
-
- friend raw_ostream &operator<<(raw_ostream &OS, const AMDGPU::Waitcnt &Wait) {
- Wait.print(OS);
- return OS;
- }
-};
-
/// Represents the hardware counter limits for different wait count types.
struct HardwareLimits {
unsigned LoadcntMax; // Corresponds to Vmcnt prior to gfx12.
@@ -1256,6 +1135,15 @@ unsigned decodeExpcnt(const IsaVersion &Version, unsigned Waitcnt);
/// \returns Decoded Lgkmcnt from given \p Waitcnt for given isa \p Version.
unsigned decodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt);
+/// \returns Decoded Loadcnt from given \p Waitcnt for given isa \p Version.
+unsigned decodeLoadcnt(const IsaVersion &Version, unsigned Waitcnt);
+
+/// \returns Decoded Storecnt from given \p Waitcnt for given isa \p Version.
+unsigned decodeStorecnt(const IsaVersion &Version, unsigned Waitcnt);
+
+/// \returns Decoded Dscnt from given \p Waitcnt for given isa \p Version.
+unsigned decodeDscnt(const IsaVersion &Version, unsigned Waitcnt);
+
/// Decodes Vmcnt, Expcnt and Lgkmcnt from given \p Waitcnt for given isa
/// \p Version, and writes decoded values into \p Vmcnt, \p Expcnt and
/// \p Lgkmcnt respectively. Should not be used on gfx12+, the instruction
@@ -1274,8 +1162,6 @@ unsigned decodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt);
void decodeWaitcnt(const IsaVersion &Version, unsigned Waitcnt, unsigned &Vmcnt,
unsigned &Expcnt, unsigned &Lgkmcnt);
-Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded);
-
/// \returns \p Waitcnt with encoded \p Vmcnt for given isa \p Version.
unsigned encodeVmcnt(const IsaVersion &Version, unsigned Waitcnt,
unsigned Vmcnt);
@@ -1309,7 +1195,15 @@ unsigned encodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt,
unsigned encodeWaitcnt(const IsaVersion &Version, unsigned Vmcnt,
unsigned Expcnt, unsigned Lgkmcnt);
-unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded);
+/// \returns Waitcnt with encoded \p Loadcnt and \p Dscnt for given isa \p
+/// Version.
+unsigned encodeLoadcntDscnt(const IsaVersion &Version, unsigned Loadcnt,
+ unsigned Dscnt);
+
+/// \returns Waitcnt with encoded \p Storecnt and \p Dscnt for given isa \p
+/// Version.
+unsigned encodeStorecntDscnt(const IsaVersion &Version, unsigned Storecnt,
+ unsigned Dscnt);
// The following methods are only meaningful on targets that support
// S_WAIT_*CNT, introduced with gfx12.
@@ -1348,27 +1242,6 @@ unsigned getXcntBitMask(const IsaVersion &Version);
/// depends on the ISA version.
unsigned getStorecntBitMask(const IsaVersion &Version);
-// The following are only meaningful on targets that support
-// S_WAIT_LOADCNT_DSCNT and S_WAIT_STORECNT_DSCNT.
-
-/// \returns Decoded Waitcnt structure from given \p LoadcntDscnt for given
-/// isa \p Version.
-Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt);
-
-/// \returns Decoded Waitcnt structure from given \p StorecntDscnt for given
-/// isa \p Version.
-Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt);
-
-/// \returns \p Loadcnt and \p Dscnt components of \p Decoded encoded as an
-/// immediate that can be used with S_WAIT_LOADCNT_DSCNT for given isa
-/// \p Version.
-unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded);
-
-/// \returns \p Storecnt and \p Dscnt components of \p Decoded encoded as an
-/// immediate that can be used with S_WAIT_STORECNT_DSCNT for given isa
-/// \p Version.
-unsigned encodeStorecntDscnt(const IsaVersion &Version, const Waitcnt &Decoded);
-
namespace Hwreg {
using HwregId = EncodingField<5, 0>;
>From 934dda72b3acdf42679857bab1760c5cd156b494 Mon Sep 17 00:00:00 2001
From: Vasileios Porpodas <vasileios.porpodas at amd.com>
Date: Wed, 25 Mar 2026 21:19:01 +0000
Subject: [PATCH 2/3] fixup! [AMDGPU] Move InstrCounterType and Waitcnt to new
file AMDGPUWaitcnt.h
---
llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp | 91 -------------------
llvm/lib/Target/AMDGPU/CMakeLists.txt | 1 -
.../lib/Target/AMDGPU/GCNHazardRecognizer.cpp | 2 +-
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 83 ++++++++++++++++-
.../{AMDGPUWaitcnt.h => SIInsertWaitcnts.h} | 9 +-
5 files changed, 88 insertions(+), 98 deletions(-)
delete mode 100644 llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp
rename llvm/lib/Target/AMDGPU/{AMDGPUWaitcnt.h => SIInsertWaitcnts.h} (96%)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp b/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp
deleted file mode 100644
index f328e1fd49fa1..0000000000000
--- a/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//===- AMDGPUWaitcnt.cpp --------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "AMDGPUWaitcnt.h"
-#include "Utils/AMDGPUBaseInfo.h"
-
-namespace llvm {
-
-namespace AMDGPU {
-
-iota_range<InstCounterType> inst_counter_types(InstCounterType MaxCounter) {
- return enum_seq(LOAD_CNT, MaxCounter);
-}
-
-StringLiteral getInstCounterName(InstCounterType T) {
- switch (T) {
- case LOAD_CNT:
- return "LOAD_CNT";
- case DS_CNT:
- return "DS_CNT";
- case EXP_CNT:
- return "EXP_CNT";
- case STORE_CNT:
- return "STORE_CNT";
- case SAMPLE_CNT:
- return "SAMPLE_CNT";
- case BVH_CNT:
- return "BVH_CNT";
- case KM_CNT:
- return "KM_CNT";
- case X_CNT:
- return "X_CNT";
- case VA_VDST:
- return "VA_VDST";
- case VM_VSRC:
- return "VM_VSRC";
- default:
- return "Unknown T";
- }
-}
-
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-void Waitcnt::dump() const { dbgs() << *this << "\n"; }
-#endif
-
-Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded) {
- Waitcnt Decoded;
- Decoded.set(LOAD_CNT, decodeVmcnt(Version, Encoded));
- Decoded.set(EXP_CNT, decodeExpcnt(Version, Encoded));
- Decoded.set(DS_CNT, decodeLgkmcnt(Version, Encoded));
- return Decoded;
-}
-
-unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded) {
- return encodeWaitcnt(Version, Decoded.get(LOAD_CNT), Decoded.get(EXP_CNT),
- Decoded.get(DS_CNT));
-}
-
-Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt) {
- Waitcnt Decoded;
- Decoded.set(LOAD_CNT, decodeLoadcnt(Version, LoadcntDscnt));
- Decoded.set(DS_CNT, decodeDscnt(Version, LoadcntDscnt));
- return Decoded;
-}
-
-Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt) {
- Waitcnt Decoded;
- Decoded.set(STORE_CNT, decodeStorecnt(Version, StorecntDscnt));
- Decoded.set(DS_CNT, decodeDscnt(Version, StorecntDscnt));
- return Decoded;
-}
-
-unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded) {
- return encodeLoadcntDscnt(Version, Decoded.get(LOAD_CNT),
- Decoded.get(DS_CNT));
-}
-
-unsigned encodeStorecntDscnt(const IsaVersion &Version,
- const Waitcnt &Decoded) {
- return encodeStorecntDscnt(Version, Decoded.get(STORE_CNT),
- Decoded.get(DS_CNT));
-}
-
-} // namespace AMDGPU
-
-} // namespace llvm
diff --git a/llvm/lib/Target/AMDGPU/CMakeLists.txt b/llvm/lib/Target/AMDGPU/CMakeLists.txt
index dd60d7520e7f1..cda288e012925 100644
--- a/llvm/lib/Target/AMDGPU/CMakeLists.txt
+++ b/llvm/lib/Target/AMDGPU/CMakeLists.txt
@@ -119,7 +119,6 @@ add_llvm_target(AMDGPUCodeGen
AMDGPUTargetMachine.cpp
AMDGPUTargetObjectFile.cpp
AMDGPUTargetTransformInfo.cpp
- AMDGPUWaitcnt.cpp
AMDGPUWaitSGPRHazards.cpp
AMDGPUUnifyDivergentExitNodes.cpp
R600MachineCFGStructurizer.cpp
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
index da5184f37ce75..00b9c00b11312 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -11,9 +11,9 @@
//===----------------------------------------------------------------------===//
#include "GCNHazardRecognizer.h"
-#include "AMDGPUWaitcnt.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
+#include "SIInsertWaitcnts.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index 7739d788b253f..b242c9772574d 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -23,8 +23,8 @@
//
//===----------------------------------------------------------------------===//
+#include "SIInsertWaitcnts.h"
#include "AMDGPU.h"
-#include "AMDGPUWaitcnt.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
@@ -70,6 +70,87 @@ static cl::opt<bool> ExpertSchedulingModeFlag(
cl::desc("Enable expert scheduling mode 2 for all functions (GFX12+ only)"),
cl::init(false), cl::Hidden);
+namespace llvm {
+
+namespace AMDGPU {
+
+iota_range<InstCounterType> inst_counter_types(InstCounterType MaxCounter) {
+ return enum_seq(LOAD_CNT, MaxCounter);
+}
+
+StringLiteral getInstCounterName(InstCounterType T) {
+ switch (T) {
+ case LOAD_CNT:
+ return "LOAD_CNT";
+ case DS_CNT:
+ return "DS_CNT";
+ case EXP_CNT:
+ return "EXP_CNT";
+ case STORE_CNT:
+ return "STORE_CNT";
+ case SAMPLE_CNT:
+ return "SAMPLE_CNT";
+ case BVH_CNT:
+ return "BVH_CNT";
+ case KM_CNT:
+ return "KM_CNT";
+ case X_CNT:
+ return "X_CNT";
+ case VA_VDST:
+ return "VA_VDST";
+ case VM_VSRC:
+ return "VM_VSRC";
+ default:
+ return "Unknown T";
+ }
+}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+void Waitcnt::dump() const { dbgs() << *this << "\n"; }
+#endif
+
+Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded) {
+ Waitcnt Decoded;
+ Decoded.set(LOAD_CNT, decodeVmcnt(Version, Encoded));
+ Decoded.set(EXP_CNT, decodeExpcnt(Version, Encoded));
+ Decoded.set(DS_CNT, decodeLgkmcnt(Version, Encoded));
+ return Decoded;
+}
+
+unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded) {
+ return encodeWaitcnt(Version, Decoded.get(LOAD_CNT), Decoded.get(EXP_CNT),
+ Decoded.get(DS_CNT));
+}
+
+Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt) {
+ Waitcnt Decoded;
+ Decoded.set(LOAD_CNT, decodeLoadcnt(Version, LoadcntDscnt));
+ Decoded.set(DS_CNT, decodeDscnt(Version, LoadcntDscnt));
+ return Decoded;
+}
+
+Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt) {
+ Waitcnt Decoded;
+ Decoded.set(STORE_CNT, decodeStorecnt(Version, StorecntDscnt));
+ Decoded.set(DS_CNT, decodeDscnt(Version, StorecntDscnt));
+ return Decoded;
+}
+
+unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded) {
+ return encodeLoadcntDscnt(Version, Decoded.get(LOAD_CNT),
+ Decoded.get(DS_CNT));
+}
+
+unsigned encodeStorecntDscnt(const IsaVersion &Version,
+ const Waitcnt &Decoded) {
+ return encodeStorecntDscnt(Version, Decoded.get(STORE_CNT),
+ Decoded.get(DS_CNT));
+}
+
+} // namespace AMDGPU
+
+} // namespace llvm
+
namespace {
// Get the maximum wait count value for a given counter type.
static unsigned getWaitCountMax(const AMDGPU::HardwareLimits &Limits,
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.h
similarity index 96%
rename from llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h
rename to llvm/lib/Target/AMDGPU/SIInsertWaitcnts.h
index 38530a8a2f3f6..6041db5563513 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUWaitcnt.h
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.h
@@ -1,4 +1,4 @@
-//===- AMDGPUWaitcnt.h - Wait Counters used in SIInsertWaitcnts -*- C++ -*-===//
+//===- SIInsertWaitcnts.h - Insert Wait Instructions ------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNT_H
-#define LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNT_H
+#ifndef LLVM_LIB_TARGET_AMDGPU_SIINSERTWAITCNTS_H
+#define LLVM_LIB_TARGET_AMDGPU_SIINSERTWAITCNTS_H
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/StringExtras.h"
@@ -169,4 +169,5 @@ unsigned encodeStorecntDscnt(const IsaVersion &Version, const Waitcnt &Decoded);
} // namespace llvm
-#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNT_H
+#endif // LLVM_LIB_TARGET_AMDGPU_SIINSERTWAITCNTS_H
+
>From dc8620880333bba2354a02b83995b24f6c84c9ad Mon Sep 17 00:00:00 2001
From: Vasileios Porpodas <vasileios.porpodas at amd.com>
Date: Mon, 6 Apr 2026 17:40:36 +0000
Subject: [PATCH 3/3] fixup! fixup! [AMDGPU] Move InstrCounterType and Waitcnt
to new file AMDGPUWaitcnt.h
---
.../AMDGPU/{SIInsertWaitcnts.h => AMDGPUWaitcntUtils.h} | 9 ++++-----
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp | 2 +-
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
rename llvm/lib/Target/AMDGPU/{SIInsertWaitcnts.h => AMDGPUWaitcntUtils.h} (95%)
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.h b/llvm/lib/Target/AMDGPU/AMDGPUWaitcntUtils.h
similarity index 95%
rename from llvm/lib/Target/AMDGPU/SIInsertWaitcnts.h
rename to llvm/lib/Target/AMDGPU/AMDGPUWaitcntUtils.h
index 6041db5563513..111b28af3b47e 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUWaitcntUtils.h
@@ -1,4 +1,4 @@
-//===- SIInsertWaitcnts.h - Insert Wait Instructions ------------*- C++ -*-===//
+//===- AMDGPUWaitcntUtils.h -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIB_TARGET_AMDGPU_SIINSERTWAITCNTS_H
-#define LLVM_LIB_TARGET_AMDGPU_SIINSERTWAITCNTS_H
+#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNTUTILS_H
+#define LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNTUTILS_H
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/StringExtras.h"
@@ -169,5 +169,4 @@ unsigned encodeStorecntDscnt(const IsaVersion &Version, const Waitcnt &Decoded);
} // namespace llvm
-#endif // LLVM_LIB_TARGET_AMDGPU_SIINSERTWAITCNTS_H
-
+#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUWAITCNTUTILS_H
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
index 00b9c00b11312..8e2306682dbc3 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -11,9 +11,9 @@
//===----------------------------------------------------------------------===//
#include "GCNHazardRecognizer.h"
+#include "AMDGPUWaitcntUtils.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
-#include "SIInsertWaitcnts.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index b242c9772574d..d8ba0d3f14fe5 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -23,8 +23,8 @@
//
//===----------------------------------------------------------------------===//
-#include "SIInsertWaitcnts.h"
#include "AMDGPU.h"
+#include "AMDGPUWaitcntUtils.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
More information about the llvm-commits
mailing list