You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define a macro that defines the Enzyme rules for a given function based on the ChainRules. For example, @ruletransfer conv(x)
@ruletransfer conv(x) would define an EnzymeRule that naively calls a ChainRules.jl rule for all of the activity types. This would then serve as a suboptimal fallback that can be applied on a single function basis. The purpose of this macro would be to make it easier to setup the adoption of Zygote throughout the deep learning community by allowing any Zygote rule to trivially port to Enzyme, making Enzyme at least as good as Zygote as quickly as possible. The reason to do it on a function by function basis is that not all rules are necessary, with the main ones being the ones over cudnn kernels. They should of course be replaced with lower level rules that more optimize memory usage as needed, but I think such a simple macro would be a great first step.
This means the rule transfer can be pretty naïve. It could just call the ChainRule and then realout .= chainrulesout , i.e. many ChainRules rules will allocate the output while Enzyme can in theory omit the extra allocation, but for the macro it can ignore such optimizations and just ensure it hits coverage first.
The text was updated successfully, but these errors were encountered:
As mentioned in EnzymeAD/Enzyme.jl#805 (comment)
@ruletransfer conv(x)
would define an EnzymeRule that naively calls a ChainRules.jl rule for all of the activity types. This would then serve as a suboptimal fallback that can be applied on a single function basis. The purpose of this macro would be to make it easier to setup the adoption of Zygote throughout the deep learning community by allowing any Zygote rule to trivially port to Enzyme, making Enzyme at least as good as Zygote as quickly as possible. The reason to do it on a function by function basis is that not all rules are necessary, with the main ones being the ones over cudnn kernels. They should of course be replaced with lower level rules that more optimize memory usage as needed, but I think such a simple macro would be a great first step.This means the rule transfer can be pretty naïve. It could just call the ChainRule and then
realout .= chainrulesout
, i.e. many ChainRules rules will allocate the output while Enzyme can in theory omit the extra allocation, but for the macro it can ignore such optimizations and just ensure it hits coverage first.The text was updated successfully, but these errors were encountered: