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
{{ message }}
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Are all those definitions needed here? e.g. swish(x) = x * σ(x) won't work out of the box? (assuming it is defined like that in NNlib. If not, it should)
Yes, if you remove @cufunc of swish, you will see warnings
┌ Warning: calls to Base intrinsics might be GPU incompatible
│ exception =
│ You called exp(x::T) where T<:Union{Float32, Float64} in Base.Math at special/exp.jl:75, maybe you intended to call exp(x::Float64) in CUDAnative at /root/.julia/packages/CUDAnative/hwB4d/src/device/cuda/math.jl:100 instead?
│ Stacktrace:
│ [1] exp at special/exp.jl:75
│ [2] #28 at /root/.julia/packages/GPUArrays/GLRnH/src/host/broadcast.jl:64
└ @ CUDAnative ~/.julia/packages/CUDAnative/hwB4d/src/compiler/irgen.jl:113
┌ Warning: calls to Base intrinsics might be GPU incompatible
│ exception =
│ You called exp(x::T) where T<:Union{Float32, Float64} in Base.Math at special/exp.jl:75, maybe you intended to call exp(x::Float64) in CUDAnative at /root/.julia/packages/CUDAnative/hwB4d/src/device/cuda/math.jl:100 instead?
│ Stacktrace:
│ [1] exp at special/exp.jl:75
│ [2] #28 at /root/.julia/packages/GPUArrays/GLRnH/src/host/broadcast.jl:64
└ @ CUDAnative ~/.julia/packages/CUDAnative/hwB4d/src/compiler/irgen.jl:113
I added all the activation functions in NNlib to test first and checked GPU compatibility by running tests with a blank "nnlib.jl", so unnecessary wrappers are not included. I guess if exp or tanh is used in a definition, we need to define its wrapper.
Then I will remove wrappers for σ, elu, swith, selu and celu. The implementation of exp seems to work fine, but if log1p or tanh is used, a wrapper is still needed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #614. I found some of activation functions recently added to NNlib are imcompatible with GPU, so I defined
@cufunc
wrappers for them. I also updated the existing definitions to make them consistent with NNlib (https://github.com/FluxML/NNlib.jl/blob/master/src/activation.jl).I skipped
rrelu
becauserand
is used within its definitionhttps://github.com/FluxML/NNlib.jl/blob/ac5101b2f4b4afc8cc01968e5c8dadaa0eaa862a/src/activation.jl#L92-L95 and couldn't figure out how it can be handled.