Skip to content

Commit 6b35f33

Browse files
committed
check length of cachesize(), fixes #13
1 parent 8eb4d42 commit 6b35f33

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CPUSummary"
22
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
33
authors = ["chriselrod <elrodc@gmail.com> and contributors"]
4-
version = "0.1.26"
4+
version = "0.1.27"
55

66
[deps]
77
CpuId = "adafc99b-e345-5852-983c-f28acb93d879"

src/x86.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ else
2626
end
2727
num_l4cache() = static(0)
2828

29-
const PrecompiledCacheSize = CpuId.cachesize() (1, 1, CpuId.cpucores())
29+
const PrecompiledCacheSize = let cs = CpuId.cachesize()
30+
ntuple(i -> i == 3 ? cs[3] ÷ CpuId.cpucores() : cs[i], length(cs))
31+
end
3032
const PrecompiledCacheInclusive = CpuId.cacheinclusive()
3133
cache_inclusive(_) = False()
3234
@noinline function _eval_cache_size(cachesize)
@@ -56,7 +58,9 @@ cache_size(_) = StaticInt{0}()
5658

5759
# cache_size(::Union{Val{3},StaticInt{3}}) = num_cores() * StaticInt{1441792}()
5860
function _extra_init()
59-
cs = CpuId.cachesize() (1, 1, CpuId.cpucores())
61+
cs = let cs=CpuId.cachesize()
62+
ntuple(i -> i == 3 ? cs[3] ÷ CpuId.cpucores() : cs[i], length(cs))
63+
end
6064
cs === PrecompiledCacheSize || _eval_cache_size(cs)
6165
ci = CpuId.cacheinclusive()
6266
ci === PrecompiledCacheInclusive || _eval_cache_inclusive(ci)

0 commit comments

Comments
 (0)