Skip to content

Commit

Permalink
All benchmarks building (not optimized)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Apr 23, 2020
1 parent 0734012 commit 81f22f5
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build: ["Release", "Debug"] # "RelWithDebInfo"
os: [self-hosted]

timeout-minutes: 30
timeout-minutes: 45
steps:
- name: add llvm
run: |
Expand Down
2 changes: 1 addition & 1 deletion enzyme/Enzyme/EnzymeLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3144,7 +3144,7 @@ badfn:;
std::reverse(postCreate.begin(), postCreate.end());
for(auto a : postCreate) {
for(unsigned i=0; i<a->getNumOperands(); i++) {
a->setOperand(i, gutils->unwrapM(a->getOperand(i), Builder2, mapp, true));
a->setOperand(i, gutils->unwrapM(a->getOperand(i), Builder2, mapp, UnwrapMode::LegalFullUnwrap));
}
llvm::errs() << "moving instruction for postcreate: " << *a << "\n";
a->moveBefore(*Builder2.GetInsertBlock(), Builder2.GetInsertPoint());
Expand Down
18 changes: 14 additions & 4 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,24 @@

bool GradientUtils::legalRecompute(Value* val, const ValueToValueMapTy& available) {
if (available.count(val)) return true;
if (isa<PHINode>(val)) return false;

if (isa<PHINode>(val)) {
if (auto dli = dyn_cast_or_null<LoadInst>(hasUninverted(val))) {
return legalRecompute(dli, available); // TODO ADD && !TR.intType(getOriginal(dli), /*mustfind*/false).isPossibleFloat();
}
return false;
}

if (isa<Instruction>(val) && cast<Instruction>(val)->getMetadata("enzyme_mustcache")) return false;

// If this is a load from cache already, dont force a cache of this
if (isa<LoadInst>(val) && cast<LoadInst>(val)->getMetadata("enzyme_fromcache")) return true;

//TODO consider callinst here

if (auto li = dyn_cast<LoadInst>(val)) {


//TODO this is more conservative than necessary
//if (isa<AllocaInst>(GetUnderlyingObject(li->getPointerOperand(), oldFunc->getParent()->getDataLayout(), 100))) {
// return false;
Expand Down Expand Up @@ -935,8 +945,8 @@ Value* GradientUtils::lookupM(Value* val, IRBuilder<>& BuilderM, const ValueToVa
//llvm::errs() << " considering " << *inst << " legal: " << legalRecompute(inst, available) << " should: " << shouldRecompute(inst, available) << "\n";
if (legalRecompute(inst, available)) {
if (shouldRecompute(inst, available)) {
//llvm::errs() << "for op " << *inst << " choosing to unwrap\n";
auto op = unwrapM(inst, BuilderM, available, /*lookupIfAble*/false, /*fullUnwrap*/false);
auto op = unwrapM(inst, BuilderM, available, UnwrapMode::AttemptSingleUnwrap);
//llvm::errs() << "for op " << *inst << " choosing to unwrap and found: " << op << "\n";
if (op) {
assert(op);
assert(op->getType());
Expand All @@ -955,7 +965,7 @@ Value* GradientUtils::lookupM(Value* val, IRBuilder<>& BuilderM, const ValueToVa
}
} else {
if (isa<LoadInst>(inst)) {
llvm::errs() << " + loading " << *inst << "\n";
//llvm::errs() << " + loading " << *inst << "\n";
}
}
}
Expand Down
Loading

0 comments on commit 81f22f5

Please sign in to comment.