allow disable cpu flags
Tell us about your request
docker run --cpu-flags or docker run --cpu-disable-flags
allow to disable cpu flags
Which service(s) is this request for?
docker run
Why Is Needed
Macbook pro max m1 - inside of docker
lscpu | grep Flags
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp flagm2 frint
Macbook pro max m1 - inside of docker
lscpu | grep Flags
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp sve2 flagm2 frint svei8mm svebf16 bf16 afp sme
Compare table
| Flag | M4 | M1 |
|---|---|---|
| fp | ✅ | ✅ |
| asimd | ✅ | ✅ |
| evtstrm | ✅ | ✅ |
| aes | ✅ | ✅ |
| pmull | ✅ | ✅ |
| sha1 | ✅ | ✅ |
| sha2 | ✅ | ✅ |
| crc32 | ✅ | ✅ |
| atomics | ✅ | ✅ |
| fphp | ✅ | ✅ |
| asimdhp | ✅ | ✅ |
| cpuid | ✅ | ✅ |
| asimdrdm | ✅ | ✅ |
| jscvt | ✅ | ✅ |
| fcma | ✅ | ✅ |
| lrcpc | ✅ | ✅ |
| dcpop | ✅ | ✅ |
| sha3 | ✅ | ✅ |
| asimddp | ✅ | ✅ |
| sha512 | ✅ | ✅ |
| asimdfhm | ✅ | ✅ |
| dit | ✅ | ✅ |
| uscat | ✅ | ✅ |
| ilrcpc | ✅ | ✅ |
| flagm | ✅ | ✅ |
| sb | ✅ | ✅ |
| paca | ✅ | ✅ |
| pacg | ✅ | ✅ |
| dcpodp | ✅ | ✅ |
| sve2 | ✅ | ❌ |
| flagm2 | ✅ | ✅ |
| frint | ✅ | ✅ |
| svei8mm | ✅ | ❌ |
| svebf16 | ✅ | ❌ |
| bf16 | ✅ | ❌ |
| afp | ✅ | ❌ |
| sme | ✅ | ❌ |
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
- tensorflow have
illegal instructionerrors in on the docker withmacbook m4because of the extra flags - will fix https://github.com/docker/for-mac/issues/7539
Are you currently working around the issue?
I am trying to solve this in the os level or the tensorflow level but without success for now
update
I solve my problem in tensorflow level by setting env XLA_FLAGS to value --xla_backend_optimization_level=0
but is probably be valuable to allow this in the docker level
I hit this issue as well, where I was running an XLA model using TFServe in Docker. It got killed due to generating an SVE operation not supported by the processor, due to Docker wrongly claiming the sve2 capability.
I hit this issue as well, where I was running an XLA model using TFServe in Docker. It got killed due to generating an SVE operation not supported by the processor, due to Docker wrongly claiming the
sve2capability.
did XLA_FLAGS flag solved the problem ?
Yes, it did fix it. There should be a proper fix for this though, which I believe should be that Docker should report the correct capabilities. Otherwise it complicates building docker images for multiple environments, as fx in production, disabling XLA optimizations seems like a bad idea.
I am not sure if this is a docker bug or tensorflow bug or even mac os bug if you thinks is a docker bug we can open issue in https://github.com/docker/for-mac
I am not expert here, but I think it is a docker bug - it exposes a supported CPU feature set that is actually not supported.
When XLA then jits the model, it will think it’s fine to use the SVE instructions - but it is not!
FWIW I created a question in the XLA discord in case they have thoughts: https://discord.com/channels/999073994483433573/1004823487124357182/1336481646647709847
is look like the same problem https://github.com/rancher-sandbox/rancher-desktop/issues/8057#issuecomment-2586147638
look like same problem https://github.com/elastic/elasticsearch/issues/118583
look connected https://github.com/ClickHouse/ClickHouse/issues/74743
https://github.com/moby/buildkit/issues/5433
Docker desktop 4.39.0 [Mar 6, 2025] disables SME, SVE and SSVE so you may want to upgrade try again.