Add AMD64 micro architecture level support#7
Conversation
598e890 to
4d9e82b
Compare
cpuinfo_linux.go
Outdated
| flagSet[flag] = true | ||
| } | ||
|
|
||
| // https://unix.stackexchange.com/questions/631217/how-do-i-check-if-my-cpu-supports-x86-64-v2 |
There was a problem hiding this comment.
It may be better to reference https://tip.golang.org/wiki/MinimumRequirements#amd64 instead
| } | ||
| } else if isAmd64Arch(runtime.GOARCH) { | ||
| var err error | ||
| cpuVariantValue, err = getAmd64MicroArchLevel() |
There was a problem hiding this comment.
This should not change the value of DefaultSpec(). Default variant for amd64 is still v1 and v8 for arm64 even if chip is v9 compatible. Eg. image created on amd64 system will always be linux/amd64/v1 (normalized to linux/amd64) if user didn't specify that they want to create specific variant (or multiple images with different variants). This does not change depending on whether the building system happens to have AVX support or not.
I'd recommend creating a new function like MaximumSpec similar to https://github.com/moby/moby/blob/v26.1.4/distribution/pull_v2.go#L1089-L1096 that can be used in the cases where comparison to the maximum compatible version is needed (eg. when pulling multi-arch image manifest).
cpuinfo_linux.go
Outdated
| return variant, nil | ||
| } | ||
|
|
||
| func getAmd64MicroArchLevel() (string, error) { |
There was a problem hiding this comment.
https://github.com/tonistiigi/go-archvariant is an alternative here that does not depend on proc or Linux.
|
@laozc Please check the comments from Tonis |
3c7f1b6 to
deefb02
Compare
This commit adds the support for AMD64 micro architecture levels on Linux. Signed-off-by: Zhongcheng Lao <laozhongcheng@gmail.com>
deefb02 to
f439dfa
Compare
|
Hi, is there any updates to this? |
This commit adds the support for AMD64 micro architecture levels on Linux.
containerd/containerd#9506