-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Allow LLVM plugins in swift driver #38017
base: main
Are you sure you want to change the base?
Conversation
ping |
@lhames any hopes of this getting reviewed/merged? |
@wsmoses I'm not the right person to review this, but I'll ask around for you. Could you elaborate on what you want to do with the plugin? Whatever the motivation, the plugin machinery should probably be added to the new Swift driver, as the C++ swift driver is in maintenance mode. |
Sure, the goal here is to enable usage of Enzyme -- a tool for performing automatic differentiation of LLVM (and present incubator project, which at one point we should talk with the community about transitioning). It has been adopted in a variety of places including to much success in C++, Julia, etc. In addition to taking some of the autodiff burden off of swift, performing AD in the compiler enables significant performance gains (https://dl.acm.org/doi/abs/10.1145/3458817.3476165). Some folks have experimented using it within swift (https://medium.com/passivelogic/using-enzyme-autodiff-with-swift-afa1bc2dc102) and found a 477x improvement over native swift autodiff (admittedly for a very small test code). Doing so required some makefile hacking from the LLVM output, and adding plugin support would be nice to enable Enzyme to work with swift more nicely. That said the Rust compiler as an example has chosen to include Enzyme directly as an llvm subproject (rust-lang/compiler-team#611), so that may also be a good option as well, if the Swift compiler devs would be receptive. |
Sounds very cool. @benlangmuir Just pointed out that an LLVM plugin would need to be loaded in the frontend process, not the driver, so making this accessible with a Your patch just includes the LLVM PluginLoader header though. How were you invoking the plugin loading? With a |
Yes, this is how we ran our tests: |
This PR enables the Swift Driver to load LLVM plugins, such as the Enzyme high-performance automatic differentiation toolkit (https://github.com/wsmoses/Enzyme).