Repository navigation
fix(build): an RX_MARCH choice is not reported as a CPU without AVX2 - #2223
Conversation
RX_MARCH=znver2 (AVX2, FMA and more) printed 'this CPU has no AVX2 ... (a little slower)'. The message is now only for a level the CPU check chose; an explicit RX_MARCH other than x86-64-v3 is named as that. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
hckrman101
left a comment
There was a problem hiding this comment.
Looks good. The message now says "no AVX2" only when host_march() made the choice, and an explicit RX_MARCH is reported as such. The flags are untouched. The empty-string RX_MARCH case behaves the same as before (falls through to host_march()), and the test's four cases cover both branches, including the silent ones. All CI checks are green and the PR is mergeable.
Note on #2383 (single-precision FMA/FRECPS/FRSQRTS fused on x86-64-v3): it only touches the comment above this block in nx2/build.py, so the two don't conflict. The interaction is that an explicit RX_MARCH now gets a truthful message, which matters more once the fast path depends on the level. An RX_MARCH=znver2 build has FMA but is not x86-64-v3, so #2383 should key on the feature (__FMA__) rather than on the string x86-64-v3. That is for #2383, not this PR.
Nit: the test slices build.py by text and execs it. That is fine here and matches how other tests in the repo work, but it will need updating if the block is reshaped.
Problem
With
RX_MARCH=znver2(Steam Deck, Zen 2: AVX2, FMA and more),nx2/build.pyprintedbuild: this CPU has no AVX2: the game is built for znver2 (a little slower). The message assumed any level other thanx86-64-v3was the CPU check's fallback.Change
this CPU has no AVX2is now printed only whenhost_march()chose the level. An explicitRX_MARCHother thanx86-64-v3is reported asbuild: the game is built for <march> (RX_MARCH). Flags are unchanged.Testing
tests/test_cpu_target.pygains a test that runs the actual selection block frombuild.pywith mockedRX_MARCHandhost_march()values. It fails on main (znver2reported as "no AVX2") and passes on Windows and Linux.