-
Notifications
You must be signed in to change notification settings - Fork 108
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
C++ interface prototyping #1371
C++ interface prototyping #1371
Conversation
mind adding some example usage tests? also could we drop the hpp suffix? |
Sorry for putting this down for a couple weeks-- what sorts of examples would you like in this PR? I think most examples won't actually compile until the appropriate changes to the enzyme backend are in place, though. |
…hLLNL/Enzyme into mish2/cpp_interface_prototype
@wsmoses any idea how to address these undefined reference errors: https://fwd.gymni.ch/aptybv ? I don't know that it's possible (in conventional C++) to implement the variadic I also tried providing a trivial implementation of |
How about this: https://fwd.gymni.ch/pSZCir I think the std apply functions weren't being inlined at O0. Inspiration from https://en.cppreference.com/w/cpp/utility/apply and https://stackoverflow.com/questions/52449163/what-is-the-difference-between-stdinvoke-and-stdapply |
Implementing our own I'm still seeing an undefined reference when putting the undefined reference does go away when compiling with optimization. |
Some attempted improvements: https://fwd.gymni.ch/oSe4rO
…On Fri, Sep 15, 2023 at 3:22 PM samuelpmishLLNL ***@***.***> wrote:
How about this: https://fwd.gymni.ch/pSZCir
Implementing our own apply is a good idea (we're already implementing the
other parts of tuple).
------------------------------
I'm still seeing an undefined reference when putting apply inside a
function template though: https://fwd.gymni.ch/zijpaB
the undefined reference does go away when compiling with optimization.
—
Reply to this email directly, view it on GitHub
<#1371 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJTUXFRU2MNQLYXT6Q7X6TX2S2HJANCNFSM6AAAAAA3KN3MKE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@samuelpmishLLNL I fixed the autodiff function detector to do a primitive mem2reg and find more functions. However, we need to switch from std tuple to our tuple since otherwise the use of enzyme_dup ints are hidden behind non-inlined functions at O0 |
Implementing |
I took at stab at the tuple_cat implementation and sprinkled
Is there a way to figure out which part is not getting inlined? |
here's an updated compiler explorer link with a reproducer for the undefined reference error @ -O0: |
This https://fwd.gymni.ch/YzKLEy gets us closer. Specifically (1), we need enzyme_autodiff in the innermost level rather than being applied. (2), I propagated the function to differentiate explicitly/separately. However, now with the inlining complete (still progress) the enzyme_dup isn't being recognized since its an element of a struct needing to be sroa'd |
Superceeded by #1752 |
* Allow custom rule for constant arg/ret in rev mode * cse * Add differential use handler * fixup * fix * fix * fixup * fixup * fixup
this PR implements a basic tuple class and a sketch of some pieces for a C++ interface requested here: #1367 (comment)
Also, some other potential interface choices: