Skip to content

Use fft_small in hensel.c only when its headers can be compiled - #410

Merged
jerebertho merged 1 commit into
algebraic-solving:masterfrom
mohabsafey:fix-fft-small-without-avx2
Nov 25, 2026
Merged

jerebertho merged 1 commit into
algebraic-solving:masterfrom
mohabsafey:fix-fft-small-without-avx2

Conversation

@mohabsafey

Copy link
Copy Markdown
Contributor

Fixes #398.

hensel.c uses the products by transforms of fft_small whenever FLINT (3.2.0 or later) provides it. FLINT may however have been built with fft_small for a processor with AVX2 while msolve is compiled without AVX2, as in #398. The vector types of machine_vectors.h, included by fft_small.h and also used by hensel.c, are then not defined and the compilation fails.

These products are now only compiled when the headers can be compiled, that is with AVX2 and FMA, or with NEON. Otherwise hensel.c keeps the products of fmpz_poly_mul, as with older versions of FLINT.

Tests with FLINT 3.6:

  • built as in compilation error if avx2 is not present #398 (CPU detection removed, -mavx only): the build fails on master and succeeds with this PR, and make check passes;
  • usual build (-mavx2 -mfma): fft_small is still used, and make check passes.

The lifting of Groebner bases over QQ (-g 2) is not affected: it only calls FLINT functions using fft_small internally, and it gives the same results when built without AVX2.

Some of the changes in this PR were made with the assistance of generative AI (Claude Code).

🤖 Generated with Claude Code

FLINT may provide fft_small, having been built for a processor with
AVX2, while msolve is compiled without AVX2. The vector types of the
headers of fft_small, which hensel.c also uses, are then not defined
and the compilation fails. The products of polynomial matrices by
transforms are now only compiled with AVX2 and FMA or with NEON, and
otherwise hensel.c keeps the products of fmpz_poly_mul.

Fixes algebraic-solving#398.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jerebertho
jerebertho force-pushed the fix-fft-small-without-avx2 branch from a7cbb9f to fe8cdcf Compare November 25, 2026 07:56
@jerebertho
jerebertho merged commit 07e3e49 into algebraic-solving:master Nov 25, 2026
10 checks passed
dimpase added a commit to dimpase/msolve that referenced this pull request Nov 25, 2026
Resolve the overlap with algebraic-solving#410 by retaining the configure-time FLINT fft_small compile check, so the Hensel code still falls back when the target cannot compile those headers.

Co-authored-by: OpenAI Dot <support@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compilation error if avx2 is not present

2 participants