[PATCH] D124342: [X86][AMX] Report error when shapes are not pre-defined.
LuoYuanke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 24 01:47:38 PDT 2022
LuoYuanke created this revision.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
LuoYuanke requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Instead of report fatal error, this patch emit error message and exit
when shapes are not pre-defined.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124342
Files:
llvm/lib/Target/X86/X86PreTileConfig.cpp
llvm/test/CodeGen/X86/AMX/amx_error.ll
Index: llvm/test/CodeGen/X86/AMX/amx_error.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/AMX/amx_error.ll
@@ -0,0 +1,13 @@
+ at row = dso_local global i16 8, align 2
+ at col = dso_local global i16 8, align 2
+
+define dso_local void @add() {
+entry:
+ %t0 = load i16, ptr @row, align 2
+ %t1 = call x86_amx @llvm.x86.tilezero.internal(i16 %t0, i16 64)
+ %t2 = load i16, ptr @col, align 2
+ %t3 = call x86_amx @llvm.x86.tilezero.internal(i16 16, i16 %t2)
+ ret void
+}
+
+declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
Index: llvm/lib/Target/X86/X86PreTileConfig.cpp
===================================================================
--- llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -31,6 +31,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
@@ -40,10 +41,16 @@
using namespace llvm;
#define DEBUG_TYPE "tile-pre-config"
-#define REPORT_CONFIG_FAIL \
- report_fatal_error( \
- MF.getName() + \
- ": Failed to config tile register, please define the shape earlier");
+
+static void emitErrorMsg(MachineFunction &MF) {
+ SmallString<32> Str;
+ Twine ErrorMsg =
+ MF.getName() +
+ ": Failed to config tile register, please define the shape earlier";
+ LLVMContext &Context = MF.getMMI().getModule()->getContext();
+ Context.emitError(ErrorMsg);
+ exit(1);
+}
namespace {
@@ -303,11 +310,11 @@
for (auto &I : ShapeBBs) {
// TODO: We can hoist shapes across BBs here.
if (BBVisitedInfo[I.first].HasAMXRegLiveIn)
- REPORT_CONFIG_FAIL
+ emitErrorMsg(MF);
if (BBVisitedInfo[I.first].FirstAMX &&
BBVisitedInfo[I.first].FirstAMX < I.second.back() &&
!hoistShapesInBB(I.first, I.second))
- REPORT_CONFIG_FAIL
+ emitErrorMsg(MF);
WorkList.push_back(I.first);
}
while (!WorkList.empty()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124342.424773.patch
Type: text/x-patch
Size: 2317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220424/8fd19809/attachment.bin>
More information about the llvm-commits
mailing list