Skip to content

Commit

Permalink
Adapt to const tblgen main function (#2099)
Browse files Browse the repository at this point in the history
* Adapt to const tblgen main function

* Update enzyme-tblgen.cpp

* fix

* fix
  • Loading branch information
wsmoses authored Oct 2, 2024
1 parent 7425c37 commit b208929
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions enzyme/tools/enzyme-tblgen/blas-tblgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ void rev_call_args(bool forward, Twine argName, const TGPattern &pattern,
}
}

void emit_tmp_free(Record *Def, raw_ostream &os, StringRef builder) {
void emit_tmp_free(const Record *Def, raw_ostream &os, StringRef builder) {
const auto args = Def->getValueAsListOfStrings("args");
// allocating tmp variables is optional, return if not required
if (args.size() == 0)
Expand All @@ -1467,7 +1467,7 @@ void emit_tmp_free(Record *Def, raw_ostream &os, StringRef builder) {
os << " CreateDealloc(" << builder << ", true_" << allocName << ");\n";
}

void emit_tmp_creation(Record *Def, raw_ostream &os, StringRef builder) {
void emit_tmp_creation(const Record *Def, raw_ostream &os, StringRef builder) {
const auto args = Def->getValueAsListOfStrings("args");
// allocating tmp variables is optional, return if not required
if (args.size() == 0)
Expand Down
7 changes: 6 additions & 1 deletion enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2746,7 +2746,12 @@ void emitDiffUse(const RecordKeeper &recordKeeper, raw_ostream &os,

void emitMLIRDerivatives(RecordKeeper &records, raw_ostream &os);

static bool EnzymeTableGenMain(raw_ostream &os, RecordKeeper &records) {
#if LLVM_VERSION_MAJOR >= 20
static bool EnzymeTableGenMain(raw_ostream &os, const RecordKeeper &records)
#else
static bool EnzymeTableGenMain(raw_ostream &os, RecordKeeper &records)
#endif
{
switch (action) {
case MLIRDerivatives:
case CallDerivatives:
Expand Down

0 comments on commit b208929

Please sign in to comment.