Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #571 from JuliaGPU/tb/whitelist_hypot
Browse files Browse the repository at this point in the history
Whitelist hypot from method substitution warning.
  • Loading branch information
maleadt authored Feb 24, 2020
2 parents 4e362bb + 90ecde0 commit 6339ba4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compiler/irgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct MethodSubstitutionWarning <: Exception
end
Base.showerror(io::IO, err::MethodSubstitutionWarning) =
print(io, "You called $(err.original), maybe you intended to call $(err.substitute) instead?")
const method_substitution_whitelist = [:hypot]

function compile_method_instance(job::CompilerJob, method_instance::Core.MethodInstance, world)
function postprocess(ir)
Expand Down Expand Up @@ -102,7 +103,8 @@ function compile_method_instance(job::CompilerJob, method_instance::Core.MethodI
# FIXME: this might be too coarse
method = method_instance.def
if Base.moduleroot(method.module) == Base &&
isdefined(CUDAnative, method_instance.def.name)
isdefined(CUDAnative, method_instance.def.name) &&
!in(method_instance.def.name, method_substitution_whitelist)
substitute_function = getfield(CUDAnative, method.name)
tt = Tuple{method_instance.specTypes.parameters[2:end]...}
if hasmethod(substitute_function, tt)
Expand Down

0 comments on commit 6339ba4

Please sign in to comment.