-
Notifications
You must be signed in to change notification settings - Fork 4
Add documentation #6
Comments
@ZuseZ4 - this sounds indeed like a significant limitation. Can you share a little background about this? What would it take to get this enabled? I'd assume some substantial changes to cargo, right? |
Sure @strasdat So our main issue is that the cargo team discussed post-build.rs scripts, which would run after the compilation. They rejected them, because they did want to keep cargo focused and not turn it into a full cmake alternative. It seemed very unlikely to me, that they are going to reconsider that just for this project. So all we have are build.rs files, which will run before compilation. That's unfortunate for us, since Enzyme requires llvm-bc or llvm-ir files which are just generated towards the end RUSTFLAGS="--emit=llvm-bc" cargo +enzyme -Z build-std rustc --target x86_64-unknown-linux-gnu -- --emit=llvm-bc -g -C opt-level=3 -Zno-link followed by RUSTFLAGS="--emit=llvm-bc" cargo +enzyme -Z build-std rustc --target x86_64-unknown-linux-gnu -- --emit=llvm-bc -g -C opt-level=3 Notice the -Zno-link in the first run. This is necessary, since Enzyme didn't had a chance to create the functions yet. Not using no-link would result in compilation failure, since cargo would be missing the definition for those functions. Inside of my library I'm doing some simple checks to see whether this is the first, or the second compilation run. If it's the first run I just return from my build script and let cargo do it's compilation. If it is the second compilation run, Some alternatives we considered (and dropped) include:
If you happen to know a better alternative to this setup I'd be happy to switch. |
To manage expectations, we should document what is expected to work already, what we will possibly fix and what is probably
not going to work till we have finished a better Enzyme integration. All issues should be solved in the next iteration.
This overview should be moved into a real documentation..
Not Working, unlikely to be fixed:
f32
parameters (f64
works andf32
values are allowed inside of the function).dyn trait
object anywhere.Likely to be fixed
the forward and reverse pass of ReverseAD. (Working on it).
If you use a pre-compiled version it might or might not work, Enzyme doesn't cover all functions yet.
Fixed
f64
parameter in the return struct.Workarounds:
dyn trait
issue, since it requires creating a new vTable. You might be lucky if that objectis not interacting with your active values, but that's not granted.
f32
tof64
values before passing them to the function and cast them back tof32
inside of your function..bc
bitcode files. Look up the build script on where to place them. You might run into some issues due to missing symbols when using other languages, let me know about your experiences.~/.cache/enzyme/rustc-<version>-src
, but that is probably too messy to set up and also requires looking at https://enzyme.mit.edu/getting_started/CUDAGuide/The text was updated successfully, but these errors were encountered: