Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #15458

fastGPT: GPT-2 written in FORTRAN (Re: Vectorization 2024 or Tensorization 2025)

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject fastGPT: GPT-2 written in FORTRAN (Re: Vectorization 2024 or Tensorization 2025)
Date 2026-02-10 10:48 +0100
Message-ID <10meutg$j6jl$1@solani.org> (permalink)
References <10km9pe$dch1$2@solani.org> <10krqi7$fer2$1@solani.org> <10l6998$m6m3$1@solani.org>

Show all headers | View raw


Hi,

Ok, Tensorization on the Deskop seems
to be older than 2025, already featured
by Apple M1 Max hardware in 2021.

BTW, here is a nice piece of linear
algebra meets artificial intelligence,
ChatGPT-2 written in FORTRAN:

User: When did the Mexican-American war start?
fastGPT: 1846.

User: When did it end?
fastGPT: 1848.

File GPT-2 ca. 10 Pages of FORTRAN code
https://github.com/certik/fastGPT/blob/main/gpt2.f90

Bye

P.S.: The tensorization acceleration happens here.
Basically a float 32-bit general matrix multiplication,
already specified as THE LEVEL 3 BLAS in 1990:

#include <Accelerate/Accelerate.h>
void acc_sgemm(int m, int n, int k, float *A, float *B, float *C) {
https://github.com/certik/fastGPT/blob/main/linalg_accelerate.c

Vectorization would use SIMD (Single Instruction,
Multiple Data) instructions. I guess tensorization uses
typically MAC (multiply-accumulate operations).

The deployment on a Apple M1 Max is especially easy,
since it has UMA, unified memory, so you can pass
arrays just by memory pointers.

P.S.: Some of the top timings, inference of the
input file (20 tokens):

1 core + hardware GEMM:
fastGPT (Accelerate, fast_tanh) 0.288s

8 cores:
PyTorch (OpenBLAS) 0.392s

So the hardware GEMM accelerator easily
compensates for 8 cores? This was on a 2021 machine,
might be even better now?

Mild Shock schrieb:
> Hi,
> 
> The paper outlines, how the AI Boom, changes
> some dynamics, in hardware design. Which explains
> the NVIDIA and Synopsys Strategic Partnership.
> 
> But the paper only shows a 2024 CPU, not yet a NPU.
> 
> Neural Model Checking
> https://arxiv.org/abs/2410.23790
> 
> I suspect with End of 2025 CPU of the Copilot+ kind,
> we can get a further speed-up of a factor 10x-100x.
> But how difficult can it be to build such a prototype,
> 
> just a GNU Prolog with an ANN backend instead of a WAM?
> 
> Bye
> 
> Mild Shock schrieb:
>> Hi,
>>
>> What do you prefer, the Blue Pill or the Red Pill?
>>
>> a) Some LinkedIn Pseudo Science nonsense:
>>
>> My Gripes with Prolog - January 14, 2026
>> https://buttondown.com/hillelwayne/archive/my-gripes-with-prolog/
>>
>> b) Some real brain food for CLP(FD) Prologers:
>>
>> Common constraint programming problems
>> https://www.hakank.org/common_cp_models/
>>
>> Tell me your choice!
>>
>> Bye
>>
>> Mild Shock schrieb:
>>>
>>> "Als der französische König, den man wegen
>>> der unermüdlichen Regelmäßigkeit, mit der er,
>>> gleich einer Sonne, deren Lauf niemand
>>> aufzuhalten vermochte, täglich zur selben
>>> Stunde, von dem leisen Rascheln der seidnen
>>> Vorhänge angekündigt, aus den Gemächern
>>> von Versailles hervortrat, um, von einer Schar
>>> Hofleute umgeben, die weniger aus freiem
>>> Willen als aus der wohlbegründeten Furcht,
>>> in dem Schatten, den sein Glanz warf, unsichtbar
>>> zu werden, ihm folgten, den Gang durch die
>>> Spiegelgalerie anzutreten pflegte, sich an
>>> eben diesem Morgen, an welchem ein
>>> unbedeutender Wolkenzug den Himmel
>>> trübte, die Frage erhob, ob auch die Sonne,
>>> wenn sie denn einmal zögerte, noch Sonne
>>> genannt werden dürfe, da bemerkte er, indem
>>> er den Absatz seines Schuhs auf den Marmorboden
>>> setzte, dass nicht der Himmel, sondern allein
>>> sein Strumpf ein Loch hatte."
>>>
>>> -- Menhire von Finistère, ca. 1708
>>
> 

Back to comp.lang.prolog | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Die Geschichte von Ludwig XIV [AI is not Dead] Mild Shock <janburse@fastmail.fm> - 2026-01-19 23:04 +0100
  The Blue Pill or the Red Pill [Hillel or Hakan] ? (Was: Die Geschichte von Ludwig XIV [AI is not Dead]) Mild Shock <janburse@fastmail.fm> - 2026-01-22 01:21 +0100
    Vectorization 2024 or Tensorization 2025 (Was: The Blue Pill or the Red Pill [Hillel or Hakan] ?) Mild Shock <janburse@fastmail.fm> - 2026-01-26 00:34 +0100
      fastGPT: GPT-2 written in FORTRAN (Re: Vectorization 2024 or Tensorization 2025) Mild Shock <janburse@fastmail.fm> - 2026-02-10 10:48 +0100
  NVMe's are worse than a human brain (Was: Die Geschichte von Ludwig XIV [AI is not Dead]) Mild Shock <janburse@fastmail.fm> - 2026-02-01 13:57 +0100

csiph-web