Skip to content

Recover missing polynomial factors in 32-bit elimination - #591

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
masterfrom
agent/590-green-ci
Draft

ChrisRackauckas-Claude wants to merge 1 commit into
masterfrom
agent/590-green-ci

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — awaiting review by @ChrisRackauckas. Filed by an AI agent running as @ChrisRackauckas; Chris has not seen this.
Harness: Codex CLI 0.170.0 · Model: gpt-6.2-sol
Conversation: local session 01a20360-b318-75d2-8e8f-b2ee468f42f6 (no session URL)

This PR should be ignored until reviewed by @ChrisRackauckas.

On 32-bit Julia, FLINT returned only the monomial part of a rational polynomial GCD. The missing factors inflated the forced SIRS projection and caused 32-bit Core CI to reach its two-hour limit. The 32-bit elimination path now finds common factors through factorization and exact division in both matrix simplification and factor specialization.

Part of #590

Verification

  • On i686 Julia 1.13.4 with Nemo 0.56.2 and FLINT_jll 301.600.1+0, I ran GROUP=Core julia --startup-file=no --check-bounds=yes -e 'using SafeTestsets; include("test/det_minor_expansion.jl")' in the resolved test environment. The same test file ran against master first, then against the patch. The two polynomials have coprime cofactors by construction.

    Master:

    Expression: first(factors) == shared
     Evaluated: x1^2*x2^2 == x1^5*x2^2 + 3*x1^4*x2^3 + 3*x1^3*x2^4 + x1^2*x2^5
    Expression: Set(monic.(StructuralIdentifiability.fast_factor(shared * primitive))) == Set(monic.([x, y, x + y, primitive]))
    Test Summary:                                   | Pass  Fail  Total   Time
    Determinant by minor expansion                  |   50     2     52  30.9s
    

    Patch, with include("test/diffreduction.jl") appended to the same command:

    Test Summary:                  | Pass  Total   Time
    Determinant by minor expansion |   52     52  25.1s
    Test Summary:          | Pass  Total   Time
    Differential reduction |    6      6  45.6s
    
  • I ran the existing forced SIRS case on i686 with standard simplification and full saturation in a standalone diagnostic. The original Core run logged dimensions [3794, 3]. The patched diagnostic logged [830, 3] and passed the exact comparison against the expected generators.

  • I ran GROUP=QA julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' on x86-64 Julia 1.13.3:

    Test Summary: | Pass  Total     Time
    QA/qa.jl      |   21     21  1m56.9s
         Testing StructuralIdentifiability tests passed
    
  • I ran GROUP=Core julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' on x86-64 Julia 1.13.3:

    Core/state_generators.jl |    3      3  0.4s
    Core/submodels.jl |    7      7  0.8s
    Core/y_saturation.jl |   13     13  3m59.0s
         Testing StructuralIdentifiability tests passed
    
  • Runic 1.13.0 in check mode over tracked Julia files, typos src/elimination.jl src/util.jl test/bodies/det_minor_expansion.jl, and git diff --check exited zero.

Remaining verification

I ran the full 32-bit Core group with the CI flags on i686 Julia 1.13.4:

GROUP=Core julia --startup-file=no --project=. -e 'import Pkg; Pkg.test(; julia_args=["--check-bounds=yes", "--compiled-modules=yes", "--depwarn=yes"], allow_reresolve=true, coverage=true, force_latest_compatible_version=false)'

The patched run passed the forced SIRS case and reached SLIQR, where ParamPunPam 0.5.12 continued sampling after warning about its field size. I stopped the run after more than 1.1 million points. I also ran the unchanged SLIQR test case on master in isolation and saw the same warning and more than 140,000 points. Both runs reported:

Warning: In the prime number interpolation approach the field order might be too small
  Nd = 7
  Dd = 6
  n = 12
  max(Nd, Dd) * log(_first_primes[n]) = 25.27642538850957
  log(BigInt(order(K))) = 22.18070977675409668240445338380105263655482761415903710686888283725014937867117

I reproduced the limit in an environment containing Nemo 0.56.2 and ParamPunPam 0.5.12 with the following test. I ran it with julia --startup-file=no --project=. reproduce.jl on each architecture. The i686 run printed the warning and passed 2.3 million points before I stopped it. The x86-64 run exited zero.

using Nemo, ParamPunPam, Test
R, a = polynomial_ring(QQ, ["a$i" for i in 1:12])
K = fraction_field(R)
S, (x,) = polynomial_ring(K, ["x"])
equation = x - K(a[end]^7)
@test paramgb([equation]) == [equation]

The draft's 32-bit Core job confirmed the local diagnosis. The forced SIRS combinations all reached [830, 3]. SLIQR then reported the same warning and exhausted memory in ParamPunPam's interpolate_exponents! while growing its coefficient array:

Points: 3932128
OutOfMemoryError()
ERROR: LoadError: Some tests did not pass: 245 passed, 0 failed, 1 errored, 0 broken.

The remaining 32-bit Core cases depend on clearing this blocker. I did not run the prerelease, downgrade, documentation, or full ModelingToolkit extension jobs locally. ParamPunPam and RationalFunctionFields owner · Larger-prime support proposal

The preceding master run also recorded a native crash through __gmpz_mul_si → fmpq_mpoly_add → monomial_compress. A local i686 diagnostic on the base code independently crashed in _fmpz_clear_mpz when Julia ran a Nemo finalizer during FLINT reallocation. The allocator fault is in the native dependency path. The GCD workaround does not change that allocation path. Preceding master x86 crash · FLINT · Nemo.jl

An isolated experiment restricted interpolation to variables present in the input functions. It passed all six SLIQR combinations. I stopped the full experimental run after one hour while it was still factoring a later model inside Nemo. The experiment remains in the investigation only.

The main review tradeoff is the cost of fully factoring the shorter polynomial on 32-bit inputs with large cofactors. The draft's Tests workflow has finished, and the separate performance benchmark is still running.

Links

Risk assessment

  • Risk: medium
  • Blast radius: Rational polynomial elimination on 32-bit Julia, including determinant simplification and factor specialization. Public signatures and dependency versions stay the same.
  • Evidence: Two failing-before/passing-after assertions, the forced SIRS check, QA, and the CI logs linked above.
  • Independent review: Pending.
  • Merge: Needs human review. The patch changes which arithmetic path computes common factors on 32-bit.

🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-sol
Conversation: local session 01a20360-b318-75d2-8e8f-b2ee468f42f6 (no session URL)

Compute rational polynomial GCDs via factorization and exact division
on 32-bit builds. Use the same GCD for determinant simplification and
factor specialization without changing the factor units.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-sol
Agent-Job: 590-codex
Agent-Session: local session 01a20360-b318-75d2-8e8f-b2ee468f42f6 (no session URL)

This branch has not been deployed

No deployments
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.

2 participants