Skip to content

Commit 3ad4581

Browse files
committed
Fix implicit imports and require Julia >= 1.10
1 parent a3a8314 commit 3ad4581

File tree

7 files changed

+74
-67
lines changed

7 files changed

+74
-67
lines changed

.github/workflows/CI-julia-nightly.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,7 @@ jobs:
2525
with:
2626
version: ${{ matrix.version }}
2727
arch: ${{ matrix.arch }}
28-
- uses: actions/cache@v4
29-
env:
30-
cache-name: cache-artifacts
31-
with:
32-
path: ~/.julia/artifacts
33-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
34-
restore-keys: |
35-
${{ runner.os }}-test-${{ env.cache-name }}-
36-
${{ runner.os }}-test-
37-
${{ runner.os }}-
28+
- uses: julia-actions/cache@v2
3829
- uses: julia-actions/julia-buildpkg@v1
3930
- uses: julia-actions/julia-runtest@v1
4031
env:

.github/workflows/CI.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
version:
14-
- '1.6'
14+
- 'min'
1515
- '1'
1616
os:
1717
- ubuntu-latest
@@ -31,16 +31,7 @@ jobs:
3131
with:
3232
version: ${{ matrix.version }}
3333
arch: ${{ matrix.arch }}
34-
- uses: actions/cache@v4
35-
env:
36-
cache-name: cache-artifacts
37-
with:
38-
path: ~/.julia/artifacts
39-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
40-
restore-keys: |
41-
${{ runner.os }}-test-${{ env.cache-name }}-
42-
${{ runner.os }}-test-
43-
${{ runner.os }}-
34+
- uses: julia-actions/cache@v2
4435
- uses: julia-actions/julia-buildpkg@v1
4536
- uses: julia-actions/julia-runtest@v1
4637
env:

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name = "Polyester"
22
uuid = "f517fe37-dbe3-4b94-8317-1923a5111588"
33
authors = ["Chris Elrod <elrodc@gmail.com> and contributors"]
4-
version = "0.7.18"
4+
version = "0.7.19"
55

66
[deps]
7-
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
87
BitTwiddlingConvenienceFunctions = "62783981-4cbd-42fc-bca8-16325de8dc4b"
98
CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
109
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
@@ -16,22 +15,23 @@ StrideArraysCore = "7792a7ef-975c-4747-a70f-980b88e8d1da"
1615
ThreadingUtilities = "8290d209-cae3-49c0-8002-c8c24d57dab5"
1716

1817
[compat]
19-
ArrayInterface = "7"
2018
BitTwiddlingConvenienceFunctions = "0.1"
2119
CPUSummary = "0.1.2 - 0.1.8, 0.1.11, 0.2.1"
20+
ExplicitImports = "1.13.2"
2221
IfElse = "0.1"
2322
ManualMemory = "0.1.3"
2423
PolyesterWeave = "0.1.8, 0.2"
2524
Static = "0.7, 0.8, 1"
2625
StaticArrayInterface = "1"
2726
StrideArraysCore = "0.3.11, 0.4, 0.5"
2827
ThreadingUtilities = "0.5.4"
29-
julia = "1.6"
28+
julia = "1.10"
3029

3130
[extras]
3231
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
32+
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
3333
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
3434
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3535

3636
[targets]
37-
test = ["Aqua", "ForwardDiff", "Test"]
37+
test = ["Aqua", "ExplicitImports", "ForwardDiff", "Test"]

src/Polyester.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@max_m
33
@eval Base.Experimental.@max_methods 1
44
end
55

6-
using ThreadingUtilities
7-
import StaticArrayInterface
8-
const ArrayInterface = StaticArrayInterface
6+
using ThreadingUtilities: ThreadingUtilities
97
using Base.Cartesian: @nexprs
10-
using StaticArrayInterface: static_length, static_step, static_first, static_size
8+
using StaticArrayInterface: StaticArrayInterface, static_length, static_step, static_first
119
using StrideArraysCore: object_and_preserve
1210
using ManualMemory: Reference
13-
using Static
11+
using Static: StaticInt, static
1412
using PolyesterWeave:
1513
PolyesterWeave,
1614
request_threads,
@@ -20,6 +18,7 @@ using PolyesterWeave:
2018
assume,
2119
disable_polyester_threads
2220
using CPUSummary: num_cores
21+
using ManualMemory: ManualMemory
2322

2423
export batch, @batch, disable_polyester_threads
2524

src/batch.jl

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ struct BatchClosure{F,A,S,C}
44
f::F
55
end
66
function (b::BatchClosure{F,A,S,C})(p::Ptr{UInt}) where {F,A,S,C}
7-
(offset, args) = ThreadingUtilities.load(p, A, 2 * sizeof(UInt))
8-
(offset, start) = ThreadingUtilities.load(p, UInt, offset)
9-
(offset, stop) = ThreadingUtilities.load(p, UInt, offset)
7+
(offset, args) = ManualMemory.load(p, A, 2 * sizeof(UInt))
8+
(offset, start) = ManualMemory.load(p, UInt, offset)
9+
(offset, stop) = ManualMemory.load(p, UInt, offset)
1010
if C === Tuple{} && !S
1111
b.f(args, (start + one(UInt)) % Int, stop % Int)
1212
elseif C === Tuple{} && S
13-
((offset, i) = ThreadingUtilities.load(p, UInt, offset))
13+
((offset, i) = ManualMemory.load(p, UInt, offset))
1414
b.f(args, (start + one(UInt)) % Int, stop % Int, i % Int)
1515
elseif C !== Tuple{} && !S
16-
((offset, reducinits) = ThreadingUtilities.load(p, C, offset))
16+
((offset, reducinits) = ManualMemory.load(p, C, offset))
1717
reducres = b.f(args, (start + one(UInt)) % Int, stop % Int, reducinits)
18-
ThreadingUtilities.store!(p, reducres, offset)
18+
ManualMemory.store!(p, reducres, offset)
1919
else
20-
((offset, i) = ThreadingUtilities.load(p, UInt, offset))
21-
((offset, reducinits) = ThreadingUtilities.load(p, C, offset))
20+
((offset, i) = ManualMemory.load(p, UInt, offset))
21+
((offset, reducinits) = ManualMemory.load(p, C, offset))
2222
reducres = b.f(args, (start + one(UInt)) % Int, stop % Int, i % Int, reducinits)
23-
ThreadingUtilities.store!(p, reducres, offset)
23+
ManualMemory.store!(p, reducres, offset)
2424
end
2525
ThreadingUtilities._atomic_store!(p, ThreadingUtilities.SPIN)
2626
nothing
@@ -45,15 +45,15 @@ end
4545

4646
@inline function load_threadlocals(tid, argtup::A, ::Val{S}, reductup::C) where {A,S,C}
4747
p = ThreadingUtilities.taskpointer(tid)
48-
(offset, _) = ThreadingUtilities.load(p, UInt, sizeof(UInt))
49-
(offset, _) = ThreadingUtilities.load(p, A, offset)
50-
(offset, _) = ThreadingUtilities.load(p, UInt, offset)
51-
(offset, _) = ThreadingUtilities.load(p, UInt, offset)
48+
(offset, _) = ManualMemory.load(p, UInt, sizeof(UInt))
49+
(offset, _) = ManualMemory.load(p, A, offset)
50+
(offset, _) = ManualMemory.load(p, UInt, offset)
51+
(offset, _) = ManualMemory.load(p, UInt, offset)
5252
if S
53-
(offset, _) = ThreadingUtilities.load(p, UInt, offset)
53+
(offset, _) = ManualMemory.load(p, UInt, offset)
5454
end
55-
(offset, _) = ThreadingUtilities.load(p, C, offset)
56-
(offset, reducvals) = ThreadingUtilities.load(p, C, offset)
55+
(offset, _) = ManualMemory.load(p, C, offset)
56+
(offset, reducvals) = ManualMemory.load(p, C, offset)
5757
return reducvals
5858
end
5959

@@ -64,10 +64,10 @@ end
6464
start::UInt,
6565
stop::UInt,
6666
)
67-
offset = ThreadingUtilities.store!(p, fptr, sizeof(UInt))
68-
offset = ThreadingUtilities.store!(p, argtup, offset)
69-
offset = ThreadingUtilities.store!(p, start, offset)
70-
offset = ThreadingUtilities.store!(p, stop, offset)
67+
offset = ManualMemory.store!(p, fptr, sizeof(UInt))
68+
offset = ManualMemory.store!(p, argtup, offset)
69+
offset = ManualMemory.store!(p, start, offset)
70+
offset = ManualMemory.store!(p, stop, offset)
7171
nothing
7272
end
7373
@inline function setup_batch!(
@@ -78,11 +78,11 @@ end
7878
stop::UInt,
7979
i_or_reductup,
8080
)
81-
offset = ThreadingUtilities.store!(p, fptr, sizeof(UInt))
82-
offset = ThreadingUtilities.store!(p, argtup, offset)
83-
offset = ThreadingUtilities.store!(p, start, offset)
84-
offset = ThreadingUtilities.store!(p, stop, offset)
85-
offset = ThreadingUtilities.store!(p, i_or_reductup, offset)
81+
offset = ManualMemory.store!(p, fptr, sizeof(UInt))
82+
offset = ManualMemory.store!(p, argtup, offset)
83+
offset = ManualMemory.store!(p, start, offset)
84+
offset = ManualMemory.store!(p, stop, offset)
85+
offset = ManualMemory.store!(p, i_or_reductup, offset)
8686
nothing
8787
end
8888
@inline function setup_batch!(
@@ -94,12 +94,12 @@ end
9494
i::UInt,
9595
reductup,
9696
)
97-
offset = ThreadingUtilities.store!(p, fptr, sizeof(UInt))
98-
offset = ThreadingUtilities.store!(p, argtup, offset)
99-
offset = ThreadingUtilities.store!(p, start, offset)
100-
offset = ThreadingUtilities.store!(p, stop, offset)
101-
offset = ThreadingUtilities.store!(p, i, offset)
102-
offset = ThreadingUtilities.store!(p, reductup, offset)
97+
offset = ManualMemory.store!(p, fptr, sizeof(UInt))
98+
offset = ManualMemory.store!(p, argtup, offset)
99+
offset = ManualMemory.store!(p, start, offset)
100+
offset = ManualMemory.store!(p, stop, offset)
101+
offset = ManualMemory.store!(p, i, offset)
102+
offset = ManualMemory.store!(p, reductup, offset)
103103
nothing
104104
end
105105
@inline function launch_batched_thread!(cfunc, tid, argtup, start, stop)

src/closure.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function makestatic!(expr)
245245
j = findfirst(==(ex), (:axes, :size, :length))
246246
if j !== nothing
247247
expr.args[i] =
248-
GlobalRef(ArrayInterface, (:static_axes, :static_size, :static_length)[j])
248+
GlobalRef(StaticArrayInterface, (:static_axes, :static_size, :static_length)[j])
249249
end
250250
elseif ex isa Expr
251251
makestatic!(ex)

test/runtests.jl

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
println(
22
"Starting tests with $(Threads.nthreads()) threads out of `Sys.CPU_THREADS = $(Sys.CPU_THREADS)`...",
33
)
4-
using Polyester, Aqua, ForwardDiff
4+
using Polyester, Aqua, ExplicitImports, ForwardDiff
55
using PolyesterWeave: dynamic_thread_count # min(Sys.CPU_THREADS, Threads.nthreads())
66
using Base.Threads: @threads
77
using Test
@@ -784,7 +784,33 @@ let x = Vector{Float64}(undef, 2)
784784
@test x == fill(2.0, 2)
785785
end
786786

787-
if VERSION v"1.6"
788-
println("Package tests complete. Running `Aqua` checks.")
789-
Aqua.test_all(Polyester; deps_compat = (check_extras = false,))
787+
println("Package tests complete. Running `Aqua` and `ExplicitImports` checks.")
788+
Aqua.test_all(Polyester; deps_compat = (check_extras = false,))
789+
790+
@testset "ExplicitImports" begin
791+
# No implicit imports (`using XY`)
792+
@test ExplicitImports.check_no_implicit_imports(Polyester) === nothing
793+
794+
# All explicit imports (`using XY: Z`) are loaded via their owners
795+
@test ExplicitImports.check_all_explicit_imports_via_owners(Polyester) === nothing
796+
797+
# No explicit imports (`using XY: Z`) of non-public names
798+
@test_broken ExplicitImports.check_all_explicit_imports_are_public(Polyester) === nothing
799+
800+
# No explicit imports (`using XY: Z`) that are not used
801+
@test ExplicitImports.check_no_stale_explicit_imports(
802+
Polyester;
803+
# This imported name is used in manual expression building
804+
ignore = (:object_and_preserve,),
805+
) === nothing
806+
807+
# Nothing is accessed via modules other than its owner
808+
@test ExplicitImports.check_all_qualified_accesses_via_owners(Polyester) === nothing
809+
810+
# No accesses of non-public names
811+
@test_broken ExplicitImports.check_all_qualified_accesses_are_public(Polyester) ===
812+
nothing
813+
814+
# No self-qualified accesses
815+
@test ExplicitImports.check_no_self_qualified_accesses(Polyester) === nothing
790816
end

0 commit comments

Comments
 (0)