11using LoopVectorization, Test
2- # T = Float32
3-
4- macro outline (ex)
5- quote
6- (() -> begin
7- Base. @_noinline_meta
8- $ (esc (ex))
9- end )()
10- end
11- end
2+ T = Float32
123
134function test_broadcast (:: Type{T} ) where {T}
145 M, N = 37 , 47
@@ -22,35 +13,35 @@ function test_broadcast(::Type{T}) where {T}
2213
2314 br = reshape (b, (99 ,99 ));
2415 c1 = a .+ b;
25- c2 = @outline @ turbo a .+ bl;
16+ c2 = @turbo inline = false a .+ bl;
2617 @test c1 ≈ c2
27- fill! (c2, 99999 ); @outline @ turbo c2 .= a .+ br;
18+ fill! (c2, 99999 ); @turbo inline = false c2 .= a .+ br;
2819 @test c1 ≈ c2
29- fill! (c2, 99999 ); @outline @ turbo c2 .= a .+ b;
20+ fill! (c2, 99999 ); @turbo inline = false c2 .= a .+ b;
3021 @test c1 ≈ c2
3122 br = reshape (b, (99 ,1 ,99 ));
3223 bl = LowDimArray {(true,false,true)} (br);
3324 @test size (bl) == size (br)
3425 @test LoopVectorization. ArrayInterface. size (bl) === (size (br,1 ),LoopVectorization. StaticInt (1 ),size (br,3 ))
3526 @. c1 = a + br;
36- fill! (c2, 99999 ); @outline @ turbo @. c2 = a + bl;
27+ fill! (c2, 99999 ); @turbo inline = false @. c2 = a + bl;
3728 @test c1 ≈ c2
38- fill! (c2, 99999 ); @outline @ turbo @. c2 = a + br;
29+ fill! (c2, 99999 ); @turbo inline = false @. c2 = a + br;
3930 @test c1 ≈ c2
4031 br = reshape (b, (1 ,99 ,99 ));
4132 bl = LowDimArray {(false,)} (br);
4233 @test size (bl) == size (br)
4334 @test LoopVectorization. ArrayInterface. size (bl) === (LoopVectorization. StaticInt (1 ),size (br,2 ),size (br,3 ))
4435 @. c1 = a + br;
4536 fill! (c2, 99999 );
46- @test c1 ≈ @outline @ turbo @. c2 = a + bl
37+ @test c1 ≈ @turbo inline = false @. c2 = a + bl
4738 # @test c1 ≈ c2
4839 br = reshape (rand (R,99 ), (1 ,99 ,1 ));
4940 bl = LowDimArray {(false,)} (br);
5041 @test size (bl) == size (br)
5142 @. c1 = a + br;
5243 fill! (c2, 99999 );
53- @outline @ turbo @. c2 = a + bl;
44+ @turbo inline = false @. c2 = a + bl;
5445 @test c1 ≈ c2
5546
5647 if T <: Integer
@@ -59,76 +50,76 @@ function test_broadcast(::Type{T}) where {T}
5950 xs = rand (T, M);
6051 end
6152 max_ = maximum (xs, dims= 1 );
62- @test (@outline @ turbo exp .(xs .- LowDimArray {(false,)} (max_))) ≈ exp .(xs .- LowDimArray {(false,)} (max_))
53+ @test (@turbo inline = false exp .(xs .- LowDimArray {(false,)} (max_))) ≈ exp .(xs .- LowDimArray {(false,)} (max_))
6354 @test size (LowDimArray {(false,)} (max_)) == size (max_)
6455
6556 if T === Int32
6657 a = rand (T (1 ): T (100 ), 73 , 1 );
67- @test sqrt .(Float32 .(a)) ≈ @outline @ turbo sqrt .(a)
58+ @test sqrt .(Float32 .(a)) ≈ @turbo inline = false sqrt .(a)
6859 elseif T === Int64
6960 a = rand (T (1 ): T (100 ), 73 , 1 );
70- @test sqrt .(a) ≈ @outline @ tturbo sqrt .(a)
61+ @test sqrt .(a) ≈ @tturbo inline = false sqrt .(a)
7162 else
7263 a = rand (T, 73 , 1 );
73- @test sqrt .(a) ≈ @outline @ turbo sqrt .(a)
64+ @test sqrt .(a) ≈ @turbo inline = false sqrt .(a)
7465 end
7566
7667 a = rand (R, M); B = rand (R, M, N); c = rand (R, N); c′ = c' ;
7768 d1 = @. a + B * c′;
78- d2 = @outline @ tturbo @. a + B * c′;
69+ d2 = @tturbo inline = false @. a + B * c′;
7970 @test d1 ≈ d2
8071
8172 @. d1 = a + B * c′;
82- @outline @ turbo @. d2 = a + B * c′;
73+ @turbo inline = false @. d2 = a + B * c′;
8374 @test d1 ≈ d2
8475
8576 d3 = a .+ B * c;
86- d4 = @outline @ turbo a .+ B * ˡ c;
77+ d4 = @turbo inline = false a .+ B * ˡ c;
8778 @test d3 ≈ d4
8879
8980 fill! (d3, - 1000.0 );
9081 fill! (d4, 91000.0 );
9182
9283 d3 .= a .+ B * c;
93- @outline @ turbo d4 .= a .+ B * ˡ c;
84+ @turbo inline = false d4 .= a .+ B * ˡ c;
9485 @test d3 ≈ d4
9586
9687 fill! (d4, 91000.0 );
97- @outline @ turbo @. d4 = a + B * ˡ c;
88+ @turbo inline = false @. d4 = a + B * ˡ c;
9889 @test d3 ≈ d4
9990
10091 M, K, N = 77 , 83 , 57 ;
10192 A = rand (R,M,K); B = rand (R,K,N); C = rand (R,M,N);
10293 At = copy (A' );
10394 D1 = C .+ A * B;
104- D2 = @outline @ tturbo C .+ A .* ˡ B;
95+ D2 = @tturbo inline = false C .+ A .* ˡ B;
10596 @test D1 ≈ D2
10697 if RUN_SLOW_TESTS
107- fill! (D2, - 999999 ); D2 = @outline @ turbo C .+ At' * ˡ B;
98+ fill! (D2, - 999999 ); D2 = @turbo inline = false C .+ At' * ˡ B;
10899 @test D1 ≈ D2
109- fill! (D2, - 999999 ); @test A * B ≈ (@outline @ turbo @. D2 = A * ˡ B)
100+ fill! (D2, - 999999 ); @test A * B ≈ (@turbo inline = false @. D2 = A * ˡ B)
110101 D1 .= view (C, 1 , :)' .+ A * B;
111102 fill! (D2, - 999999 );
112- @outline @ turbo D2 .= view (C, 1 , :)' .+ A .* ˡ B;
103+ @turbo inline = false D2 .= view (C, 1 , :)' .+ A .* ˡ B;
113104 @test D1 ≈ D2
114105 C3d = rand (R,3 ,M,N);
115106 D1 .= view (C3d, 1 , :, :) .+ A * B;
116107 fill! (D2, - 999999 );
117- @outline @ tturbo D2 .= view (C3d, 1 , :, :) .+ A .* ˡ B;
108+ @tturbo inline = false D2 .= view (C3d, 1 , :, :) .+ A .* ˡ B;
118109 @test D1 ≈ D2
119110 end
120111 D1 .= 9999 ;
121- @outline @ turbo D2 .= 9999 ;
112+ @turbo inline = false D2 .= 9999 ;
122113 @test D1 == D2
123114 D1 .= - 99999 ;
124- @outline @ tturbo D2' .= - 99999 ;
115+ @tturbo inline = false D2' .= - 99999 ;
125116 @test D1 == D2
126117
127118 b = rand (T,K); x = rand (R,N);
128119 D1 .= C .+ A * (b .+ x' );
129- @outline @ tturbo @. D2 = C + A * ˡ (b + x' );
120+ @tturbo inline = false @. D2 = C + A * ˡ (b + x' );
130121 @test D1 ≈ D2
131- D2 = @outline @ turbo @. C + A * ˡ (b + x' );
122+ D2 = @turbo inline = false @. C + A * ˡ (b + x' );
132123 @test D1 ≈ D2
133124 if T === Int64
134125 xd = rand (- 1_000_000_000_000 : 1_000_000_000_000 ,89 );
@@ -143,43 +134,43 @@ function test_broadcast(::Type{T}) where {T}
143134
144135 if T <: Union{Float32,Float64}
145136 D3 = cos .(B' );
146- D4 = @outline @ turbo cos .(B' );
137+ D4 = @turbo inline = false cos .(B' );
147138 @test D3 ≈ D4
148139
149140 fill! (D3, - 1e3 ); fill! (D4, 9e9 );
150141 Bt = transpose (B);
151142 @. D3 = exp (Bt);
152- @outline @ tturbo @. D4 = exp (Bt);
143+ @tturbo inline = false @. D4 = exp (Bt);
153144 @test D3 ≈ D4
154145
155146 D1 = similar (B); D2 = similar (B);
156147 D1t = transpose (D1);
157148 D2t = transpose (D2);
158149 @. D1t = exp (Bt);
159- @outline @ turbo @. D2t = exp (Bt);
150+ @turbo inline = false @. D2t = exp (Bt);
160151 @test D1t ≈ D2t
161152
162153 fill! (D1, - 1e3 );
163154 fill! (D2, 9e9 );
164155 @. D1' = exp (Bt);
165- lset = @outline @ tturbo @. D2' = exp (Bt);
156+ lset = @tturbo inline = false @. D2' = exp (Bt);
166157
167158 @test D1 ≈ D2
168159
169160 a = rand (137 );
170- b1 = @outline @ turbo @. 3 * a + sin (a) + sqrt (a);
161+ b1 = @turbo inline = false @. 3 * a + sin (a) + sqrt (a);
171162 b2 = @. 3 * a + sin (a) + sqrt (a);
172163 @test b1 ≈ b2
173164 three = 3 ; fill! (b1, - 9999 );
174- @outline @ tturbo @. b1 = three* a + sin (a) + sqrt (a);
165+ @tturbo inline = false @. b1 = three* a + sin (a) + sqrt (a);
175166 @test b1 ≈ b2
176167
177168 C = rand (100 ,10 ,10 );
178169 D1 = C .^ 0.3 ;
179- D2 = @outline @ tturbo C .^ 0.3 ;
170+ D2 = @tturbo inline = false C .^ 0.3 ;
180171 @test D1 ≈ D2
181172 @. D1 = C ^ 2 ;
182- @outline @ turbo @. D2 = C ^ 2 ;
173+ @turbo inline = false @. D2 = C ^ 2 ;
183174 @test D1 ≈ D2
184175 @turbo view (C,1 : 100 ,1 : 10 ,1 : 10 ) .= 0 ;
185176 @test all (== (0 ), C)
0 commit comments