Skip to content

Commit

Permalink
Add loose types for extract
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Dec 9, 2024
1 parent 07e1826 commit 5cab917
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1840,14 +1840,25 @@ class AdjointGenerator : public llvm::InstVisitor<AdjointGenerator> {
}
unsigned size = nextStart - start;
if (!dt.isKnown()) {

std::string str;
raw_string_ostream ss(str);
ss << "Cannot deduce type of extract " << EVI << vd.str()
<< " start: " << start << " size: " << size
<< " extractSize: " << storeSize;
EmitNoTypeError(str, EVI, gutils, Builder2);
break;
bool found = false;
if (looseTypeAnalysis) {
if (EVI.getType()->isFPOrFPVectorTy()) {
dt = ConcreteType(EVI.getType()->getScalarType());
found = true;
} else if (EVI.getType()->isIntOrIntVectorTy() ||
EVI.getType()->isPointerTy()) {
dt = BaseType::Integer;
found = true;
}
}
if (!found) {
std::string str;
raw_string_ostream ss(str);
ss << "Cannot deduce type of extract " << EVI << vd.str()
<< " start: " << start << " size: " << size
<< " extractSize: " << storeSize;
EmitNoTypeError(str, EVI, gutils, Builder2);
}
}
if (auto FT = dt.isFloat())
((DiffeGradientUtils *)gutils)
Expand Down

0 comments on commit 5cab917

Please sign in to comment.