Skip to content

bib: Fortran feasibility plan for go-embedded-fortran - #30

Merged
tannevaled merged 1 commit into
mainfrom
bib-fortran
Nov 13, 2026
Merged

tannevaled merged 1 commit into
mainfrom
bib-fortran

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

bib/fortran.md: bibliography and feasibility plan for go-embedded-fortran (```fortran cells in go-notebook, pure Go, embeddable, runnable in the wasm playground), modelled on bib/c-cpp.md. README gets an index entry.

Decisions it records

  • Front end in Go, common to both back ends and the largest item. LFortran's grammar is Bison GLR with 189 + 189 declared conflicts (parser.yy:16-18), so it cannot be fed to goyacc. flang's front end is 114 477 lines of C++. The only active Go Fortran parser (soypat/go-fortran, BSD-3) covers F77-F90 and targets transpiling.
  • Back end not pre-decided. Section 4.2 specifies the M1 gate. It compares (A) a Go evaluator, (B-near / B-upper) the same kernel compiled by clang 23.1.4 to wasm32 at -O0 / -O2 and run in wazero and the browser, and gfortran 15.2.0 -O2. The kernels are a scalar loop, a 2-D stencil, matmul and a = b*c + d, run on one core in interleaved rounds. The decision rule is stated before any measurement.
  • Libraries once, in Go: BLAS/LAPACK go to go-ndarray/linalg (the same layer Julia needs), intrinsics to go-ndarray, FFTs to go-fft, and I/O is one Go package ported from flang-rt.

Findings that matter for the gate

  • flang 23.1.4 has no wasm32 target (Target.cpp:1902-1964), so it cannot be the wasm oracle.
  • go-embedded-c's wasmgen holds encoded wasm bytes per block and is keyed by cc/v4 nodes, and its encoder is under internal/. Option B therefore needs an extraction that is not scheduled, plus go-embedded-c M3, which is still "planned".
  • go-ndarray cannot reach or adopt a column-major buffer without a copy. Issue Wrap: an array over a caller's buffer with given strides (zero-copy, for Julia column-major arrays) go-ndarray/ndarray#76 (Wrap) is needed by both options.
  • The LFortran JupyterLite kernel is 78 103 511 bytes, and wazero refuses it (legacy exception handling).
  • go-notebook's Sequential interface fits Fortran modules used across cells.

Nothing was timed. The unverified items are listed in section 11.

Checks

go run ./tools/checklinks passes. All counts come from tools/srccount and the wasm verdict from tools/wasmimports. No code changed.

🤖 Generated with Claude Code

bib/fortran.md: sources read with revisions (F2018 18-007r1, F2023
23-007r1, LFortran 4f2cd04, flang/flang-rt at llvmorg-23.1.4, gcc 15.2.0,
reference LAPACK, llvm-test-suite, the Go Fortran projects, go-ndarray,
go-embedded-julia, go-embedded-c, go-notebook, go-rouge), a v1 language
subset, the two back-end options and the measured gate (M1) that chooses
between them with its decision rule stated in advance, the runtime and
sharing tables, notebook semantics, corpora counted with tools/srccount,
the plan, risks and the list of what is unverified.

README: index entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit b8e2e08 into main Nov 13, 2026
1 check passed
@tannevaled
tannevaled deleted the bib-fortran branch November 13, 2026 13:09
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.

1 participant