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

Batched autodiff #2181

Merged
merged 22 commits into from
Dec 27, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
do the simple batching in enzyme-tblgen
  • Loading branch information
jumerckx committed Dec 16, 2024
commit 3a3bdf86630b8b82cb911c6cc240b2374c76347e
12 changes: 11 additions & 1 deletion enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,18 @@ SmallVector<bool, 1> prepareArgs(const Twine &curIndent, raw_ostream &os,
os << ord;
}
if (!vecValue && !startsWith(ord, "local")) {
if (newFromOriginal && (!lookup || intrinsic != MLIRDerivatives))
if (newFromOriginal && (!lookup || intrinsic != MLIRDerivatives)) {
os << ")";
if (intrinsic == MLIRDerivatives) {
os << ";\n";
os << "if (gutils->width != 1) {\n"
<< " " << argName << "_" << (idx - 1) << " = builder.create<tensor::SplatOp>(\n"
<< " op.getLoc(),\n"
<< " mlir::RankedTensorType::get({gutils->width}, " << argName << "_" << (idx - 1) << ".getType()),\n"
<< " " << argName << "_" << (idx - 1) << ");\n"
<< "}";
}
}

if (lookup && intrinsic != MLIRDerivatives)
os << ", " << builder << ")";
Expand Down