SIMPLE and mlx-fortran: what is done here, and how work crosses¶
Status, 2026-11-29: draft for Hans's read; not an implementation plan and not for an agent run. Hans ruled
that SIMPLE keeps its half of the division in a note of its own ("own note, written to the SIMPLE repo"); this
is that note. It was drafted from the mlx-fortran session on the M5 Ultra, as one new file; nothing else in
SIMPLE was changed.
Read at: SIMPLE 0267ace9e; mlx-fortran 1408fda.
Counterpart: ~/src/mlx-fortran/doc/implementation_notes/planned/mlxf_simple_crossings.md, which holds
mlx-fortran's half and the ledger of everything that has crossed. Where the two notes differ on a point of
SIMPLE's, this one is to be corrected first and the other follows.
Ruled by Hans, 2026-11-29: decision 4 (two runs in flight) and that the M5 Ultra is the master machine, where
plans are written. Decisions 1 to 3 and 5 to 9 are recommended, not ruled.
1. Why¶
mlx-fortran (~/src/mlx-fortran, MIT) is a Fortran interface to MLX, Apple's array framework, through its C
API. It was started for SIMPLE. Besides the library it holds small models of SIMPLE classes, which it calls
toys: each has SIMPLE's type, procedure names and dummy lists, a CPU route with SIMPLE's arithmetic, and a GPU
route. They exist so that GPU forms of SIMPLE's kernels can be developed and measured without touching
SIMPLE.
Release 4 of SIMPLE is CPU-only by ruling, and the GPU port belongs to the next release
(next_release/apple_silicon_gpu_port.md). Even so, work already crosses between the two repositories:
- A loop form found in a toy became a SIMPLE plan and a run: the batch-threaded plane insertion
(
batch_threaded_plane_insertion.md, runrec_slabs). - Observations from the toys became a second SIMPLE plan and run: float32 partial sums and the preconditioner
comparison (
float32_kernels_and_pcg_precond.md, runf32_pcg). - SIMPLE's own development changes classes the toys model, and the toys must follow.
- What SIMPLE's runs find comes back:
f32_pcgshowed that one toy observation does not hold in SIMPLE and that the toys' CPU baselines plan their transforms differently from SIMPLE's production code.
Of the three statements the toys made about SIMPLE's CPU code in one week, one carried to SIMPLE, one did not, and one was wrong and has been withdrawn. That is the reason for rules.
2. The division, from SIMPLE's side¶
| Kind of work | Where | Measured by |
|---|---|---|
| Any change of a line SIMPLE runs, its CPU loops included, whatever suggested it | SIMPLE, under a SIMPLE plan (doc/how2s/how2write_agent_plans.md) |
SIMPLE's tests and benchmarks, on the dell and dell2, then a read on a Mac |
| Scientific validity on experimental data | SIMPLE | Hans reads it himself |
| What SIMPLE costs today | SIMPLE | benchmark records of the latest code |
| The seam of the GPU port: the build option, the parameter, the glue submodules, the batch pipeline | SIMPLE, when the integration starts | SIMPLE's workflow gates, on both backends |
| Distributed execution, part files, project I/O | SIMPLE | SIMPLE |
| The Fortran binding of MLX | mlx-fortran | its unit tests, on CPU and GPU |
| A GPU form of a SIMPLE class: the device workspace, the Metal and CUDA kernel sources | mlx-fortran, in a toy | the toy's independent double-precision reference and its identity tests |
What a GPU adds to a job of nparts processes with nthr threads each |
mlx-fortran | its workflow benchmarks, on the M5 and the M2, on simulated data |
What follows for SIMPLE:
- SIMPLE writes no binding of mlx-c. The
iso_c_bindingmodule and the buffer-wrapping experiment that the port note of 2026-11-16 plans are done in mlx-fortran. The port note's hot-spot analysis, its gates and its code map stand. - SIMPLE holds no toy and no copy of mlx-fortran's sources before the integration. There is no shared package, no git submodule and no vendored copy.
- No session edits the other repository. A SIMPLE session reads mlx-fortran (its documents, its history, its reports) and writes SIMPLE only; an mlx-fortran session does the reverse. This note is the one exception, made on Hans's instruction.
- A number measured in a toy is never a number of SIMPLE. A toy has its own compiler flags, its own
data and, in places, its own arithmetic.
rec_slabsfound that the prototype's fused multiply-adds are not SIMPLE's.
3. The classes mlx-fortran models¶
A toy follows a SIMPLE module read at a pinned SIMPLE commit; the pin today is 28c753993. These are the
modules, with the folders they live in:
| SIMPLE module | Folder |
|---|---|
simple_polarft_calc and its submodules |
src/main/pftc |
simple_cartft_calc, simple_cartft_pose_opt |
src/main/cftc |
simple_eul_prob_tab, simple_eul_prob_tab_neigh |
src/main/strategies/search/probabilistic |
simple_strategy3D_srch, _greedy, _shc, _utils, simple_srchspace_map, simple_matcher_3Drec |
src/main/strategies/search |
simple_projector, simple_projector_pft_batch |
src/main/image |
simple_reconstructor, simple_reconstructor_pcg, simple_pcg_lattice |
src/main/volume |
simple_pcg_solver |
src/main/opt |
simple_lm_solver |
src/utils/math |
SIMPLE's development of these modules is not slowed or constrained by the toys (decision 7). When one of
them changes its layout, a public dummy list, a constant or a call order, mlx-fortran brings its toy to the
new form and moves its pin. Since the pin, d110e7c27 and d416d2898 changed five of these modules; the
two runs in flight will change three more.
4. When a form comes from a toy to SIMPLE¶
This is what the two plans in flight already do; decision 2 makes it the rule.
- It arrives as words. The toy's report says what the form is, which SIMPLE routine it maps to, the SIMPLE commit that routine was read at, what was measured (in the toy only) and what is not known.
- It becomes a SIMPLE plan, written by SIMPLE's rules. The plan measures its premise in SIMPLE before launch and derives its own floors; a floor taken from the toy or from a prototype is tagged derived and carries a margin.
- The code is written in SIMPLE, against SIMPLE's arithmetic, beside the code it may replace. Nothing is copied from the toy.
- A read on a Mac comes before the commit. The runs are on Linux, and the Macs are where the port will run. The read is a scratch copy, a Release build and one benchmark table on the M5 Ultra, from the command list the run's report ends with.
- The result goes back. The run's report names the crossing's number in mlx-fortran's ledger and says what SIMPLE kept and with which constants, or that the form was dropped and why. A form kept with other constants than the toy's is a change the toy then follows.
When a form matters to SIMPLE's CPU code alone and no toy holds that loop, it is prototyped standalone and planned in SIMPLE directly, as the float32 partial sums were.
5. When a SIMPLE run finds something the toys depend on¶
A run's report ends with a section "For mlx-fortran" when it found something about a module of section 3
that a toy mirrors or that a toy's CPU baseline rests on (decision 6). f32_pcg has three such findings
already: how the transforms are planned, the thread dependence of the PCG iterates, and the verdict on the
preconditioner comparison. One sentence each is enough: the routine, the commit, the number.
In the other direction, a statement about SIMPLE in an mlx-fortran report is a claim until SIMPLE has measured it. No SIMPLE plan takes it as a fact.
6. The integration¶
Held by Hans until his review of the delivered kernels and the first experiments on the Blackwell machines. When the hold is lifted it is a SIMPLE plan, one class at a time. What is recommended for it (decision 9):
- A class is taken only when its GPU form and CPU route are delivered and committed in mlx-fortran, the connected CPU and GPU benchmark there has run and ranks the class's stage, the toy has caught up with SIMPLE's current form of the class, and no run in flight edits the class's SIMPLE files.
- The classes go in the order of their stages' seconds in the connected CPU pass.
- The toys already have the file layout planned for SIMPLE: host files that import no MLX name, a glue
submodule named
<host unit>_mlxwhose body sits under#ifdef USE_MLX, and device modules. The integration is a transcription of the glue, the device module, the kernel sources and the tests under SIMPLE's names. - After a class is integrated its kernels are still developed in the toy, which keeps the independent reference, the CUDA source and the multi-process timings. SIMPLE's copy of a device module changes only by a transfer from the toy; SIMPLE's host class stays SIMPLE's.
7. State on 2026-11-29¶
The numbers are those of mlx-fortran's ledger.
| No. | What | State | Next |
|---|---|---|---|
| 1 | The batch-threaded plane insertion, run rec_slabs on dell2, base 0267ace9e |
in flight: Phases 0 to 2 done, the production caller running; the bytes of the per-plane loop; 0.434 of its time at 16 threads, box 160 | the run's end; its read on the M5 (its decision 12); Hans's commit or the drop |
| 3 | Float32 partial sums and the preconditioner comparison, run f32_pcg on the dell, base fa833e0e1 |
stopped in Phase 3; Phases 4 to 8 not run; adopted so far: the exit iteration's preconditioner application skipped in refinement | Hans is looking into it: resume at Phase 4 or end at Phase 3; then its read on the M5 |
| 4 | The toys' observation that SIMPLE's preconditioner makes the iterates worse | measured in f32_pcg, not confirmed: the preconditioner stays (R9, R10) |
mlx-fortran corrects its page |
| 10 | SIMPLE plans transforms with FFTW_MEASURE in production and FFTW_ESTIMATE under a fixed seed; 4.2 times between them for the PCG's transforms at box 128 on the dell |
found by f32_pcg; the toys' CPU routes plan with the estimate |
mlx-fortran times both on the Macs |
| 11 | The PCG iterates differ between 1 and 24 threads at box 128; solve3D does not reproduce itself at a fixed seed since 0754e25cc |
found by f32_pcg, not fixed |
SIMPLE's own: Hans |
| 12 | The port note of 2026-11-16 plans a binding of mlx-c in SIMPLE | superseded in that step and in the wrapping experiment | a status line in that note |
8. Machines¶
| Machine | Its part for SIMPLE |
|---|---|
| M5 Ultra | the master: plans are written here; the Mac read of every lift |
| dell2 | agent runs; SIMPLE lifts (now rec_slabs) |
| dell | Hans's production machine, with SIMPLE's data; runs whose bars are its own (now f32_pcg) |
| M2 Ultra, at work | a second Mac with a GPU, for mlx-fortran's second flight and, later, the port's second architecture |
| Linux machines at work, three with Blackwell GPUs | SIMPLE on NVIDIA, after the port; a fourth for testing |
Which machine collaborates on what is Hans's call.
9. Decisions¶
Never renumbered. Decision 4 is ruled; the others are recommended.
- SIMPLE writes no binding of mlx-c and holds no toy. The port, when it comes, depends on mlx-fortran as an installed library, behind a build option.
- A form from a toy enters SIMPLE by section 4's five steps. A toy's number is never a floor here.
- The Mac read of a lift is on the M5 Ultra and goes first in its queue. It is short, and Hans's commit waits for it.
- At most two runs in flight in SIMPLE at once (ruled by Hans, 2026-11-29: "Two flights per repo at
once is manageable"). A third waits for a commit.
rec_slabsandf32_pcgfill both places today. - The ledger of crossings is kept in mlx-fortran, in one place. SIMPLE's reports cite its numbers; section 7 here is a dated snapshot, not a second ledger.
- A run's report has a section "For mlx-fortran" when it found something a toy depends on (section 5).
- SIMPLE's development of the modules of section 3 is not constrained by the toys. Following is mlx-fortran's duty, and its pin says how far it has followed.
- The port note gets a status line naming mlx-fortran as the binding and this note as the division. Its analysis stands.
- The integration follows section 6 when Hans lifts the hold; its own plan settles the rest.
10. Not in this note¶
The design of the integration. Any decision inside rec_slabs or f32_pcg, which are their plans' and
their rulings'. A rule about how SIMPLE's own development is planned. Anything about mlx-fortran's internal
order of work, which is its roadmap's.
11. Files¶
This draft adds one file: doc/implementation_notes/planned/mlx_fortran_division_of_work.md (untracked).
For a SIMPLE session or Hans, once the note is read: its row in doc/implementation_notes/README.md; the
status line of decision 8 in next_release/apple_silicon_gpu_port.md; on the ruling of decisions 2, 3 and
6, a sentence each in doc/how2s/how2write_agent_plans.md (a plan whose form comes from a toy; the report's
section "For mlx-fortran").
Progress¶
- 2026-11-29: drafted from the mlx-fortran session on the M5 Ultra after Hans's rulings of that day, from
SIMPLE at
0267ace9e, the two plans in flight, the mirrors of their runs and the port note. Nothing was built or run for it, and no other file of SIMPLE was touched.