On Tue, Aug 29, 2023 at 6:22 AM Victor Ivanov <vic.m.iva...@gmail.com> wrote: > > My existing make.conf has: > > COMMON_FLAGS="-march=skylake -O2 -pipe" > CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse > sse2 sse3 sse4_1 sse4_2 ssse3" > > 1) Replace "-march=skylake" with "x86_64[-v1|v2|v3|v4]" or just "generic" > 4) Update to "-march=znver4" > 5) Update CPU_FLAGS_X86 with output of "$ cpuid2cpuflags" > > Am I missing anything critical that could break step (8) or any > packages I should include in step (2) in addition to @system to avoid > likelihood of segfaults?
Well, you won't get segfaults so much as SIGILL, but I'd probably simplify a bit. I'm running on zen1 and these are my current flags: CFLAGS="-O2 -mtune=znver1 --param l1-cache-line-size=64 --param l1-cache-size=32 -pipe -funit-at-a-time -fstack-protector" I do have CPU_FLAGS_X86 set, but it seems like most of these are used by less critical packages, and I'm not sure how much trouble getting these wrong would be. As you can see I'm not even setting march. Maybe I could set it a little more aggressively and not risk any problems, but I'm concerned about the situation where I might have an unplanned CPU upgrade. My motherboard could die, and if it does I'd rather be able to just replace the motherboard+CPU and not have to fuss around with rebuilding my entire system from a rescue disk. I'm sure march performs better than mtune but I'd be surprised if the difference is more than a percent or two for most general purpose loads. If I had some high performance application that needed every clock cycle then I'd probably just build that one application with more optimizations. In general though your plan seems reasonable. Only thing I would probably consider is at least rebuilding all of @world with the unrestrictive -march setting. I might let it upgrade over time to the newer CPU optimizations, but having random stuff breaking until I rebuild @world seems like unnecessary pain. You say you're "thinking about upgrading" so it sounds like you aren't in a hurry and odds are you don't have the new hardware looking at you and begging you to boot it up. Doing a full @world rebuild is just a few cents worth of electricity and a day or two. That's how I'd look at it personally... -- Rich