←back to thread

176 points Brajeshwar | 1 comments | | HN request time: 0s | source
Show context
fishywang ◴[] No.42160758[source]
A few years ago we added `GOAMD64=v3` [1] to how we build our go binary into docker images, as all our production servers have support to that and that can give us some free performance boost.

Then it turned out Rosetta does not support that, so those docker images can no longer run on developers' mac laptops, so we have to revert it back. This is why we can't have nice things (we don't use any arm server so we never bothered to build multi-platform docker image).

[1]: https://go.dev/wiki/MinimumRequirements#amd64

replies(1): >>42166102 #
tesch1 ◴[] No.42166102[source]
From the reference: "GOAMD64=v3: all v2 instructions, plus AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE."

Were those supposed to have been included? What of those is not emulated by Rosetta?

I'm struggling to understand the chain of following how this results in us not having nice things?

Iiuc, paraphrasing, sounds like go made an assumption about user requirements, that turned out to not be true when the arm macs came out? Wouldn't the arm mac users of go prefer to have docker images that dont need to be emulated anyhow?

replies(1): >>42170454 #
fishywang ◴[] No.42170454[source]
https://en.wikipedia.org/wiki/X86-64#Microarchitecture_level...

amd64 v3 are instructions included in CPUs starting from 2013, so basically any modern amd64 cpu supports all of them. As mentioned there on the Wikipedia page, QEMU 7.2 also implemented all of them. Those are more efficient instructions, thus "free performance boost".

But Rosetta doesn't. Which instruction(s) it doesn't implement doesn't really matter (I can't remember either). What matters is that when it runs an instruction it doesn't implement, it will throw an illegal instruction error and the code hard crashes.

So because of Rosetta, we can't build code with amd64 v3 enabled, and cannot have free performance boost (nice things).

replies(1): >>42177885 #
1. mrpippy ◴[] No.42177885[source]
Rosetta now supports AVX and AVX2 on Sequoia, but I believe all the others are missing (F16C, BMI, OSXSAVE definitely are not there)