Skip to content

Commit

Permalink
Cleanup and fix macos (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Oct 13, 2022
1 parent 4d7f77a commit 07eabda
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 34 deletions.
6 changes: 0 additions & 6 deletions enzyme/Enzyme/ActivityAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1605,9 +1605,6 @@ bool ActivityAnalyzer::isConstantValue(TypeResults const &TR, Value *Val) {
new ActivityAnalyzer(*this, directions));
Hypothesis->ActiveValues.insert(Val);
if (auto VI = dyn_cast<Instruction>(Val)) {
for (auto V : DeducingPointers) {
// UpHypothesis->InsertConstantValue(TR, V);
}
if (UpHypothesis->isInstructionInactiveFromOrigin(TR, VI)) {
Hypothesis->DeducingPointers.insert(Val);
if (EnzymePrintActivity)
Expand Down Expand Up @@ -2000,9 +1997,6 @@ bool ActivityAnalyzer::isConstantValue(TypeResults const &TR, Value *Val) {
// UpHypothesis.ConstantValues.insert(val);
if (DeducingPointers.size() == 0)
UpHypothesis->insertConstantsFrom(TR, *Hypothesis);
for (auto V : DeducingPointers) {
// UpHypothesis->InsertConstantValue(TR, V);
}
assert(directions & UP);
bool ActiveUp = !isa<Argument>(Val) &&
!UpHypothesis->isInstructionInactiveFromOrigin(TR, Val);
Expand Down
4 changes: 2 additions & 2 deletions enzyme/Enzyme/EnzymeLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2970,9 +2970,9 @@ void createInvertedTerminator(DiffeGradientUtils *gutils,
PNtype = PNtypeT[{0}];
bool legal = true;
for (size_t i = 1; i < size; i++) {
if (!PNtypeT[{i}].isFloat())
if (!PNtypeT[{(int)i}].isFloat())
continue;
PNtypeT[{i}].checkedOrIn(PNtype, /*pointerIntSame*/ true, legal);
PNtypeT[{(int)i}].checkedOrIn(PNtype, /*pointerIntSame*/ true, legal);
if (!legal) {
break;
}
Expand Down
26 changes: 0 additions & 26 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7099,32 +7099,6 @@ void GradientUtils::computeForwardingProperties(Instruction *V) {
if (!EnzymeRematerialize)
return;

// If promoted, stack or GC allocations don't need to be preserved
// for an explicit free
bool stackOrGC = false;
{
auto TmpOrig =
#if LLVM_VERSION_MAJOR >= 12
getUnderlyingObject(V, 100);
#else
GetUnderlyingObject(V, newFunc->getParent()->getDataLayout(), 100);
#endif
StringRef funcName = "";
if (auto CI = dyn_cast<CallInst>(TmpOrig))
if (Function *originCall = getFunctionFromCall(CI))
funcName = originCall->getName();
if (isa<AllocaInst>(TmpOrig) ||
(isa<Instruction>(TmpOrig) &&
hasMetadata(cast<Instruction>(TmpOrig), "enzyme_fromstack")) ||
funcName == "jl_alloc_array_1d" || funcName == "jl_alloc_array_2d" ||
funcName == "jl_alloc_array_3d" || funcName == "jl_array_copy" ||
funcName == "ijl_alloc_array_1d" || funcName == "ijl_alloc_array_2d" ||
funcName == "ijl_alloc_array_3d" || funcName == "ijl_array_copy" ||
funcName == "julia.gc_alloc_obj" || funcName == "jl_gc_alloc_typed" ||
funcName == "ijl_gc_alloc_typed")
stackOrGC = true;
}

// For the piece of memory V allocated within this scope, it will be
// initialized in some way by the (augmented) forward pass. Loads and other
// load-like operations will either require the allocation V itself to be
Expand Down

0 comments on commit 07eabda

Please sign in to comment.