Skip to content

Commit

Permalink
check length of cachesize(), fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Sep 8, 2022
1 parent 8eb4d42 commit 6b35f33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CPUSummary"
uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9"
authors = ["chriselrod <[email protected]> and contributors"]
version = "0.1.26"
version = "0.1.27"

[deps]
CpuId = "adafc99b-e345-5852-983c-f28acb93d879"
Expand Down
8 changes: 6 additions & 2 deletions src/x86.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ else
end
num_l4cache() = static(0)

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

# cache_size(::Union{Val{3},StaticInt{3}}) = num_cores() * StaticInt{1441792}()
function _extra_init()
cs = CpuId.cachesize() (1, 1, CpuId.cpucores())
cs = let cs=CpuId.cachesize()
ntuple(i -> i == 3 ? cs[3] ÷ CpuId.cpucores() : cs[i], length(cs))
end
cs === PrecompiledCacheSize || _eval_cache_size(cs)
ci = CpuId.cacheinclusive()
ci === PrecompiledCacheInclusive || _eval_cache_inclusive(ci)
Expand Down

2 comments on commit 6b35f33

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/67919

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.27 -m "<description of version>" 6b35f33fc3cf51c27c481e67ff4d373b33d03e08
git push origin v0.1.27

Please sign in to comment.