Jump to content
Read the Funtoo Newsletter: Summer 2023 ×

CPU Flags


Recommended Posts

Hello, everyone.

 

The USE flags corresponding to the instruction sets and other features specific to the x86 (including x86-64) architecture are being moved into a separate USE flag group called CPU_FLAGS_X86.

 

In order not to lose CPU-specific optimizations, users will be required to update their make.conf (and package.use) file. For example, if the following USE flags were present:

 

USE="mmx mmxext sse sse2 sse3"

 

Those flags need to be copied into:

 

CPU_FLAGS_X86="mmx mmxext sse sse2 sse3"

 

Please note that the same CPU_FLAGS_X86 variable is used both on 32-bit and 64-bit x86 (amd64) systems.

When in doubt, you can consult the flag descriptions using one of the commonly available tools, e.g. ''equery uses'' from gentoolkit:

 

equery uses media-video/ffmpeg

 

Most of the flag names match /proc/cpuinfo names, with the notable exception of SSE3 which is called 'pni' in /proc/cpuinfo (please also do not confuse it with distinct SSSE3).

 

To help users enable the correct USE flags, we are providing a Python script that generates the correct value using /proc/cpuinfo. It can be found in the {{Package|app-portage/cpuinfo2cpuflags}} package:

 

emerge -1v app-portage/cpuinfo2cpuflags

cpuinfo2cpuflags-x86

 

In order to ensure safe migration and maintain compatibility with external repositories, it is recommended to preserve the old USE settings for a period of one year or until no package of interest is still using them

Link to comment
Share on other sites

  • 4 weeks later...

New user and poster here, 

 

This is a good feature, thank you for the script it worked well.  :)

 

However I have an observation about the documentation, in the op post and the wiki there is reference to adding the flags as such 

 

 

 users will be required to update their make.conf (and package.use) file

 

there is an example for the /etc/portage/make.conf but not /etc/portage/package.use.

 

In my case I added the recommended lines to both files.

This ends up creating a cryptic error message when you try to emerge something, the error below.

Invalid atom in /etc/portage/package.use: CPU_FLAGS_X86="avx 

So I comment out the line added to the package.use and all is well.

The line added to both files from the script was the line below ( created from memory, funtoo is compiling away at the moment so not accessible)

CPU_FLAGS_X86="avx other ones here mmx mmxext sse sse2 sse3"

Should the docs exclude the info to add this line to package.use or give an example of use maybe?

Link to comment
Share on other sites

I find this interesting, while I do not understand it yet.

What is the reason for the change, what happened  ... what changed to require this.

I do not doubt funtoo's great wisdom, just trying to understand why, so can help explain the change to others.

 

I run the cpuinfo2cpuflags-x86 and get

CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3"

 

 

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-mtune=generic -O2 -pipe"
CXXFLAGS="-mtune=generic -O2 -pipe"

 

While this is what I have currently in make.conf .... the new flags seems like I would need to rebuild my whole system.

I just want to ask why the changes, and what benefits it has?

What if I simply sit back and do nothing?

 

Not angry, just uninformed and curious about this change.

Link to comment
Share on other sites

AFAIK, the CPU_FLAGS_X86 variable is for ebuilds that contain the option for those flags whereas the CHOST, CFLAGS and CXXFLAGS are for EVERY ebuild.

 

If you want to see what would be recompiled, add the result that you posted in your make.conf file, and run a --pretend emerge:

 

`emerge world -uDNpv  --with-bdeps=y`

 

IIRC, it was only about 22 packages on my setup.

Link to comment
Share on other sites

×
×
  • Create New...