Skip to content

Commit 951673f

Browse files
committed
address review comments
1 parent 9975e07 commit 951673f

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

mlir/lib/Dialect/Rock/IR/MfmaInsnGroup.cpp

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -581,47 +581,42 @@ MfmaInsnGroup::select(Type elementTypeA, Type elementTypeB, StringRef arch,
581581
result = MfmaInsnGroup(elementTypeA, elementTypeB, *maybeInsn, groupAttr);
582582
}
583583
};
584+
585+
auto selectForGfx950 = [&]() {
586+
// gfx950 has double rate instructions. Select from those first.
587+
selectFrom(getMfmaInsnGroupAttrMapGfx950());
588+
if (succeeded(result)) {
589+
if (result->isCoherentWithK(kPack, kPackPerBlock)) {
590+
LLVM_DEBUG(llvm::dbgs() << "Selected gfx950 double rate instruction\n");
591+
return;
592+
}
593+
// else select again
594+
result = failure();
595+
return;
596+
}
597+
};
598+
584599
bool isGfx908 = arch.contains("gfx908");
585600
bool isGfx90a = arch.contains("gfx90a");
586-
bool isGfx94x = arch.contains("gfx942");
587-
bool isGfx95x = arch.contains("gfx950");
601+
bool isGfx942 = arch.contains("gfx942");
588602
// TODO: refactor this later to not keep multiple maps for different arches
589603
if (elementTypeA.isBF16()) {
590604
if (isGfx908) {
591605
selectFrom(getMfmaInsnGroupAttrMapGfx908Bf16());
592-
} else if (isGfx94x || isGfx90a) {
606+
} else if (isGfx942 || isGfx90a) {
593607
selectFrom(getMfmaInsnGroupAttrMapGfx90aPlusBf16());
594608
} else {
595-
// gfx950 has double rate instructions. Select from those first.
596-
selectFrom(getMfmaInsnGroupAttrMapGfx950());
597-
if (succeeded(result)) {
598-
if (result->isCoherentWithK(kPack, kPackPerBlock)) {
599-
LLVM_DEBUG(llvm::dbgs()
600-
<< "Selected gfx950 double rate instruction\n");
601-
return result;
602-
}
603-
// else select again
604-
result = failure();
605-
}
609+
selectForGfx950();
606610
selectFrom(getMfmaInsnGroupAttrMapGfx90aPlusBf16());
607611
}
608612
}
609613

610614
if (isGfx908 || isGfx90a) {
611615
selectFrom(getMfmaInsnGroupAttrMapPreGfx942Int8());
612-
} else if (isGfx94x) {
616+
} else if (isGfx942) {
613617
selectFrom(getMfmaInsnGroupAttrMapGfx942());
614-
} else if (isGfx95x) {
615-
// select from new double rate instructions first
616-
selectFrom(getMfmaInsnGroupAttrMapGfx950());
617-
if (succeeded(result)) {
618-
if (result->isCoherentWithK(kPack, kPackPerBlock)) {
619-
LLVM_DEBUG(llvm::dbgs() << "Selected gfx950 double rate instruction\n");
620-
return result;
621-
}
622-
// else select again
623-
result = failure();
624-
}
618+
} else {
619+
selectForGfx950();
625620
// all previous instructions are still valid for gfx950
626621
selectFrom(getMfmaInsnGroupAttrMapGfx942());
627622
}

0 commit comments

Comments
 (0)