Skip to content

Commit

Permalink
Merge branch 'main' into extern-register-pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuseZ4 authored Feb 7, 2025
2 parents 77089c9 + e394dbf commit e44e3b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions enzyme/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ td_library(
srcs = [
"Enzyme/MLIR/Dialect/Dialect.td",
],
includes = ["."],
deps = [
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
"@llvm-project//mlir:FunctionInterfacesTdFiles",
Expand Down
3 changes: 2 additions & 1 deletion enzyme/Enzyme/MLIR/Implementations/Common.td
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ class StaticSelect<string condition_> : Operation</*usesPrimal*/0, /*usesShadow*
string condition = condition_;
}

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

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 @@ -1094,6 +1094,10 @@ bool handle(const Twine &curIndent, const Twine &argPattern, raw_ostream &os,
} else if (opName == "CheckedDiv") {
os << "checkedDiv(" << builder << ", ";
} else if (intrinsic == MLIRDerivatives) {
if (intrinsic == MLIRDerivatives) {
auto preop = Def->getValueAsString("preop");
os << preop;
}
auto dialect = Def->getValueAsString("dialect");
os << builder << ".create<" << dialect << "::" << opName
<< ">(op.getLoc(), ";
Expand Down

0 comments on commit e44e3b7

Please sign in to comment.