Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,17 @@ struct DPPModifiers : public TypedModifier<DPPModifiers> {
int row_bcast;
int bound_ctrl;

DPPModifiers(int row_shr = -1, int row_bcast = -1, int bound_ctrl = -1)
// Raw dpp_ctrl string for modes not modelled as typed fields
// (e.g. "row_xmask:8", "row_shl:4"). Emitted verbatim.
std::string dppCtrl;
Comment thread
darrenhsieh-amd marked this conversation as resolved.

DPPModifiers(int row_shr = -1, int row_bcast = -1, int bound_ctrl = -1,
const std::string& dppCtrl = "")
: TypedModifier<DPPModifiers>(),
row_shr(row_shr),
row_bcast(row_bcast),
bound_ctrl(bound_ctrl) {}
bound_ctrl(bound_ctrl),
dppCtrl(dppCtrl) {}
};

struct VOP3Modifiers : public TypedModifier<VOP3Modifiers> {
Expand Down
37 changes: 27 additions & 10 deletions shared/stinkytofu/src/serialization/asm/ModifierSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,19 +410,32 @@ void deserializeVisit(StinkyInstruction* inst, const std::string& attrKey,
} else if (attrKey == "mod.swaitstorecnt") {
inst->addModifier(SWaitStoreCntData(static_cast<int8_t>(getInt(fields, "storecnt", -1))));
} else if (attrKey == "mod.mfma") {
// Build inputPermute from individual matrix format fields when not
// provided as a pre-built string (RawAsmParser provides individual
// fields, STIR/pipeline path provides the pre-built string).
std::string inputPermute = getStr(fields, "inputPermute");
if (inputPermute.empty()) {
for (const auto& key :
{"matrix_a_fmt", "matrix_b_fmt", "matrix_a_scale_fmt", "matrix_b_scale_fmt"}) {
auto it = fields.find(key);
if (it != fields.end()) {
if (!inputPermute.empty()) inputPermute += ' ';
inputPermute += std::string(key) + ":" + it->second;
}
}
}
bool isMX = getBool(fields, "isMXMFMA", false);
if (isMX) {
inst->addModifier(MFMAModifiers(
getStr(fields, "inputPermute"), getStr(fields, "scaleStr"),
getStr(fields, "negStr"), getBool(fields, "reuseA", false),
getBool(fields, "reuseB", false), getInt(fields, "mxInstType", 0),
getInt(fields, "mxScaleAType", 0), getInt(fields, "mxScaleBType", 0)));
inst->addModifier(
MFMAModifiers(inputPermute, getStr(fields, "scaleStr"), getStr(fields, "negStr"),
Comment thread
darrenhsieh-amd marked this conversation as resolved.
getBool(fields, "reuseA", false), getBool(fields, "reuseB", false),
getInt(fields, "mxInstType", 0), getInt(fields, "mxScaleAType", 0),
getInt(fields, "mxScaleBType", 0)));
} else {
inst->addModifier(
MFMAModifiers(getStr(fields, "inputPermute"), getStr(fields, "scaleStr"),
getStr(fields, "negStr"), getBool(fields, "reuseA", false),
getBool(fields, "reuseB", false), getBool(fields, "neg_lo", false),
getBool(fields, "neg_hi", false)));
MFMAModifiers(inputPermute, getStr(fields, "scaleStr"), getStr(fields, "negStr"),
Comment thread
darrenhsieh-amd marked this conversation as resolved.
getBool(fields, "reuseA", false), getBool(fields, "reuseB", false),
getBool(fields, "neg_lo", false), getBool(fields, "neg_hi", false)));
}
} else if (attrKey == "mod.delayalu") {
auto toInstType = [](const std::string& s) {
Expand Down Expand Up @@ -455,8 +468,12 @@ void deserializeVisit(StinkyInstruction* inst, const std::string& attrKey,
if (fields.count("tokens")) {
inst->addModifier(MemTokenData(getIntVector(fields, "tokens")));
}
} else if (attrKey == "mod.dpp") {
inst->addModifier(
DPPModifiers(getInt(fields, "row_shr", -1), getInt(fields, "row_bcast", -1),
getInt(fields, "bound_ctrl", -1), getStr(fields, "dppCtrl")));
}
// mod.sdwa, mod.dpp, mod.vop3p, mod.true16: no deserialize support yet
// mod.sdwa, mod.vop3p, mod.true16: no deserialize support yet
}

} // namespace
Expand Down
Loading
Loading