-
Notifications
You must be signed in to change notification settings - Fork 99
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
Easier Clang Integration, Type Analysis Updates, & Primitive Cuda support #75
Conversation
5135043
to
192c734
Compare
1b761f2
to
2217437
Compare
void HandleAutoDiff(CallInst *CI, TargetLibraryInfo &TLI, AAResults &AA) { | ||
llvm::cl::opt<bool> | ||
EnzymePostOpt("enzmye-postopt", cl::init(false), cl::Hidden, | ||
cl::desc("Run enzymepostprocessing optimizations")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cl::desc("Run enzymepostprocessing optimizations")); | |
cl::desc("Run enzyme postprocessing optimizations")); |
enzyme/Enzyme/Enzyme.cpp
Outdated
++i; | ||
res = CI->getArgOperand(i); | ||
} else if (MS == "enzyme_out") { | ||
llvm::errs() << "saw metadata for diffe_out\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these LLVM_DEBUG
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
GVN().run(*NewF, AM); | ||
SROA().run(*NewF, AM); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#endif | |
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -692,18 +684,15 @@ void optimizeIntermediate(GradientUtils *gutils, bool topLevel, Function *F) { | |||
|
|||
// TODO function attributes | |||
// PostOrderFunctionAttrsPass().run(*F, AM); | |||
#if LLVM_VERSION_MAJOR <= 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if LLVM_VERSION_MAJOR <= 7 | |
#if LLVM_VERSION_MAJOR <= 7 |
InstSimplifyPass().run(*F, AM); | ||
#endif | ||
CorrelatedValuePropagationPass().run(*F, AM); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#endif | |
#endif |
llvm_unreachable("unhandled atomic add"); | ||
} | ||
} else { | ||
#if LLVM_VERSION_MAJOR >= 9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if LLVM_VERSION_MAJOR >= 9 | |
#if LLVM_VERSION_MAJOR >= 9 |
enzyme/Enzyme/GradientUtils.h
Outdated
#if LLVM_VERSION_MAJOR >= 9 | ||
AtomicRMWInst::BinOp op = AtomicRMWInst::FAdd; | ||
AtomicRMWInst* rmw = BuilderM.CreateAtomicRMW (op, ptr, dif, AtomicOrdering::Monotonic, SyncScope::System); | ||
#if LLVM_VERSION_MAJOR >= 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if LLVM_VERSION_MAJOR >= 11 | |
#if LLVM_VERSION_MAJOR >= 11 |
This introduces a ClangEnzyme.so for loading directly into clang (necessary for ease of use with GPU backend). Introduces primitive support for PTX backend among various type and activity analysis updates. Also fixes pre and post Enzyme optimizations to work across various LLVM versions