-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AMD64 micro architecture level support #7
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -158,3 +159,39 @@ func getCPUVariant() (string, error) { | |||
|
|||
return variant, nil | |||
} | |||
|
|||
func getAmd64MicroArchLevel() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
This commit adds the support for AMD64 micro architecture levels on Linux.
containerd/containerd#9506