Skip to content

Restore mac tests but on ARM#268

Merged
dlfivefifty merged 5 commits into
masterfrom
dl/Mactests
Jul 10, 2026
Merged

Restore mac tests but on ARM#268
dlfivefifty merged 5 commits into
masterfrom
dl/Mactests

Conversation

@dlfivefifty

@dlfivefifty dlfivefifty commented Apr 20, 2026

Copy link
Copy Markdown
Member

This is to see if Mac tests pass on ARM (before we were testing on x64)

also bumps setup-julia

@codecov

codecov Bot commented Apr 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.47%. Comparing base (14a3118) to head (84139eb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #268      +/-   ##
==========================================
+ Coverage   74.75%   77.47%   +2.72%     
==========================================
  Files          17       17              
  Lines        3208     3228      +20     
==========================================
+ Hits         2398     2501     +103     
+ Misses        810      727      -83     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dlfivefifty

Copy link
Copy Markdown
Member Author

no dice

@dlfivefifty

Copy link
Copy Markdown
Member Author

@copilot why are tests failing?

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@copilot why are tests failing?

The tests are failing due to the same issue as #263 — a segfault (signal 11) in the libfasttransforms tests on Julia 1.12, but passing fine on Julia LTS.

What's failing:

  • Julia 1 - ubuntu-latest: ❌ signal 11 in libfasttransformstests.jl:5
  • Julia 1 - macOS-latest (ARM): ❌ signal 11 in libfasttransformstests.jl:5
  • Julia lts - ubuntu-latest: ✅ passes
  • Julia lts - macOS-latest (ARM): ✅ passes

Root cause (stack trace on macOS ARM):

__gmpn_mul_basecase → mpfr_mul → ft_mpfr_trmv_ptr → lmul! (libfasttransforms.jl:986) → * (libfasttransforms.jl:880) → test_1d_plans (libfasttransformstests.jl:28)

The crash occurs in ft_mpfr_trmv_ptr when the C library performs MPFR arithmetic on the input BigFloat vector. The BigFloat struct layout changed in Julia 1.12 (likely related to the allocation-free BigFloat changes), so when the C function reads the Julia BigFloat array elements as mpfr_t*, it reads corrupted/incompatible memory, causing GMP to segfault.

This is a Julia 1.12 compatibility issue with the BigFloat path in the C library — so the Mac ARM runner confirms the same behavior as Linux. The fix needs to address how Ptr{BigFloat} is passed to ft_mpfr_trmv_ptr / ft_mpfr_trsv_ptr (and the matrix variants) in src/libfasttransforms.jl, likely by updating the mpfr_t struct definition or the renew! function to match Julia 1.12's new BigFloat layout.

@dlfivefifty

Copy link
Copy Markdown
Member Author

@copilot can you make a PR to fix this?

In Julia 1.12, BigFloat changed from a mutable struct (layout-compatible
with mpfr_t) to an immutable struct wrapping Memory{Limb}. This broke
the ccall to ft_mpfr_trmv_ptr and related functions that pass BigFloat
arrays as mpfr_t** to the C library, causing a segfault (signal 11).

Fix by:
- Adding `_mpfr_ptr(b::BigFloat)` that extracts the correct mpfr_t*:
  - Julia >= 1.12: pointer(getfield(b, :d)) (start of the Memory)
  - Julia < 1.12:  pointer_from_objref(b) (mutable BigFloat fields)
- Adding `_mpfr_ptrs` for StridedVector and StridedMatrix that build
  a Vector{Ptr{mpfr_t}} for the C mpfr_t** argument
- Updating all BigFloat ccalls (trmv/trsv/trmm/trsm _ptr variants) to
  use Ptr{Ptr{mpfr_t}} with GC.@preserve to keep BigFloat Memory alive

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@copilot can you make a PR to fix this?

Done. The fix is in commit Fix BigFloat Julia 1.12 compatibility.

Root cause: In Julia 1.12, BigFloat changed from a mutable struct whose fields matched mpfr_t directly to an immutable struct wrapping Memory{Limb}. The ft_mpfr_trmv_ptr/trsv/trmm/trsm C functions expect mpfr_t** (array of pointers to mpfr_t structs), but the old Ptr{BigFloat} was now passing pointers to BigFloat wrapper objects rather than to the actual mpfr_t structs.

Fix: Added _mpfr_ptr(b::BigFloat) (version-dispatched) to extract the correct mpfr_t*:

  • Julia ≥ 1.12: pointer(getfield(b, :d)) — the Memory{Limb} stores the mpfr_t struct at its start
  • Julia < 1.12: pointer_from_objref(b) — the mutable BigFloat's fields are layout-compatible with mpfr_t

All 42 BigFloat 1D plan tests now pass on Julia 1.12.

@dlfivefifty

Copy link
Copy Markdown
Member Author

@MikaelSlevinsky can I approve this to run?

@dlfivefifty dlfivefifty merged commit 983a851 into master Jul 10, 2026
20 checks passed
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