Skip to content

Commit 83eed9b

Browse files
authored
Merge pull request #79 from mcabbott/avxci3
Debug a CI crash?
2 parents e95ad9d + 3134819 commit 83eed9b

File tree

8 files changed

+92
-61
lines changed

8 files changed

+92
-61
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- '1'
2727
- '6' # t>2 might be ignored on Julia <= 1.5
2828
version:
29-
- '1.4'
29+
- '1.5'
3030
- '1' # automatically expands to the latest stable 1.x release of Julia
3131
steps:
3232
- uses: actions/checkout@v2

Project.toml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
name = "Tullio"
22
uuid = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"
33
authors = ["Michael Abbott"]
4-
version = "0.2.14"
4+
version = "0.3.0"
55

66
[deps]
77
DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1010

1111
[compat]
12-
CUDA = "1, 2"
12+
CUDA = "2"
13+
CUDAKernels = "0.1"
1314
DiffRules = "1"
14-
FillArrays = "0.10"
15+
FillArrays = "0.10, 0.11"
1516
ForwardDiff = "0.10"
16-
KernelAbstractions = "0.5.2"
17-
LoopVectorization = "0.8.26, 0.9.20"
17+
KernelAbstractions = "0.6"
18+
LoopVectorization = "0.12.12"
1819
NamedDims = "0.2"
1920
OffsetArrays = "1"
2021
Requires = "1"
2122
TensorOperations = "3"
2223
Tracker = "0.2"
23-
VectorizationBase = "0.12.33, 0.15.7"
24-
Zygote = "0.6"
25-
julia = "1.3"
24+
VectorizationBase = "0.19.30"
25+
Zygote = "0.6.9"
26+
julia = "1.5"
2627

2728
[extras]
2829
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
30+
CUDAKernels = "72cfdca4-0801-4ab0-bf6a-d52aa10adc57"
2931
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
3032
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
3133
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
@@ -42,4 +44,4 @@ VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
4244
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
4345

4446
[targets]
45-
test = ["Test", "CUDA", "FillArrays", "ForwardDiff", "KernelAbstractions", "LinearAlgebra", "LoopVectorization", "NamedDims", "OffsetArrays", "Printf", "Random", "TensorOperations", "Tracker", "VectorizationBase", "Zygote"]
47+
test = ["Test", "CUDA", "CUDAKernels", "FillArrays", "ForwardDiff", "KernelAbstractions", "LinearAlgebra", "LoopVectorization", "NamedDims", "OffsetArrays", "Printf", "Random", "TensorOperations", "Tracker", "VectorizationBase", "Zygote"]

src/eval.jl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,13 @@ using Requires
5151

5252
@inline anyone(cond::Bool) = cond
5353

54+
#=
55+
5456
@init @require LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" begin
55-
using .LoopVectorization
56-
if isdefined(LoopVectorization, :SVec) # version 0.8, for Julia ⩽1.5
57-
using .LoopVectorization.VectorizationBase: SVec, Mask, prevpow2
58-
@require ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" begin
59-
# Dual numbers + svec, not needed on version 0.9
60-
include("grad/avxdual.jl")
61-
end
62-
else # version 0.9, supports Julia 1.6
63-
using .LoopVectorization.VectorizationBase: Vec, Mask, prevpow2
64-
SVec{N,T} = Vec{N,T}
57+
using .LoopVectorization # version 0.9+ only now
58+
using .LoopVectorization.VectorizationBase: Vec, Mask, prevpow2
59+
SVec{N,T} = Vec{N,T}
6560
end
66-
#=
6761
# Functions needed for safe vectorised max gradient
6862
@inline Tullio.onlyone(cond::Bool, seen::SVec) = cond && allzero(seen)
6963
@@ -75,9 +69,10 @@ using Requires
7569
@inline allzero(seen::SVec) = iszero((!iszero(seen)).u)
7670
7771
@inline Tullio.anyone(cond::Mask) = !iszero(cond.u)
78-
=#
7972
end
8073
74+
=#
75+
8176
#========== CuArrays ==========#
8277

8378
using Requires

test/cuda.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
using Tullio, Test
3-
using CUDA, KernelAbstractions
3+
using CUDA, CUDAKernels, KernelAbstractions
44
CUDA.allowscalar(false)
55
using Tracker, ForwardDiff
66
@tullio grad=Base

test/gradients.jl

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file is run several times
66
=#
77

88
using Tullio, Test, ForwardDiff, Random
9-
# using Tracker; _gradient(x...) = Tracker.gradient(x...); GRAD = :Tracker
9+
# using Tracker; _gradient(x...) = Tracker.gradient(x...); GRAD = :Tracker; macro printline() end
1010

1111
function gradtest(f, dims)
1212
x = randn(dims...)
@@ -16,8 +16,6 @@ end
1616

1717
@testset "simple" begin
1818

19-
if Tullio._GRAD[] != :Dual || VERSION >= v"1.5" # These 3 give errors on Julia 1.4, LV 0.8, I have no idea why.
20-
2119
@test _gradient(x -> sum(@tullio y[i] := 2*x[i]), rand(3))[1] == [2,2,2]
2220
@test _gradient(x -> sum(@tullio y[i] := 2*x[i] + i), rand(3))[1] == [2,2,2]
2321

@@ -32,7 +30,6 @@ if Tullio._GRAD[] != :Dual || VERSION >= v"1.5" # These 3 give errors on Julia 1
3230
g_fd = ForwardDiff.gradient(x -> sum(sin, g2(x)), r100)
3331
@test g_fd _gradient(x -> sum(sin, g2(x)), r100)[1]
3432

35-
end
3633
r100 = randn(100)
3734

3835
# scalar output
@@ -68,6 +65,9 @@ end
6865
@test abs2_grad _gradient(v -> (@tullio s := abs2(1 + v[i]^2)), va)[1]
6966

7067
end
68+
69+
@printline
70+
7171
@testset "zero-arrays" begin
7272

7373
# Using zero-dim arrays fails on ReverseDiff & Tracker
@@ -106,6 +106,9 @@ end
106106
# [1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 0.0, 64.0, 81.0, 100.0, 121.0] ≈ [1.0, 4.0, 9.0, 16.0, 25.0, 36.0, 49.0, 64.0, 81.0, 100.0, 121.0]
107107

108108
end
109+
110+
@printline
111+
109112
@testset "shifts, etc" begin
110113

111114
c1(N,K) = @tullio M[x,y,c] := N[x+i-1, y+j-1,c] * K[i,j]
@@ -158,6 +161,9 @@ end
158161
end
159162

160163
end
164+
165+
@printline
166+
161167
@testset "from TensorTrace" begin
162168
# These can all be handled using TensorOperations
163169

@@ -196,6 +202,8 @@ end
196202
con7(x) = @tullio C[m,n,j,i] := 44 * x[i,j,k] * r392[k,m,n]
197203
@test gradtest(con7, (9,2,3))
198204

205+
@printline
206+
199207
## contract! B
200208
con8b(x) = @tullio K[i,j] := 5 * r32[i,k] * x[k,j]
201209
@test gradtest(con8b, (2,3))
@@ -215,15 +223,19 @@ end
215223
con14(x) = @tullio K[i,j] := r3399[a,b,j,k] * x[b,c,k,i] * r33[a,c]
216224
@test gradtest(con14, (3,3,9,9))
217225

226+
@printline
227+
218228
## scalar -- one with :=, one without
219-
sc1(x) = @tullio s = r22[b,β] * x[a,b,c] * r312[c,a,β]
220-
@test gradtest(sc1, (1,2,3))
229+
sc1(x) = @tullio s = r22[b,β] * x[a,b,c] * r312[c,a,β] avx=false
230+
@test gradtest(sc1, (1,2,3)) # UndefVarError: ####op#798_0 not defined
221231

222-
sc2(x) = @tullio s := x[γ,c] * r3399[c,γ,i,i]
232+
sc2(x) = @tullio s := x[γ,c] * r3399[c,γ,i,i] avx=false
223233
@test gradtest(sc2, (3,3))
224234

225235
end
226236

237+
@printline
238+
227239
if Tullio._GRAD[] != :Dual
228240
#=
229241
@testset "products" begin
@@ -319,6 +331,9 @@ if Tullio._GRAD[] != :Dual
319331
# I suspect that @avx is re-ordering loops, which makes onlyone() incorrect.
320332

321333
end
334+
335+
@printline
336+
322337
@testset "finalisers" begin
323338

324339
norm2(m) = @tullio n[i] := m[i,j]^2 |> sqrt
@@ -328,9 +343,11 @@ if Tullio._GRAD[] != :Dual
328343
@test _gradient(sumnorm2, mat)[1] ForwardDiff.gradient(sumnorm2, mat)
329344
@test gradtest(norm2, (3,4))
330345

331-
layer(x) = @tullio y[i,k] := mat[i,j] * x[j,k] |> tanh
346+
layer(x) = @tullio y[i,k] := mat[i,j] * x[j,k] |> tanh avx=false # this takes 15 mins +?
332347
@test gradtest(layer, (3,4))
333348

349+
@printline
350+
334351
lse1(mat) = @tullio lse[j] := log <| exp(mat[i,j])
335352
@test gradtest(lse1, (3,4))
336353

@@ -344,6 +361,8 @@ if Tullio._GRAD[] != :Dual
344361
end
345362
end
346363

364+
@printline
365+
347366
if GRAD == :Zygote
348367
@testset "nograd keyword" begin
349368

@@ -358,3 +377,5 @@ if GRAD == :Zygote
358377

359378
end
360379
end
380+
381+
@printline

test/group-3.jl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,15 @@ end
153153

154154
@testset "parsing + LoopVectorization" begin include("parsing.jl") end
155155

156-
if test_group != "3" # Github CI fails, on some runs, "ERROR: Package Tullio errored during testing (received signal: KILL)"
157-
# https://github.com/mcabbott/Tullio.jl/pull/57/checks?check_run_id=1753332805
158-
159-
using Tracker
160-
GRAD = :Tracker
161-
_gradient(x...) = Tracker.gradient(x...)
162-
163-
@tullio grad=Base
164-
@testset "gradients: Tracker + DiffRules + LoopVectorization" begin include("gradients.jl") end
156+
using Tracker
157+
GRAD = :Tracker
158+
_gradient(x...) = Tracker.gradient(x...)
165159

166-
@tullio grad=Dual
167-
@testset "gradients: Tracker + ForwardDiff + LoopVectorization" begin include("gradients.jl") end
160+
@tullio grad=Base
161+
@testset "gradients: Tracker + DiffRules + LoopVectorization" begin include("gradients.jl") end
168162

169-
end
163+
@tullio grad=Dual
164+
@testset "gradients: Tracker + ForwardDiff + LoopVectorization" begin include("gradients.jl") end
170165

171166
@info @sprintf("LoopVectorization tests took %.1f seconds", time()-t8)
172167

0 commit comments

Comments
 (0)