platforms icon indicating copy to clipboard operation
platforms copied to clipboard

Constraints for CPU features?

Open yesudeep opened this issue 4 years ago • 2 comments

Hi. Would it be possible to detect CPU features using something like https://github.com/google/cpu_features/ and provide them as platform constraints?

This could help in enabling certain compiler flags and instruction set architectures for targets.

What needs to be done so that something like this would work with Bazel?

yesudeep avatar Jul 21 '20 21:07 yesudeep

I'm not inclined to go down this path. It is never ending. Perhaps the X86 space is mostly stable, but the ARM space is growing all the time. Many people take the ARM core and add other pieces they need on the die. They should be able to innovate without having everything enumerated in platforms.

In general, micro level distinguishers should be provided by the compiler toolchains.

aiuto avatar Apr 11 '22 21:04 aiuto

Over in Python land, there's 4 different prebuilt interpreters available that vary by micro arch: a generic one, and then 3 that target some different micro archs. These docs talk about them: https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions:~:text=Intel/AMD%20CPUs.-,x86_64_v2,-%2D*

So, perhaps you'd reconsider having those micro archs here in the platforms repo? If not, perhaps another lighter weight place?

In general, micro level distinguishers should be provided by the compiler toolchains.

That seems rather expensive in this case, though. The binaries are prebuilt, so a compiler toolchain isn't necessarily required. It would also mean the compiler repos would have to be downloaded even if they weren't used -- during toolchain resolution, the constraint has to be evaluated, which then would download that compiler repo, only to have it not match.

rickeylev avatar Dec 14 '23 01:12 rickeylev