r/MachineLearning • u/LessComplexity • 2d ago
Project I've built my own programming language that can fit ML better - And its faster than hand-tuned CUDA! [P]
So I've built my own programming language.
It has a different concept (but not new) -> dataflow, parallel first language.
But with a twist.
I've designed it for 5 years (mainly weekends) and started developing only this year, the aim was to create a parallel language, with a different kind of optimization.
The optimization does not focused on the control flow of the application like most other compiler, it focuses on fitting data and data usage onto the hardware device it is running on.
So at comptime, the language creates a dataflow map of the data of the program into processes of the program, this "map" is category-theory based, allowing to use category theoretic rules to prove facts about the program you wrote.
I combine those facts onto the hardware facts that I want to run on (e.g. the compute unit capabilities, total compute units, the memory locations and bandwidths, and how processes use data to ensure efficient re-use when needed).
This also allows the same code to run on nvidia, amd, any cpu, and at the end even on FPGA/printed as its own ASIC. Basically, a language because for years I've hated the monopoly of CUDA, and now officially I'm faster than even CUDA implementations!
The nice results: caching results for matrix mul is automatic, it is not hardcoded, the language just proves it, and creates a cache when needed, it re-computes only what is necessary, multiplications & additions that can be done in parallel WILL be done in parallel for you, so you don't need to specify it, the compiler just works. It also will place/process matrix muls and similar operations in a sequence that uses memory layout in the most efficient way for the hardware it runs on, and not bcs I told it to, but bcs it proves it 🔥
Now I've had a bit of a problem, I did design the language and its algorithms, but the problem is that I let claude make out with the code bcs I wanted results fast.
Now I've managed to prove that this language is faster in most cases than even hand-tuned kernels, numpy and other tools, all accomplished using even "naive" implementations in the language.
This week I've ran llama-3.2-1B and using f32 it is faster than all engines that have optimized the sh*t out of it by hand - and my language? naive implementation of the model.
Here is the language exposition with code examples and performance results against other languages/libraries (even numpy is losing on most hardware I've ran on):
https://lesscomplexity.github.io/mapal/language-exposition.html
For those that want to dig into the architecture I've made a nice file that explains it:
https://lesscomplexity.github.io/mapal/architecture-map.html
Right now I'm trying to "unvibe" the code.
Because the results are awesome, I'm not fully satisfied with how claude did it, even though I've review ALL the code it did, I did it fast to reach results.
Now that I have them the work is on making the compiler more efficient.
I would love to know what you guys think about the language, the syntax, honest opinions as much as you can, and ppl that are willing to help/experiment with it 😄
You can already install the language compiler, its LSP and syntax highlighting both for neovim & vscode.
Here is the official repo: https://github.com/LessComplexity/mapal
75
u/webhyperion 2d ago edited 2d ago •
I am not trying to discourage but here is some sound constructive criticism:
Looking at your performance results I feel like you are cherry picking? I am not saying you did it on purpose, just that your results do not show the whole picture. It is also not really clear to me why you used the geomean for compounding the results in one single number? To me it makes no sense here to use it, as it also dampens the pull of really high numbers. This skews results to the better measurements.
Can you explain how you designed the experiment to measure it i.e. how did you measure it, how many runs, per program per implementation? Have you considered to calculate the statistical significance of your results to accurately tell if its really faster or just statistical noise.
Also I just told claude to tell me what could be wrong in you performance overview, that is what it said:
Here are bullets for the post, each backed by the project's own evidence files:
Llama "f32 class" (Mapal fastest on all 5 GPUs)
GPU kernel suite
CPU
-ffast-math, a single accumulator, and a divide and modulo per element in the transpose.Aggregation
To be fair
53
u/2legited2 2d ago
Not sure what to make of this if you haven't even bothered to describe this project in your own words. What's the point if the author doesn't understand their own product?
39
u/onedev2 2d ago
I find it extremely hard to believe there was any human involved in this project. You claim to be faster than competitors and you didn’t even take precision into consideration in your benchmarks? That is ONLY an oversight a complete beginner or AI would make.
30
u/ZeroLegionOfficial 2d ago
I'm sure 99% it's AI based
7
u/infinitelylarge 2d ago
Does it support training or only inference? If it supports training, does it support Model Parallel or Data Parallel? If it supports Model Parallel, does it give the power to allocate how the model is split across GPUs? (Eg if I know my training examples and activations are large, then I might choose to assign a smaller portion of the model to each GPU than if I know the training examples and activations will be small.)
22
u/IlluminatiNotRealOr 2d ago
Odd you say you worked on it for 5 years but your history only shows work from Jun 2026
AI slop
3
u/halting_problems 2d ago
Hoe does it compare to Mojo?
2
u/satireplusplus 2d ago
so you reinvented Triton?
2
u/sandys1 2d ago
this is very intteresting. could you create a doc/page for CUDA vs mapal ? where we can see how the same program is expressed in cuda (before and after compilation) and what your language does ?
5
u/mmxgn 2d ago
Very nice! Reminds me of caffe and the original tensorflow
32
u/dupontping 2d ago
*claude built
11
u/Sufficient-Key6447 2d ago
Hit the road dude
1
u/freehuntx 1d ago
Is this similar to a software fpga type of Thing?
1
u/iovdin 2d ago
cool!
0
u/bklyn_xplant 2d ago
DSL
-1
u/Status_Jackfruit_924 2d ago
lol