22num_machines () = static (1 )
33num_sockets () = static (1 )
44
5- let nc = static ((Sys. CPU_THREADS):: Int >> 1 )
5+ function _get_num_threads ()
6+ static ((Sys. CPU_THREADS):: Int >> (Sys. ARCH != = :aarch64 ))
7+ end
8+
9+ let nc = _get_num_threads ()
610 global num_l1cache () = nc
711 global num_cores () = nc
812end
913let syst = static ((Sys. CPU_THREADS):: Int )
1014 global sys_threads () = syst
1115 global num_threads () = syst
1216end
13-
17+ @static if Sys. ARCH === :aarch64
18+ num_l2cache () = static (1 )
19+ num_l3cache () = static (0 )
20+ else
1421num_l2cache () = num_l1cache ()
1522num_l3cache () = static (1 )
23+ end
1624num_l4cache () = static (0 )
1725
1826if Sys. CPU_NAME === " tigerlake" || Sys. CPU_NAME === " icelake" || Sys. CPU_NAME === " icelake-server"
1927 cache_size (:: Union{Val{1},StaticInt{1}} ) = StaticInt {49152} ()
28+ elseif Sys. ARCH === :aarch64 && Sys. isapple ()
29+ cache_size (:: Union{Val{1},StaticInt{1}} ) = StaticInt {131072} ()
2030else
2131 cache_size (:: Union{Val{1},StaticInt{1}} ) = StaticInt {32768} ()
2232end
@@ -30,6 +40,8 @@ elseif Sys.CPU_NAME === "tigerlake" || Sys.CPU_NAME === "icelake-server"
3040 cache_size (:: Union{Val{2},StaticInt{2}} ) = StaticInt {1310720} ()
3141elseif occursin (" zn" , Sys. CPU_NAME) || occursin (" icelake" , Sys. CPU_NAME)
3242 cache_size (:: Union{Val{2},StaticInt{2}} ) = StaticInt {524288} ()
43+ elseif Sys. ARCH === :aarch64 && Sys. isapple ()
44+ cache_size (:: Union{Val{2},StaticInt{2}} ) = StaticInt {12582912} ()
3345else
3446 cache_size (:: Union{Val{2},StaticInt{2}} ) = StaticInt {262144} ()
3547end
@@ -48,7 +60,7 @@ cache_size(::Union{Val{3},StaticInt{3}}) = num_cores() * StaticInt{1441792}()
4860
4961function __init__ ()
5062 ccall (:jl_generating_output , Cint, ()) == 1 && return
51- nc = (Sys . CPU_THREADS) :: Int >> 1
63+ nc = _get_num_threads ()
5264 syst = Sys. CPU_THREADS:: Int
5365 nt = Threads. nthreads ()
5466 if nc != num_l1cache ()
0 commit comments