golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.8k stars 17.51k forks source link

x/telemetry: cmd/go: report maximum support micro architecture by the host of the compiler #65627

Open Jorropo opened 7 months ago

Jorropo commented 7 months ago

Proposal Details

More and more architectures are gaining sub-architecture levels under ${GO${GOARCH^^}} variables.

Often higher levels add new instructions and tweak semantics which allows the compiler to emit better code (which would be incompatible with previous cpus).

It would be nice to know what CPUs should be targeted. For example if we discover that 40% of cpus support amd64 v4 considering avx512 routines would be useful.

The main issue with this approach is that the cpu compiling and the cpu running code aren't the same. However I don't think anyone (including me) want to collect telemetry from end binaries.

thanm commented 7 months ago

@pjweinb @hyangah @findleyr per owners

findleyr commented 7 months ago

Thanks for filing this issue, our first telemetry proposal outside the telemetry team (!). In the future, we hope people will fill out the telemetry proposal template, though I know that the process needs documentation, so let's start with what you've provided.

I think one missing piece of information (for me, a naive observer) is the set of unique counters that would be collected. We don't need to decide on the exact format now, but suppose the schema is something like build/goamd64:{v1,v2,v3,v4}. Can you enumerate all of the possible unique values you'd want to collect?

Jorropo commented 7 months ago

That a good question, ideally I would want all the best supported ${GO${GOARCH^^}} values on all archs as more and more architectures now have microarchitecture level:

However a glance at https://telemetry.go.dev/ suggest only amd64 and arm64 are used in any significant number in the wild.

So it is probable that the values for GORISCV64 support would be unique. (bad)

I don't really see value in tracking GOARM64 either as near all the arm64 reports are on darwin and afaik all the apple m{1,2,3} support the same extensions so we wouldn't learn anything right now.

GOAMD64 has good variety, there is a wide variety of generations of products in use today and various products within the same generations can support different extensions (new low power intel chips still only support v2 for example).


TL;DR: build/goamd64:{v1,v2,v3,v4} LGTM.

I don't exactly know the telemetry syntax, but build/goamd64 suggest to me this reads the GOAMD64 variable. I'm not asking for the micro architecture level people are using in the wild today to compile their program, I'm asking for the best level their CPU would support.

I guess most peoples don't even know GOAMD64 exists as it has none to very little impact in the real world so all the samples would be v1 as it's the default.