[PATCH] D87748: [AMDGPU] Consider all SGPR uses as unique in constant bus verify
Carl Ritson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 16 01:19:45 PDT 2020
critson created this revision.
critson added reviewers: rampitec, arsenm.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
critson requested review of this revision.
Herald added a subscriber: wdng.
Fix the verifier so that overlapping SGPR operands are counted
independently. We cannot assume that overlapping SGPR accesses
only count as a single constant bus use.
The exception is implicit uses which do not add to constant bus
usage (only) when overlapping.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87748
Files:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -3820,11 +3820,7 @@
++ConstantBusCount;
SmallVector<Register, 2> SGPRsUsed;
- Register SGPRUsed = findImplicitSGPRRead(MI);
- if (SGPRUsed != AMDGPU::NoRegister) {
- ++ConstantBusCount;
- SGPRsUsed.push_back(SGPRUsed);
- }
+ Register SGPRUsed;
for (int OpIdx : OpIndices) {
if (OpIdx == -1)
@@ -3833,8 +3829,8 @@
if (usesConstantBus(MRI, MO, MI.getDesc().OpInfo[OpIdx])) {
if (MO.isReg()) {
SGPRUsed = MO.getReg();
- if (llvm::all_of(SGPRsUsed, [this, SGPRUsed](unsigned SGPR) {
- return !RI.regsOverlap(SGPRUsed, SGPR);
+ if (llvm::all_of(SGPRsUsed, [SGPRUsed](unsigned SGPR) {
+ return SGPRUsed != SGPR;
})) {
++ConstantBusCount;
SGPRsUsed.push_back(SGPRUsed);
@@ -3845,6 +3841,18 @@
}
}
}
+
+ SGPRUsed = findImplicitSGPRRead(MI);
+ if (SGPRUsed != AMDGPU::NoRegister) {
+ // Implicit uses may safely overlap true overands
+ if (llvm::all_of(SGPRsUsed, [this, SGPRUsed](unsigned SGPR) {
+ return !RI.regsOverlap(SGPRUsed, SGPR);
+ })) {
+ ++ConstantBusCount;
+ SGPRsUsed.push_back(SGPRUsed);
+ }
+ }
+
// v_writelane_b32 is an exception from constant bus restriction:
// vsrc0 can be sgpr, const or m0 and lane select sgpr, m0 or inline-const
if (ConstantBusCount > ST.getConstantBusLimit(Opcode) &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87748.292135.patch
Type: text/x-patch
Size: 1665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200916/7c52bbff/attachment.bin>
More information about the llvm-commits
mailing list