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

Fix memory errors #1488

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions enzyme/Enzyme/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ void callMemcpyStridedBlas(llvm::IRBuilder<> &B, llvm::Module &M, BlasInfo blas,
llvm::ArrayRef<llvm::Value *> args,
llvm::Type *copy_retty,
llvm::ArrayRef<llvm::OperandBundleDef> bundles) {
auto copy_name = Twine(blas.prefix) + blas.floatType + "copy" + blas.suffix;
Twine copy_name = Twine(blas.prefix) + blas.floatType + "copy" + blas.suffix;

SmallVector<Type *, 1> tys;
for (auto arg : args)
Expand All @@ -655,7 +655,7 @@ void callMemcpyStridedBlas(llvm::IRBuilder<> &B, llvm::Module &M, BlasInfo blas,
void callMemcpyStridedLapack(llvm::IRBuilder<> &B, llvm::Module &M,
BlasInfo blas, llvm::ArrayRef<llvm::Value *> args,
llvm::ArrayRef<llvm::OperandBundleDef> bundles) {
auto copy_name = Twine(blas.prefix) + blas.floatType + "lacpy" + blas.suffix;
Twine copy_name = Twine(blas.prefix) + blas.floatType + "lacpy" + blas.suffix;

SmallVector<Type *, 1> tys;
for (auto arg : args)
Expand All @@ -674,14 +674,14 @@ void callSPMVDiagUpdate(IRBuilder<> &B, Module &M, BlasInfo blas,
ArrayRef<OperandBundleDef> bundles, bool byRef,
bool julia_decl) {
// add spmv diag update call if not already present
auto fnc_name = Twine("__enzyme_spmv_diag") + blas.floatType + blas.suffix;
auto fnc_name = "__enzyme_spmv_diag" + blas.floatType + blas.suffix;

// spmvDiagHelper(uplo, n, alpha, x, incx, ya, incy, APa)
auto FDiagUpdateT = FunctionType::get(
B.getVoidTy(),
{BlasCT, BlasIT, BlasFPT, BlasPT, BlasIT, BlasPT, BlasIT, BlasPT}, false);
Function *F = cast<Function>(
M.getOrInsertFunction(fnc_name.str(), FDiagUpdateT).getCallee());
Function *F =
cast<Function>(M.getOrInsertFunction(fnc_name, FDiagUpdateT).getCallee());

if (!F->empty()) {
B.CreateCall(F, args, bundles);
Expand Down
3 changes: 2 additions & 1 deletion enzyme/tools/enzyme-tblgen/blasDiffUseUpdater.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ void emit_BLASDiffUse(TGPattern &pattern, llvm::raw_ostream &os) {

if (hasDiffeRetVal) {
size_t ptrRetArg = typeMap.size();
Twine retarg = "CI->getArgOperand(" + Twine(ptrRetArg) + " + offset)";
auto retarg =
"CI->getArgOperand(" + std::to_string(ptrRetArg) + " + offset)";
os << " if (cublas) {\n";
os << " if (!gutils->isConstantValue(" << retarg << "))\n";
os << " if ((shadow || EnzymeRuntimeActivityCheck) && val == "
Expand Down
Loading