Skip to content
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

proposal: runtime: add possibility to obtain "microarchitecture levels" at runtime #70898

Closed
the-hotmann opened this issue Dec 18, 2024 · 3 comments
Labels
Milestone

Comments

@the-hotmann
Copy link

Proposal Details

Description

When I build a binary I often wonder if it really downloads/uses the version that is optimal.

For example:

New servers most probably are having the hardware capabilities of "linux/amd64/v3", or even of "linux/amd64/v4".
But how can I check these two things at runtime:

  1. the microarchitecture levels of the Host/Hardware
  2. the microarchitecture levels that the software was build for

?

I have no problem getting linux/amd64 but it seems, I cant obtain the microarchitecture levels (eg. "v3" or "v4") the golang code was compiled to, at runtime.

This is the code, I use to obtain linux/amd64:

https://go.dev/play/p/aBFInM8N94d

Did anyobe achive this, or is this a missing feature?
Knowing this would allow devs to analize if their app is indeed running, compiled for the correct hardware features.

I personally would love "runtime.GOARCH_LEVEL" or something like this, which returns an empty string "" or eg. "v3" or "v4".

@gopherbot gopherbot added this to the Proposal milestone Dec 18, 2024
@gabyhelp
Copy link

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@seankhliao
Copy link
Member

Duplicate of #58015

@seankhliao seankhliao marked this as a duplicate of #58015 Dec 18, 2024
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2024
@ianlancetaylor
Copy link
Member

Note that you can get the microarchitecture level that a program was built for by running go version -m PROGRAM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants