This is an artefact of split-mode CUDA compilation that we need to
mimic. HD functions are sometimes allowed to call H or D functions. Due
to split compilation mode device-side compilation will not see host-only
function and thus they will not be considered at all. For clang both H
and D variants will become function overloads visible to
compiler. Normally target attribute is considered only if C++ rules can
not determine which function is better. However in this case we need to
ignore functions that would not be present during current compilation
phase before we apply normal overload resolution rules.
Changes:
- introduced another level of call preference to better describe possible call combinations.
- removed WrongSide functions from consideration if the set contains SameSide function.
- disabled H->D and D->H and G->H calls. These combinations are not allowed by CUDA and we were reluctantly allowing them to work around device-side calls to math functions in std namespace. We no longer need it after r258880.
Why not merging CFP_SameSide and CFP_Native? You can conceptually treat HD as H in host mode or D in device mode. Then, it seems that we can just reuse CFP_Native to express the same meaning.