JuliaLinearAlgebra / AppleAccelerate.jl

Julia interface to the macOS Accelerate framework
Other
96 stars 18 forks source link

Improved @replaceBase method #23

Open rprechelt opened 8 years ago

rprechelt commented 8 years ago

As the number of functions that we support continues to grow, it seems like the current method of manually updating the hard-coded values in @replaceBase is not going to scale well, and is somewhat error prone; I've forgotten to update it twice when adding new functions.

I wanted to start a discussion about finding a more scalable/cleaner method of collecting the functions that we wish to support in @replaceBase. My first thought is a macro @register that we could wrap around any function definitions that we wish to make "replaceable", i.e.

@register .+ function vadd(X::Vector{T}, Y::Vector{T})
       ## definition of function
 end

This would store the Base function .+ and the Accelerate function vadd in a module-wide dictionary indexed by the Base function name. We could then use this in @replaceBase instead of the hardcoded values.

Does anyone see any issues with the above methodology, or has an alternative suggestion?