Skip to content

Commit

Permalink
MLIR add postop tablegen helper (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Mar 7, 2024
1 parent d12e7cd commit 0a129ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit 0a129ae

Please sign in to comment.