Skip to content

Commit cfc3a87

Browse files
authored
switch to SnoopPrecompile.jl (#164)
1 parent 5c30e4a commit cfc3a87

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Octavian"
22
uuid = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4"
33
authors = ["Chris Elrod", "Dilum Aluthge", "Mason Protter", "contributors"]
4-
version = "0.3.19"
4+
version = "0.3.20"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -11,6 +11,7 @@ LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
1111
ManualMemory = "d125e4d3-2237-4719-b19c-fa641b8a4667"
1212
PolyesterWeave = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad"
1313
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
14+
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
1415
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
1516
ThreadingUtilities = "8290d209-cae3-49c0-8002-c8c24d57dab5"
1617
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
@@ -23,6 +24,7 @@ LoopVectorization = "0.12.86"
2324
ManualMemory = "0.1.1"
2425
PolyesterWeave = "0.1.1, 0.2"
2526
Requires = "1"
27+
SnoopPrecompile = "1"
2628
Static = "0.7.5, 0.8"
2729
ThreadingUtilities = "0.5"
2830
VectorizationBase = "0.21.15"

src/Octavian.jl

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ using ManualMemory: MemoryBuffer, load, store!
3737

3838
using ThreadingUtilities: _atomic_add!, _atomic_load, _atomic_store!, launch, wait, SPIN
3939

40+
using SnoopPrecompile: @precompile_setup, @precompile_all_calls
41+
4042
if !(StaticInt <: Base.Integer)
4143
const Integer = Union{Base.Integer,StaticInt}
4244
end
@@ -63,18 +65,26 @@ include("complex_matmul.jl")
6365
include("init.jl") # `Octavian.__init__()` is defined in this file
6466

6567
@static if VERSION >= v"1.8.0-beta1"
66-
let
68+
@precompile_setup begin
69+
# Putting some things in `setup` can reduce the size of the
70+
# precompile file and potentially make loading faster.
6771
__init__()
6872
A64 = rand(100, 100)
69-
matmul(A64, A64)
70-
matmul(A64', A64)
71-
matmul(A64, A64')
72-
matmul(A64', A64')
7373
A32 = rand(Float32, 100, 100)
74-
matmul(A32, A32)
75-
matmul(A32', A32)
76-
matmul(A32, A32')
77-
matmul(A32', A32')
74+
75+
@precompile_all_calls begin
76+
# All calls in this block will be precompiled, regardless of whether
77+
# they belong to Octavian.jl or not (on Julia 1.8 and higher).
78+
matmul(A64, A64)
79+
matmul(A64', A64)
80+
matmul(A64, A64')
81+
matmul(A64', A64')
82+
83+
matmul(A32, A32)
84+
matmul(A32', A32)
85+
matmul(A32, A32')
86+
matmul(A32', A32')
87+
end
7888
end
7989
end
8090

0 commit comments

Comments
 (0)