@@ -206,18 +206,38 @@ _gradient(x...) = Yota.grad(x...)[2]
206
206
t8 = time ()
207
207
using LoopVectorization
208
208
209
- if false # isdefined(LoopVectorization, :Vec)
210
- @testset " LoopVectorization onlyone" begin
211
- using LoopVectorization: Mask, Vec
212
- ms = Mask {UInt8} (0x03 ) # Mask{8,Bool}<1, 1, 0, 0, 0, 0, 0, 0>
213
- sv = Vec {4,Int} (1 ,2 ,3 ,4 ) # SVec{4,Int64}<1, 2, 3, 4>
214
-
215
- @test Tullio. onlyone (ms, 0 ) == Mask {UInt8} (0x02 )
216
- @test Tullio. onlyone (ms, sv) == Mask {UInt8} (0x00 )
217
- @test Tullio. onlyone (ms, zero (sv)) == Mask {UInt8} (0x02 )
218
- end
209
+ if isdefined (LoopVectorization, :SVec ) # version 0.8, for Julia ⩽1.5
210
+ using LoopVectorization. VectorizationBase: SVec, Mask
211
+ else # version 0.9, supports Julia 1.6
212
+ using LoopVectorization. VectorizationBase: Vec, Mask
213
+ SVec{N,T} = Vec{N,T}
219
214
end
220
215
216
+ @testset " LoopVectorization onlyone" begin
217
+ ms = Mask {UInt8} (0x03 ); # Mask{8,Bool}<1, 1, 0, 0, 0, 0, 0, 0>
218
+ sv = SVec {4,Int} (1 ,2 ,3 ,4 ) # SVec{4,Int64}<1, 2, 3, 4>
219
+
220
+ # preliminaries:
221
+ @test Tullio. allzero (sv) === false
222
+ @test Tullio. allzero (zero (sv)) === true
223
+
224
+ @test Tullio. anyone (ms) === true
225
+
226
+ # the main function:
227
+ @test Tullio. onlyone (false , 0 ) === false
228
+ @test Tullio. onlyone (true , 0 ) === true
229
+ @test Tullio. onlyone (true , 1 ) === false
230
+
231
+ # @test Tullio.onlyone(ms, 0) === Mask{UInt8}(0x02)
232
+ @test Tullio. onlyone (ms, 0 ). u == 0x02
233
+ # @test Tullio.onlyone(ms, sv) === Mask{UInt8}(0x00)
234
+ @test Tullio. onlyone (ms, sv). u == 0x00
235
+ # @test Tullio.onlyone(ms, zero(sv)) === Mask{UInt8}(0x02)
236
+ @test Tullio. onlyone (ms, zero (sv)). u == 0x02
237
+ end
238
+
239
+ @testset " parsing + LoopVectorization" begin include (" parsing.jl" ) end
240
+
221
241
using Tracker
222
242
GRAD = :Tracker
223
243
_gradient (x... ) = Tracker. gradient (x... )
@@ -228,8 +248,6 @@ _gradient(x...) = Tracker.gradient(x...)
228
248
@tullio grad= Dual
229
249
@testset " gradients: Tracker + ForwardDiff + LoopVectorization" begin include (" gradients.jl" ) end
230
250
231
- @testset " parsing + LoopVectorization" begin include (" parsing.jl" ) end
232
-
233
251
@info @sprintf (" LoopVectorization tests took %.1f seconds" , time ()- t8)
234
252
235
253
@tullio avx= false
0 commit comments