Skip to content

Commit 4cea75c

Browse files
committed
fix: remove uses of NNPACK
1 parent 013aa51 commit 4cea75c

File tree

14 files changed

+3
-588
lines changed

14 files changed

+3
-588
lines changed

benchmark/perf_report.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ for rank in (2,),
3737
(NNlib.depthwiseconv_im2col!, NNlib.∇depthwiseconv_data_im2col!, NNlib.∇depthwiseconv_filter_im2col!, DepthwiseConvDims, "im2col"),
3838
]
3939

40-
if NNlib.is_nnpack_available()
41-
push!(benchmark_items, (NNlib.conv_nnpack!, NNlib.∇conv_data_nnpack!, NNlib.∇conv_filter_nnpack!, DenseConvDims, "nnpack"))
42-
end
43-
4440
for (conv!, ∇conv_data!, ∇conv_filter!, cT, backend) in benchmark_items
4541

4642
x = zeros(Float32, repeat([N], rank)..., C_in, 1)
@@ -105,15 +101,4 @@ for rank in (2,),
105101
@show(pdims)
106102
@save "results.jld2" results
107103
end
108-
109-
if NNlib.is_nnpack_available()
110-
if NNlib.nnpack_supported_operation(pdims)
111-
t_fwd = @benchmark NNlib.maxpool_nnpack!($y, $x, $pdims)
112-
113-
add_result(t_fwd, "maxpool2d", "nnpack", pdims)
114-
115-
@show(pdims)
116-
@save "results.jld2" results
117-
end
118-
end
119104
end

src/NNlib.jl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ const Numeric = Union{AbstractArray{<:T}, T} where {T<:Number}
2424
include("dim_helpers.jl")
2525
export ConvDims, DenseConvDims, PoolDims, DepthwiseConvDims
2626

27-
is_nnpack_available() = false
28-
29-
@init @require NNPACK_jll="a6bfbf70-4841-5cb9-aa18-3a8ad3c413ee" begin
30-
if isdefined(NNPACK_jll, :libnnpack)
31-
include("nnpack/NNPACK.jl")
32-
else
33-
@warn "NNPACK not available for your platform: " *
34-
"$( Pkg.BinaryPlatforms.platform_name(Pkg.BinaryPlatforms.platform_key_abi()))" *
35-
"($( Pkg.BinaryPlatforms.triplet(Pkg.BinaryPlatforms.platform_key_abi())))
36-
You will be able to use only the default Julia NNlib backend"
37-
end
38-
end
39-
4027
include("activations.jl")
4128
for f in ACTIVATIONS
4229
@eval export $(f)

src/conv.jl

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ end
7676
# Let's generate auto-allocating versions of all our functions, for all backends.
7777
# We `@timeit` these methods separately, as we want to know how much time is spent in
7878
# allocation. :P
79-
for backend in (Symbol(), :_direct, :_im2col, :_nnpack)
79+
for backend in (Symbol(), :_direct, :_im2col)
8080
# First make auto-allocating versions of the conv()-like calls:
8181
for name in (:conv, :depthwiseconv)
8282
@eval begin
@@ -134,7 +134,7 @@ end
134134
# since we can specialize on sizes.
135135
for front_name in (:conv, :∇conv_data, :∇conv_filter,
136136
:depthwiseconv, :∇depthwiseconv_data, :∇depthwiseconv_filter)
137-
for backend in (Symbol(), :_direct, :_im2col) ## NNPACK is only for 2d conv
137+
for backend in (Symbol(), :_direct, :_im2col)
138138
for N in (3, 4)
139139
@eval begin
140140
function $(Symbol("$(front_name)$(backend)!"))(
@@ -381,26 +381,3 @@ function rrule(::typeof(∇conv_filter), x, dy, cdims; kw...)
381381
end
382382
return ∇conv_filter(x, dy, cdims; kw...), ∇conv_filter_pullback
383383
end
384-
385-
# Use NNPACK if it is available and the operation is supported
386-
# commented out 'till proper benchmarking and more correctness test are performed
387-
# if is_nnpack_available()
388-
# function conv(x::Array{Float32, 4}, w::Array{Float32, 4},
389-
# cdims::DenseConvDims{2, K, C_in, C_out, (1, 1), P, (1, 1), F};
390-
# kwargs...) where {K, C_in, C_out, P, F}
391-
# return conv_nnpack(x, w, cdims; kwargs...)
392-
# end
393-
394-
# function ∇conv_data(dy::Array{Float32, 4}, w::Array{Float32, 4},
395-
# cdims::DenseConvDims{2, K, C_in, C_out, (1, 1), P, (1, 1), F};
396-
# kwargs...) where {K, C_in, C_out, P, F}
397-
# return ∇conv_data_nnpack(dy, w, cdims; kwargs...)
398-
# end
399-
400-
# function ∇conv_filter(x::Array{Float32, 4}, dy::Array{Float32, 4},
401-
# cdims::DenseConvDims{2, K, C_in, C_out, (1, 1), P, (1, 1), F};
402-
# kwargs...) where {K, C_in, C_out, P, F}
403-
# return ∇conv_filter_nnpack(x, dy, cdims; kwargs...)
404-
# end
405-
# end
406-
########################################################

src/nnpack/NNPACK.jl

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

src/nnpack/error.jl

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

src/nnpack/impl.jl

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

src/nnpack/interface.jl

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

0 commit comments

Comments
 (0)