Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLIR add postop tablegen helper #1783

Merged
merged 1 commit into from
Mar 7, 2024
Merged
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
3 changes: 2 additions & 1 deletion enzyme/Enzyme/MLIR/Implementations/Common.td
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ class GlobalExpr<bit uses_primal, bit uses_shadow, string val> : Operation<uses_
string value = val;
}

class Inst<string mnemonic, string dialect_> : Operation</*primal*/1, /*shadow*/0> {
class Inst<string mnemonic, string dialect_, string postop_=""> : Operation</*primal*/1, /*shadow*/0> {
string name = mnemonic;
string dialect = dialect_;
string postop = postop_;
}

def Op {
Expand Down
4 changes: 4 additions & 0 deletions enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,10 @@ bool handle(const Twine &curIndent, const Twine &argPattern, raw_ostream &os,
if (isCall || isIntr)
os << "})";
os << ")";
if (intrinsic == MLIRDerivatives) {
auto postop = Def->getValueAsString("postop");
os << postop;
}
if (isCall) {
os << ")";
}
Expand Down
Loading