Skip to content

Commit

Permalink
add tdpbssd/usd/sud/uud instruction to AMXGEMM handler -- output is c…
Browse files Browse the repository at this point in the history
…urrently 100% wrong
  • Loading branch information
Michael Allen Goldstein committed Feb 14, 2024
1 parent 8c3e6c5 commit a42a37d
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions tools/x86_trace_generator/trace_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,6 @@ VOID AMXGEMM(UINT32 dst, UINT32 a, UINT32 b, THREADID tid) {
}
}

VOID AMXDot(UINT32 dst, UINT32 a, UINT32 b, THREADID tid) {
for (int m = 0; m < 16; m++) {
for (int n = 0; n < 16; n++) {

}
}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
// control handler for pinpoint (simpoint)
////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1008,7 +1000,37 @@ void instrument(INS ins)
IARG_THREAD_ID,
IARG_END
);
} else if (INS_Mnemonic(ins) == "TDPBF16PS") {
} else if (INS_Mnemonic(ins) == "TDPBF16PS" ||
INS_Mnemonic(ins) == "TDPBSSD" ||
INS_Mnemonic(ins) == "TDPBUSD" ||
INS_Mnemonic(ins) == "TDPBSUD" ||
INS_Mnemonic(ins) == "TDPBUUD") {
// emulate AMX GEMM
info->is_fp = 1;
REG r = INS_OperandReg(ins, 0);
REG ra = INS_OperandReg(ins, 1);
REG rb = INS_OperandReg(ins, 2);

if (!REG_is_tmm(r)) cerr << "opd 0 is not a tile register" << endl;
if (!REG_is_tmm(ra)) cerr << "opd 1 is not a tile register" << endl;
if (!REG_is_tmm(rb)) cerr << "opd 2 is not a tile register" << endl;
UINT32 dst = r - REG_TMM0;
UINT32 a = ra - REG_TMM0;
UINT32 b = rb - REG_TMM0;
#ifdef VERBOSE
std::string opcode = INS_Mnemonic(ins);
cout << tolower(opcode) << " " << REG_StringShort(r) << ", " << REG_StringShort(ra) << ", " << REG_StringShort(rb) << endl;
#endif
INS_InsertCall(
ins,
IPOINT_BEFORE, AFUNPTR(AMXGEMM),
IARG_UINT32, dst,
IARG_UINT32, a,
IARG_UINT32, b,
IARG_THREAD_ID,
IARG_END
);
} else if (INS_Mnemonic(ins) == "TDPBSSD" || INS_Mnemonic(ins) == "TDPBUSD" || INS_Mnemonic(ins) == "TDPBSUD" || INS_Mnemonic(ins) == "TDPBUUD") {
// emulate AMX GEMM
info->is_fp = 1;
REG r = INS_OperandReg(ins, 0);
Expand All @@ -1022,7 +1044,7 @@ void instrument(INS ins)
UINT32 a = ra - REG_TMM0;
UINT32 b = rb - REG_TMM0;
#ifdef VERBOSE
cout << "tdpbf16ps" << REG_StringShort(r) << ", " << REG_StringShort(ra) << ", " << REG_StringShort(rb) << endl;
cout << "tdpbssd" << REG_StringShort(r) << ", " << REG_StringShort(ra) << ", " << REG_StringShort(rb) << endl;
#endif
INS_InsertCall(
ins,
Expand Down

0 comments on commit a42a37d

Please sign in to comment.