Skip to content

Commit 7b33a53

Browse files
committed
Allow specifying sched group barrier masks for inline asm
1 parent 7af6d4c commit 7b33a53

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ enum class SchedGroupMask {
7575
DS_READ = 1u << 8,
7676
DS_WRITE = 1u << 9,
7777
TRANS = 1u << 10,
78-
INLINE_ASM = 1u << 11,
7978
ALL = ALU | VALU | SALU | MFMA | VMEM | VMEM_READ | VMEM_WRITE | DS |
80-
DS_READ | DS_WRITE | TRANS | INLINE_ASM,
79+
DS_READ | DS_WRITE | TRANS,
8180
LLVM_MARK_AS_BITMASK_ENUM(/* LargestFlag = */ ALL)
8281
};
8382

@@ -2392,6 +2391,16 @@ bool SchedGroup::canAddMI(const MachineInstr &MI) const {
23922391
if (MI.isMetaInstruction())
23932392
Result = false;
23942393

2394+
else if (MI.isInlineAsm()) {
2395+
std::string Text = MI.getOperand(0).getSymbolName();
2396+
if (Text.find("SGMASK:") != std::string::npos) {
2397+
Text = Text.substr(Text.find("SGMASK:") + strlen("SGMASK:"));
2398+
Text = Text.substr(0, Text.find_first_of(" \t\r\n"));
2399+
unsigned long InlineAsmMask = std::stoul(Text, nullptr, 0);
2400+
Result = ((unsigned long)SGMask & InlineAsmMask) != 0;
2401+
}
2402+
}
2403+
23952404
else if (((SGMask & SchedGroupMask::ALU) != SchedGroupMask::NONE) &&
23962405
(TII->isVALU(MI) || TII->isMFMAorWMMA(MI) || TII->isSALU(MI) ||
23972406
TII->isTRANS(MI)))
@@ -2437,10 +2446,6 @@ bool SchedGroup::canAddMI(const MachineInstr &MI) const {
24372446
TII->isTRANS(MI))
24382447
Result = true;
24392448

2440-
else if (((SGMask & SchedGroupMask::INLINE_ASM) != SchedGroupMask::NONE) &&
2441-
MI.isInlineAsm())
2442-
Result = true;
2443-
24442449
LLVM_DEBUG(
24452450
dbgs() << "For SchedGroup with mask " << format_hex((int)SGMask, 10, true)
24462451
<< (Result ? " could classify " : " unable to classify ") << MI);

0 commit comments

Comments
 (0)