View previous topic :: View next topic |
Author |
Message |
Linubie Guru


Joined: 11 Jun 2004 Posts: 390
|
Posted: Wed Feb 19, 2025 9:01 pm Post subject: AMD Ryzen 7 3700X CPU_FLAGS |
|
|
Hallo,
ich hatte damals mein System mit den CPU_FLAGS "aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3"
kompiliert.
Die ich mit cpuid2cpuflags herausgefunden hatte:
CPU_FLAGS_X86: aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3
Nun habe ich auf der Gentoo Wiki gelesen das ich auch znver2 nutzen kann.
https://wiki.gentoo.org/wiki/Ryzen#Ryzen_7
Das scheint jedoch nicht folgende zu einhalten "fma3 mmxext rdrand"
Quelle : https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
znver2
AMD Family 17h core based CPUs with x86-64 instruction set support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID, WBNOINVD, and 64-bit instruction set extensions.)
Sollte ich also folgende setzen?
CPU_FLAGS_X86="znver2 fma3 mmxext rdrand"
Danke _________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
 |
gt_amd64 Apprentice

Joined: 02 Dec 2004 Posts: 188
|
Posted: Thu Feb 20, 2025 7:12 pm Post subject: |
|
|
CPU_FLAGS_X86= so lassen (Ausgabe von cpuid2cpuflags) und da Du offensichtlich nur für Deine CPU kompilierst einfach noch COMMON_FLAGS="-O2 -march=native -pipe" in der make.conf setzen. Damit werden alle Pakete optimal für Deine CPU kompiliert ohne das Probleme auftreten.
Last edited by gt_amd64 on Fri Feb 21, 2025 11:47 am; edited 1 time in total |
|
Back to top |
|
 |
firefly Watchman

Joined: 31 Oct 2002 Posts: 5332
|
Posted: Thu Feb 20, 2025 8:10 pm Post subject: |
|
|
Linubie du verwechselst da was.
Die CPU_FLAGS_X86 haben nichts mit dem compiler parameter zu tun, welche via CFLAGS oder COMMON_FLAGS angibt
CPU_FLAGS_X86 sind useflags nur halt für bestimmte cpu befehlsätze
siehe auch https://wiki.gentoo.org/wiki/CPU_FLAGS_*#Difference_between_CFLAGS_and_CPU_FLAGS_.2A _________________ Ein Ring, sie zu knechten, sie alle zu finden,
Ins Dunkel zu treiben und ewig zu binden
Im Lande Mordor, wo die Schatten drohn. |
|
Back to top |
|
 |
pietinger Moderator

Joined: 17 Oct 2006 Posts: 5414 Location: Bavaria
|
Posted: Thu Feb 20, 2025 10:53 pm Post subject: |
|
|
Wie @firefly bereits (absolut richtig) sagte, darf man nicht die Optionen, die man einem Compiler (z.B. dem "gcc") mitgibt, mit den Namen von Use-flags verwechseln. Diese KÖNNEN identisch sein, müssen es aber nicht sein. Um die Verwirrung komplett zu machen, gibt es auch noch unterschiedliche Benamungen in einigen Programmen UND in Dokumentationen im Internet.
Die Fähigkeiten einer CPU können einfach und elegant mit den beiden Programmen "lscpu" [1] und - noch ausführlicher - "cpuid" [2] abgefragt werden.
1) Die Ausgabe von "lscpu" ist beinahe identisch mit "cat /proc/cpuinfo" - es fehlen nur die vmx flags.
2) "cpuid" gibt Informationen für jeden Core einer CPU aus. Wenn diese gleich sind, sollte man "cpuid -1" verwenden (siehe mehr in "man cpuid").
Ein Beispiel:
Kürzel für die Fähigkeit einer CPU:
Das sagt "lscpu": sse4_2
Das sagt "cpuid": SSE4.2 extensions = true
der GCC akzeptiert als Parameter: -msse4.2
während das Use-Flag "sse4_2" heisst.
... und FMA ist wirklich übel ... denn FMA3 wird meist nur als FMA gelistet. Du wirst kein FMA3 in "lscpu" oder "cpuid" finden. Der GCC kennt auch nur:
Code: | ‘fma’
‘no-fma’
Enable/disable the generation of the FMA instructions.
‘fma4’
‘no-fma4’
Enable/disable the generation of the FMA4 instructions. |
aus: https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html
Nur bei uns, heisst das Use-Flag so, wie es einst von Intel "erfunden" wurde. Vermutlich wird aber überall FMA3 als FMA genannt, weil ja FMA4 eigentlich ausgestorben ist (wird). Eine nähere Erläuterung ist hier:
https://de.wikipedia.org/wiki/FMA_x86
In der engl. Version wird ausführlicher beschrieben, wie es zu diesen beiden inkompatiblen Versionen kam ...
https://en.wikipedia.org/wiki/FMA_instruction_set
Wie bereits meine Vorredner sagten:
Nutze für den gcc-Compiler:
Code: | COMMON_FLAGS="-O2 -march=native -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}" |
und lasse Dir, die für Dein System, möglichen Use-flags mit "cpuid2cpuflags" herausfinden (Dieses Programm macht genau das, so wie es heisst). _________________ https://wiki.gentoo.org/wiki/User:Pietinger |
|
Back to top |
|
 |
Linubie Guru


Joined: 11 Jun 2004 Posts: 390
|
Posted: Fri Feb 21, 2025 9:29 am Post subject: |
|
|
Ok Danke für die Antworten.
Ich habe jetzt die make.conf wie erwähnt erweitert:
Code: | COMMON_FLAGS="-O2 -march=native -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}" |
Alles andere habe ich so gelassen mit den werten aus cpuid2cpuflags. _________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
 |
gt_amd64 Apprentice

Joined: 02 Dec 2004 Posts: 188
|
Posted: Fri Feb 21, 2025 12:01 pm Post subject: |
|
|
man muss bei einem derart optimierten system noch beachten das man bei einem hardwaretausch eine CPU mit dem gleichen (oder besseren) befehlssatz benötigt! man kann das system nicht mehr problemlos auf einem anderen x86 rechner starten, da unter umständen wichtige pakete nicht mehr funktionieren. also wenn man das system portable (bei defekt SSD ausbauen und in einen anderen PC einbauen) halten möchte, dann -march=native und CPU_FLAGS_X86= unbedingt weglassen. |
|
Back to top |
|
 |
Linubie Guru


Joined: 11 Jun 2004 Posts: 390
|
Posted: Fri Feb 21, 2025 12:12 pm Post subject: |
|
|
Ja danke für den Hinweis, das Problem hatte ich damals beim Wechsel von Intel auf den jetzigen AMD.
Da ich mit dem AMD Ryzen 7 5700X3D 8x 3.00GHz So.AM4 liebäugle und auf einen fallenden Preis warte dürfte das alles kein Problem sein. _________________ Mircosoft software is like having sex with a stranger, you always have to be careful not to get infected with something... |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|