Skip to content

Commit

Permalink
Temporarily mark the 2D brfft inference test as broken (#28)
Browse files Browse the repository at this point in the history
* Temporarily mark the 2D brfft inference test as broken

* Also mark 2D plan_bfft inference test as broken

* Mark more inference tests as broken

* Replace uses of ANY

* Fully switch to where syntax
  • Loading branch information
ararslan authored Aug 1, 2017
1 parent 070cd89 commit 9d57158
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/fft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ size(a::FakeArray) = a.sz
strides(a::FakeArray) = a.st
unsafe_convert(::Type{Ptr{T}}, a::FakeArray{T}) where {T} = convert(Ptr{T}, C_NULL)
pointer(a::FakeArray{T}) where {T} = convert(Ptr{T}, C_NULL)
FakeArray{T,N}(::Type{T}, sz::NTuple{N,Int}) = FakeArray{T,N}(sz, colmajorstrides(sz))
FakeArray{T}(::Type{T}, sz::Int...) = FakeArray(T, sz)
FakeArray(::Type{T}, sz::NTuple{N,Int}) where {T,N} = FakeArray{T,N}(sz, colmajorstrides(sz))
FakeArray(::Type{T}, sz::Int...) where {T} = FakeArray(T, sz)
fakesimilar(flags, X, T) = flags & ESTIMATE != 0 ? FakeArray(T, size(X)) : Array{T}(size(X))
alignment_of(A::FakeArray) = Int32(0)

Expand Down Expand Up @@ -209,9 +209,9 @@ if libfftw_name == "libmkl_rt"
alignment_of(A::StridedArray{<:fftwSingle}) =
convert(Int32, convert(Int64, pointer(A)) % 16)
else
alignment_of{T<:fftwDouble}(A::StridedArray{T}) =
alignment_of(A::StridedArray{T}) where {T<:fftwDouble} =
ccall((:fftw_alignment_of, libfftw), Int32, (Ptr{T},), A)
alignment_of{T<:fftwSingle}(A::StridedArray{T}) =
alignment_of(A::StridedArray{T}) where {T<:fftwSingle} =
ccall((:fftwf_alignment_of, libfftwf), Int32, (Ptr{T},), A)
end

Expand Down Expand Up @@ -756,14 +756,14 @@ end
function plan_r2r(X::StridedArray{T,N}, kinds, region;
flags::Integer=ESTIMATE,
timelimit::Real=NO_TIMELIMIT) where {T<:fftwNumber,N}
r2rFFTWPlan{T,ANY,false,N}(X, fakesimilar(flags, X, T), region, kinds,
r2rFFTWPlan{T,Any,false,N}(X, fakesimilar(flags, X, T), region, kinds,
flags, timelimit)
end

function plan_r2r!(X::StridedArray{T,N}, kinds, region;
flags::Integer=ESTIMATE,
timelimit::Real=NO_TIMELIMIT) where {T<:fftwNumber,N}
r2rFFTWPlan{T,ANY,true,N}(X, X, region, kinds, flags, timelimit)
r2rFFTWPlan{T,Any,true,N}(X, X, region, kinds, flags, timelimit)
end

# mapping from r2r kind to the corresponding inverse transform
Expand All @@ -788,7 +788,7 @@ function plan_inv(p::r2rFFTWPlan{T,K,inplace,N}) where {T<:fftwNumber,K,inplace,
X = Array{T}(p.sz)
iK = fix_kinds(p.region, [inv_kind[k] for k in K])
Y = inplace ? X : fakesimilar(p.flags, X, T)
ScaledPlan(r2rFFTWPlan{T,ANY,inplace,N}(X, Y, p.region, iK,
ScaledPlan(r2rFFTWPlan{T,Any,inplace,N}(X, Y, p.region, iK,
p.flags, NO_TIMELIMIT),
normalization(real(T),
map(logical_size, [p.sz...][[p.region...]], iK),
Expand Down
19 changes: 16 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ for A in (Array,SubArray)
for f in (:fft,:ifft,:plan_fft,:plan_ifft)
f_ = Symbol(f, "_")
@eval begin
$f_{T,N}(x::$A{T,N}) = invoke($f, Tuple{AbstractArray{T,N}}, x)
$f_{T,N,R}(x::$A{T,N},r::R) = invoke($f,Tuple{AbstractArray{T,N},R},x,r)
$f_(x::$A{T,N}) where {T,N} = invoke($f, Tuple{AbstractArray{T,N}}, x)
$f_(x::$A{T,N},r::R) where {T,N,R} = invoke($f,Tuple{AbstractArray{T,N},R},x,r)
end
end
end
Expand Down Expand Up @@ -332,7 +332,14 @@ for x in (randn(10),randn(10,12))
z = complex(x)
y = rfft(x)
@inferred rfft(x)
@inferred brfft(x,18)

# See Julia issue #23063
if VERSION >= v"0.7.0-DEV.602" && ndims(x) == 2
@test_broken @inferred brfft(x,18)
else
@inferred brfft(x,18)
end

@inferred brfft(y,10)
for f in (plan_bfft!, plan_fft!, plan_ifft!,
plan_bfft, plan_fft, plan_ifft,
Expand All @@ -344,6 +351,12 @@ for x in (randn(10),randn(10,12))
end
for f in (plan_bfft, plan_fft, plan_ifft,
plan_rfft, fft, bfft, fft_, ifft)
# More of #23063 (why does plan_rfft work and the others don't)?
if VERSION >= v"0.7.0-DEV.602" && ndims(x) == 2 && f != plan_rfft
@test_broken @inferred f(x)
@test_broken @inferred plan_inv(f(x))
continue
end
p = @inferred f(x)
if isa(p, Plan)
@inferred plan_inv(p)
Expand Down

0 comments on commit 9d57158

Please sign in to comment.