Skip to content
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

no_std support #189

Open
mert-kurttutan opened this issue Nov 29, 2024 · 7 comments
Open

no_std support #189

mert-kurttutan opened this issue Nov 29, 2024 · 7 comments

Comments

@mert-kurttutan
Copy link

I know it might be too early.
What is current status for no_std support?
It will potentially be more important for cpu-based workloads.

@ZuseZ4
Copy link
Member

ZuseZ4 commented Dec 2, 2024

I think it should just work, Enzyme works on another level and won't include any std functionality if you don't use it.
At least a while ago I also knew another user who verified that, so please let me know if you encounter issues with it.

@jedbrown
Copy link

jedbrown commented Dec 3, 2024

I think it'll be an issue if allocation is needed. We should eventually expose a pre-allocated tape as can be done using C-Enzyme.

@ZuseZ4
Copy link
Member

ZuseZ4 commented Dec 3, 2024

https://doc.rust-lang.org/alloc/
Afaik alloc is available through core even when no_std is used?

@wsmoses
Copy link
Member

wsmoses commented Dec 3, 2024

Unless you registered a custom allocator, Enzyme will use malloc and free for things

@ZuseZ4
Copy link
Member

ZuseZ4 commented Dec 3, 2024

Yes, but luckily Rust stopped shipping it's own allocator a long time ago, so they should match behaviour.
I just wanted to clarify that I think people won't be surprised if allocations happen in no-std code, let it be Enzyme or normal code.
I'd be open to accept a PR to have custom-alloc / tape support, but I have more important bugs to fix first (like autodiff sometimes not running), so I don't think I'll have time for this in the near future myself.

@mert-kurttutan
Copy link
Author

mert-kurttutan commented Dec 3, 2024

I can have a look at this, no promise though.
Any link to a developer guide would be great

@ZuseZ4
Copy link
Member

ZuseZ4 commented Dec 5, 2024

Unfortunately there is no developer guide for Enzyme core, and I don't have the knowledge to write one.
The Rust PRs are quite well documented (at least the part which got reviewed during upstreaming) and I'd write more docs once I understand how to register derivatives, but I think just experimenting won't be super efficient for you, unfortunately.
I hope to figure out at some point how to solve this issue: #190
From there on it should hopefully be easier to also support a custom allocator, assuming that is what you are interested in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants