From 07eabdaf6497ae7465906073aae3666ace6f2180 Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 12 Oct 2022 23:43:33 -0400 Subject: [PATCH] Cleanup and fix macos (#900) --- enzyme/Enzyme/ActivityAnalysis.cpp | 6 ------ enzyme/Enzyme/EnzymeLogic.cpp | 4 ++-- enzyme/Enzyme/GradientUtils.cpp | 26 -------------------------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/enzyme/Enzyme/ActivityAnalysis.cpp b/enzyme/Enzyme/ActivityAnalysis.cpp index b00bbd3d38f2..395818f43957 100644 --- a/enzyme/Enzyme/ActivityAnalysis.cpp +++ b/enzyme/Enzyme/ActivityAnalysis.cpp @@ -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(Val)) { - for (auto V : DeducingPointers) { - // UpHypothesis->InsertConstantValue(TR, V); - } if (UpHypothesis->isInstructionInactiveFromOrigin(TR, VI)) { Hypothesis->DeducingPointers.insert(Val); if (EnzymePrintActivity) @@ -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(Val) && !UpHypothesis->isInstructionInactiveFromOrigin(TR, Val); diff --git a/enzyme/Enzyme/EnzymeLogic.cpp b/enzyme/Enzyme/EnzymeLogic.cpp index 12843a539ad1..cbfe79becb1b 100644 --- a/enzyme/Enzyme/EnzymeLogic.cpp +++ b/enzyme/Enzyme/EnzymeLogic.cpp @@ -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; } diff --git a/enzyme/Enzyme/GradientUtils.cpp b/enzyme/Enzyme/GradientUtils.cpp index 429104739c70..a83b5f6f173f 100644 --- a/enzyme/Enzyme/GradientUtils.cpp +++ b/enzyme/Enzyme/GradientUtils.cpp @@ -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(TmpOrig)) - if (Function *originCall = getFunctionFromCall(CI)) - funcName = originCall->getName(); - if (isa(TmpOrig) || - (isa(TmpOrig) && - hasMetadata(cast(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