Skip to content

Commit

Permalink
no readonly/readnone
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Sep 19, 2023
1 parent f09cf90 commit 52499e6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions enzyme/tools/enzyme-tblgen/blasDeclUpdater.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void emit_attributeBLAS(const TGPattern &pattern, raw_ostream &os) {
os << "#if LLVM_VERSION_MAJOR >= 16\n";
os << " F->setOnlyReadsMemory();\n";
os << "#else\n";
os << " F->removeFnAttr(llvm::Attribute::ReadNone);\n";
os << " F->addFnAttr(llvm::Attribute::ReadOnly);\n";
os << "#endif\n";
}
Expand Down Expand Up @@ -76,7 +77,9 @@ void emit_attributeBLAS(const TGPattern &pattern, raw_ostream &os) {
typeOfArg == ArgType::fp || typeOfArg == ArgType::trans ||
typeOfArg == ArgType::mldLD || typeOfArg == ArgType::uplo ||
typeOfArg == ArgType::diag || typeOfArg == ArgType::side) {
os << " F->addParamAttr(" << i << (lv23 ? " + offset" : "")
os << " F->removeParamAttr(" << i << (lv23 ? " + offset" : "")
<< ", llvm::Attribute::ReadNone);\n"
<< " F->addParamAttr(" << i << (lv23 ? " + offset" : "")
<< ", llvm::Attribute::ReadOnly);\n"
<< " F->addParamAttr(" << i << (lv23 ? " + offset" : "")
<< ", llvm::Attribute::NoCapture);\n";
Expand All @@ -95,7 +98,9 @@ void emit_attributeBLAS(const TGPattern &pattern, raw_ostream &os) {
<< ", llvm::Attribute::NoCapture);\n";
if (mutableArgs.count(argPos) == 0) {
// Only emit ReadOnly if the arg isn't mutable
os << " F->addParamAttr(" << i << (lv23 ? " + offset" : "")
os << " F->removeParamAttr(" << i << (lv23 ? " + offset" : "")
<< ", llvm::Attribute::ReadNone);\n"
<< " F->addParamAttr(" << i << (lv23 ? " + offset" : "")
<< ", llvm::Attribute::ReadOnly);\n";
}
}
Expand Down

0 comments on commit 52499e6

Please sign in to comment.