From 0d360100371c7a86ec56695504cc6f62a98a8964 Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Thu, 26 Jan 2023 12:25:48 -0500 Subject: [PATCH 1/2] Drop Static.jl --- Project.toml | 7 +++---- src/Polyester.jl | 1 - src/batch.jl | 15 ++++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Project.toml b/Project.toml index 9c55dd8..2124874 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Polyester" uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" authors = ["Chris Elrod and contributors"] -version = "0.7.2" +version = "0.7.3" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" @@ -11,7 +11,6 @@ IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" ManualMemory = "d125e4d3-2237-4719-b19c-fa641b8a4667" PolyesterWeave = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad" Requires = "ae029012-a4dd-5104-9daa-d747884805df" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" StrideArraysCore = "7792a7ef-975c-4747-a70f-980b88e8d1da" ThreadingUtilities = "8290d209-cae3-49c0-8002-c8c24d57dab5" @@ -23,7 +22,6 @@ IfElse = "0.1" ManualMemory = "0.1.3" PolyesterWeave = "0.1.8, 0.2" Requires = "1" -Static = "0.7, 0.8" StrideArraysCore = "0.3.11, 0.4" ThreadingUtilities = "0.5" julia = "1.6" @@ -31,7 +29,8 @@ julia = "1.6" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" +Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "ForwardDiff", "Test"] +test = ["Aqua", "ForwardDiff", "Static", "Test"] diff --git a/src/Polyester.jl b/src/Polyester.jl index 2d94745..b5b90e3 100644 --- a/src/Polyester.jl +++ b/src/Polyester.jl @@ -9,7 +9,6 @@ import ArrayInterface using ArrayInterface: static_length, static_step, static_first, size using StrideArraysCore: object_and_preserve using ManualMemory: Reference -using Static using Requires using PolyesterWeave: request_threads, diff --git a/src/batch.jl b/src/batch.jl index 8ac93c4..5f79b1a 100644 --- a/src/batch.jl +++ b/src/batch.jl @@ -25,7 +25,7 @@ end @cfunction($(Expr(:$, :bc)), Cvoid, (Ptr{UInt},)) end end - return Expr(:block, Expr(:meta,:inline), q) + return Expr(:block, Expr(:meta, :inline), q) end # @inline function batch_closure(f::F, args::A, ::Val{C}) where {F,A,C} # bc = BatchClosure{F,A,C}(f) @@ -283,8 +283,9 @@ end @inline function batch( f!::F, - (len, nbatches)::Tuple{Vararg{Union{StaticInt,Integer},2}}, - args::Vararg{Any,K}) where {F,K} + (len, nbatches)::Tuple{Vararg{Any,2}}, + args::Vararg{Any,K}, +) where {F,K} batch(f!, Val{false}(), (len, nbatches), args...) end @@ -292,8 +293,8 @@ end @inline function batch( f!::F, threadlocal::Val{thread_local}, - (len, nbatches)::Tuple{Vararg{Union{StaticInt,Integer},2}}, - args::Vararg{Any,K} + (len, nbatches)::Tuple{Vararg{Any,2}}, + args::Vararg{Any,K}, ) where {F,K,thread_local} # threads, torelease = request_threads(Base.Threads.threadid(), nbatches - one(nbatches)) len > 0 || return @@ -323,12 +324,12 @@ end Nr, Nd, ulen, - args... + args..., ) end function batch( f!::F, - (len, nbatches, reserve_per_worker)::Tuple{Vararg{Union{StaticInt,Integer},3}}, + (len, nbatches, reserve_per_worker)::Tuple{Vararg{Any,3}}, args::Vararg{Any,K}; threadlocal::Val{thread_local} = Val(false), ) where {F,K,thread_local} From 431ac1829d9a071435f2f34e1cc255a685b4229f Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Thu, 26 Jan 2023 13:35:44 -0500 Subject: [PATCH 2/2] Actually remove StaticInt --- Project.toml | 3 +-- src/closure.jl | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 2124874..166e3d3 100644 --- a/Project.toml +++ b/Project.toml @@ -29,8 +29,7 @@ julia = "1.6" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" -Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "ForwardDiff", "Static", "Test"] +test = ["Aqua", "ForwardDiff", "Test"] diff --git a/src/closure.jl b/src/closure.jl index 7a811eb..31cdd24 100644 --- a/src/closure.jl +++ b/src/closure.jl @@ -329,9 +329,9 @@ function enclose( # push!(threadtup.args, :(min($iter_leng, cld($num_thread_expr, $reserve_per))), reserve_per) # end else - il = :(div( - $iter_leng, - $(minbatchsize isa Int ? StaticInt(minbatchsize) : esc(minbatchsize)), + il = :(Base.sdiv_int( + Int($iter_leng)::Int, + $(minbatchsize isa Int ? minbatchsize : :(Int($(esc(minbatchsize)))::Int)), )) # if reserve_per ≤ 0 push!(threadtup.args, :(min($il, $num_thread_expr)))