Right now we add extra autodiff wrappers. That works good enough to test if tt are correct, and to debug things where enzyme fails on IR inside the function being differentiated. For some cases like rsmpi Enzyme will however also analyzes which arguments are passed into the function being differentiated and our ENZYME_OPT wrappers loose this information.
We should therefore drop the artificial wrappers and add enzyme_autodiff calls to the same location where we would otherwise add the differentiated functions if we would have used enzyme as a library.
The issue here are our ABI wrappers, which analyze the function that we get back from Enzyme, not sure how much trouble that will cause.
Right now we add extra autodiff wrappers. That works good enough to test if tt are correct, and to debug things where enzyme fails on IR inside the function being differentiated. For some cases like rsmpi Enzyme will however also analyzes which arguments are passed into the function being differentiated and our ENZYME_OPT wrappers loose this information. We should therefore drop the artificial wrappers and add enzyme_autodiff calls to the same location where we would otherwise add the differentiated functions if we would have used enzyme as a library. The issue here are our ABI wrappers, which analyze the function that we get back from Enzyme, not sure how much trouble that will cause.