-
Notifications
You must be signed in to change notification settings - Fork 9
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
Windows support #54
Comments
Thanks for the nice words! |
I tried for several hours to build Rust with Enzyme on Windows. There are some linker errors that are beyond my comprehension. I am likely doing something incorrectly. Errors
Steps to reproduce
Alternatives to MSVCOn Windows, it sounds like Rust uses LLVM for compilation and MSVC for linking. I tried to configure it as such in the steps above. LLVM appears to come with its own linker, "lld-link", that aims to be a drop-in replacement for the MSVC linker on Windows. It also comes with its own resource compiler, "llvm-rc". I tried these in place of the MSVC variants to no avail. All of this is beyond my familiarity. @ZuseZ4 Do any of these steps strike you as obviously incorrect? |
Thanks for the list of things you tried, it looks reasonable to me. I know that someone in the Enzyme core repo added a few cmake changes to support static Enzyme compilation, but I am not sure how rust and windows are supposed to work here. |
@ZuseZ4 I hope you enjoy your travels! Thanks for your quick responses on this issue. Please let me know if there is anything I can do to help in the future (e.g., testing). I am also open to calling one-on-one. |
@ZuseZ4 Do you know why LLVM is configured to be linked statically ( |
Just to be sure, you meant to write windows, not linux in your last sentence, right? Lorenz and I tried a lot of different settings in our different proof of concept implementations, I would just assume that it fixed an outdated bug and isn't needed then. I'll test it on the windows of a friend, great if the fix is that easy, thanks! |
I did mean Linux. I built on Linux without |
I presume the shared library is a holdover from when enzyme was linked in
via shared library.
If it works without it the rust build state should be put back to its
default
…On Sat, Jan 6, 2024 at 7:36 PM Owen Troke-Billard ***@***.***> wrote:
I did mean Linux. I built on Linux without --enable-llvm-link-shared to
make sure that flag is not required. I am still working on the Windows
build.
—
Reply to this email directly, view it on GitHub
<#54 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJTUXBJDI2R7IMO7X5SCN3YNHUYHAVCNFSM6AAAAAA5HF6XTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZHA4TIOJWHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Enzyme is not configured to be built with Clang + MSVC. It can be built with Clang + MinGW (see EnzymeAD/Enzyme#1449), and I believe this is how Enzyme.jl works on Windows. I see a few options for proceeding:
I am trying to get Enzyme to build with Clang + MSVC. Please let me know if this approach is not possible or desirable. As an aside, please ignore my claim about |
Rust does support Windows via MSVC, right? I guess in this case 1) is the best path forward, so it would be great if you find a way to get this to work. @wsmoses Do you know any blockers from the llvm side? |
Looks like a CMake issue on windows. I don't have a windows machine to reproduce/debug, but I don't see any blockers besides someone finding a machine to test and fix cmake on. |
@wsmoses @ZuseZ4 Here is a log containing the errors that arise when attempting to build Rust with Enzyme on Windows, as you requested: log-2024-01-19.txt. No action is required on your part. |
Did you manage to solve the problem? the exact problem for me. I tried Visual Studio 2019 too, but the same result.
and the 1st series of errors gone (those in your log file), but another error appeared:
I guess I need to add some keywords to the compiler like _ALLOW_KEYWORD_MACROS, but I do not know how. |
Windows support is a work in progress. See EnzymeAD/Enzyme#1607. The main blocker is llvm/llvm-project#83052 AFAIK. @ZuseZ4 is that right? |
Yes, it's Enzyme doing some prohibited c++ hacks. Unfortunately the PR author got busy lately and someone raised some last minute concerns due to which the PR can't directly be merged. I had intentions to fix it at some point, but lately instead had to work on some other Enzyme internal bug. I therefore might merge a first Rust-AD version with Linux/Mac support only, just because it's a lot of effort to maintain this fork out-of-tree, and will then just update the Enzyme submodule, once either Billy, I, or someone else later had time to fix this. |
@ZuseZ4 I think merging Linux & Mac support first is an excellent idea. A significant benefit, on top of those you mentioned, is that Enzyme can begin gaining adoption sooner. Windows folks can also use WSL in the interim. |
@OwenTrokeBillard Just to be sure, did you (or anyone else here) use WSL for Rust-Enzyme successfully in the past? I think it should work, but it would be nice to have some confirmation. |
No. And I since switched to Linux because the Rust compile times are significantly faster. Hopefully someone else can try. |
@KhaledHosseini Can you try building with WSL? That might solve your issue and give @ZuseZ4 some valuable feedback. |
The problem is specifically the Microsoft c++ compiler iirc, it should be
successful with say clang or cygwin on windows
…On Sun, May 19, 2024 at 8:41 PM Owen Troke-Billard ***@***.***> wrote:
Just to be sure, did you (or anyone else here) use WSL for Rust-Enzyme
successfully?
No. And I since switched to Linux because the Rust compile times are
significantly faster. Hopefully someone else can try.
—
Reply to this email directly, view it on GitHub
<#54 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJTUXCDE424KUQIMAUF7KLZDFIDRAVCNFSM6AAAAAA5HF6XTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGUZDAMRXGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sure. I'll try and tell you the results. |
I tried MSYS2 without success. I'm not sure if I did all the steps right or even it has anything to do with Enzyme. Here are my exact step-by-step commands on MSYS2 terminal:
the error is
the log file is included. EDIT: This error in line 1249 of bootstrap\src\core\config\config.rs has been fixed in the original Rust repo. Is it possible to sync the fork with the original Rust repo? |
@ZuseZ4 Is the I am able to build Rust + Enzyme in WSL but running the first forward mode example produces incorrect results:
|
That usually means you don't use fat-lto in your Cargo.toml, can you check that? I meant to abort compilation, but for some reason my check doesn't always trigger. |
Rust + Enzyme does work in WSL after enabling fat LTO. Amazing work @ZuseZ4 🎉 |
Thank you for all your excellent work. Rust has a bright future with Enzyme for automatic differentiation.
Does Enzyme for Rust support Windows, or is Windows support planned?
The text was updated successfully, but these errors were encountered: