Skip to content

Commit 7e8081b

Browse files
committed
remove cufunc hack
1 parent 0180656 commit 7e8081b

File tree

3 files changed

+2
-76
lines changed

3 files changed

+2
-76
lines changed

src/cubroadcast.jl

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,2 @@
1-
# This should probably be its own package
2-
3-
_cufunc(f,x) = f
4-
_cufunc(f,x,xs...) = _cufunc(f, xs...)
5-
6-
using MacroTools
7-
8-
isbcastop(x) = isexpr(x, :call) && x.args[1] in :[.*,./,.+,.-].args
9-
10-
broadcast_inputs(ex) =
11-
ex isa Symbol ? [ex] :
12-
@capture(ex, f_.(args__)) ? vcat(broadcast_inputs.(args)...) :
13-
isbcastop(ex) ? vcat(broadcast_inputs.(ex.args[2:end])...) :
14-
[]
15-
16-
cudata(x) = x
17-
18-
"""
19-
Replace function calls with cuda intrinsics when applicable.
20-
21-
@see CuArrays.cufunc
22-
"""
23-
macro fix(ex)
24-
fs = []
25-
ex = MacroTools.prewalk(ex) do ex
26-
@capture(ex, f_.(args__)) || return ex
27-
# May not work in cases like `x .+ log(1.0)` but w/e
28-
xs = broadcast_inputs(ex)
29-
f_ = gensym()
30-
push!(fs, :($f_ = $_cufunc($f, $cudata.(($(xs...),))...)))
31-
:($f_.($(args...)))
32-
end
33-
34-
quote
35-
let $(fs...)
36-
$ex
37-
end
38-
end |> esc
39-
end
1+
# Kept only for backwards compatibility
2+
macro @fix(ex) esc(ex) end

test/cubroadcast.jl

Lines changed: 0 additions & 34 deletions
This file was deleted.

test/runtests.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ using NNlib, Test
44

55
include("activation.jl")
66
include("conv.jl")
7-
# if Base.find_in_path("CuArrays") ≠ nothing
8-
# include("cubroadcast.jl")
9-
# end
107

118
xs = [-100_000, -100_000.]
129
@test softmax(xs) [0.5, 0.5]

0 commit comments

Comments
 (0)