Skip to content

Commit 3732267

Browse files
authored
[rocFFT] Verify that the input array is not modified for out-of-place methods (#732)
1 parent 260a295 commit 3732267

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/rocarray/fft.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ function out_of_place(X::AbstractArray{T,N}) where {T <: Complex,N}
2020
p = plan_fft(dX)
2121
dY = p * dX
2222
@test isapprox(collect(dY), fftw_X; rtol=MYRTOL, atol=MYATOL)
23+
@test X collect(dX)
2324

25+
Y = collect(dY)
2426
pinv = plan_ifft(dY)
2527
dZ = pinv * dY
2628
@test isapprox(collect(dZ), X; rtol=MYRTOL, atol=MYATOL)
29+
@test Y collect(dY)
2730

2831
pinv2 = inv(p)
2932
dZ = pinv2 * dY
@@ -174,10 +177,12 @@ function out_of_place(X::AbstractArray{T,N}) where {T <: Real,N}
174177
dY = p * dX
175178
Y = collect(dY)
176179
@test isapprox(Y, fftw_X; rtol=MYRTOL, atol=MYATOL)
180+
@test X collect(dX)
177181

178182
pinv = plan_irfft(dY, size(X, 1))
179183
dZ = pinv * dY
180184
@test isapprox(collect(dZ), X; rtol=MYRTOL, atol=MYATOL)
185+
@test Y collect(dY)
181186

182187
pinv2 = inv(p)
183188
dZ = pinv2 * dY
@@ -195,10 +200,13 @@ function batched(X::AbstractArray{T,N},region) where {T <: Real,N}
195200
p = plan_rfft(dX, region)
196201
dY = p * dX
197202
@test isapprox(collect(dY), fftw_X; rtol=MYRTOL, atol=MYATOL)
203+
@test X collect(dX)
198204

205+
Y = collect(dY)
199206
pinv = plan_irfft(dY, size(X, region[1]), region)
200207
dZ = pinv * dY
201208
@test isapprox(collect(dZ), X; rtol=MYRTOL, atol=MYATOL)
209+
@test Y collect(dY)
202210
end
203211

204212
function fftwrapper(X::AbstractArray{T}) where {T <: Real}

0 commit comments

Comments
 (0)