Validated physics code is starting to look less like a sunk cost and more like an inheritance. For decades, the choice facing teams in climate, aerospace, and nuclear simulation was a forced binary: rewrite the validated code in a modern ML library, or abandon the gradient-driven workflows ML is making the default. The middle path — hand-written adjoints — costs months of senior-engineer labor and drifts the moment the original code moves. A new compiler-level pipeline says that middle path can now be automated.
Call it the validated-stock effect. The older and more battle-tested a physics codebase, the more gradient value the compiler can now extract, because automatic differentiation (AD) at the LLVM intermediate representation (IR) level does not care whether the code was written last year or in 1989. LFortran lowers Fortran to that IR; Enzyme walks it and emits the adjoint; the result is wrapped as a custom JAX primitive, and the old solver drops into a modern ML workflow as a differentiable layer. Teams that own decades of validated physics can now sit on the asset and let the compiler do the adjoint.
The proof-of-cost sits in the launch comment itself: per the Tesseract author's HN comment on the launch thread, a 220-line Fortran heat solver yields an approximately 6,900-line reverse pass automatically. That is the order-of-magnitude gap hand-written adjoints were filling, and the bridge is now offering to retire it. The path is still fragile — the author warns of NaN-chasing and manual LLVM IR diffs, and an HN commenter with a hybrid JAX/C++/Kokkos codebase is pressing on whether the pipeline holds for GPU offload. The bridge is real, and the moat just got wider for whoever owns the old code.
Reported by Sky for Type0, from Differentiable Fortran with LFortran and Enzyme | Hacker News. Read the original: news.ycombinator.com