Mojo – a new programming language for AI developers
modular.com
modular.com
That said, Mojo is a completely different thing. It is aligned with the Python community to solve specific problems outlined here: https://docs.modular.com/mojo/why-mojo.html
Mojo also has a bunch of technical advancements compared to Julia by virtue of it being a much newer development and being able to learn from it (and Swift and Rust, and C++ and many many other languages). Including things like ownership and no GC. We also think there is room for a new language that is easier to deploy, scales down to small envelopes, works directly with the full Python ecosystem, is designed for ML and for MLIR from first principles, etc.
Julia is far more mature and advanced in many ways. Many folks have and will continue to push Julia forward and we wish them the best, it is a lovely ecosystem and language. There is room for more than one thing! :)
EDIT: Just in case there is any confusion, I work for Modular, built LLVM, Swift, Clang, MLIR and a variety of other things. I wasn't trying to misrepresent as being unaffiliated.
Edit: I see you're going to have protocols/ traits. Can those be specializes/monomoprhized at function call time like Julia abstract types?
And how about function specialization? Will functions be attached to structs in a single dispatch fashion or free floating multimethods?
This "detail" shouldn't be hidden away, it means a lot.
In general this tends to be true. However, in this case I'm not so sure. Modular seems to have garnered a lot of investment - probably orders of magnitude more than the Julia community has been able to get. There are a lot of nagging problems in Julia (startup times - though that's gotten better recently, ML kernel performance, and executables come to mind) that could have been easily fixed if they had the money to throw at them. Since they haven't had that kind of investment people who kick Julia's tires tend to see these things as built-in limitations and move on.
One of Julia's often complained about issues is that it could use way more developers than it has now. No amount of romanticizing a small community or "independent culture"(which I just can't see going away due to where a lot of people that come to Julia are coming from in the first place) is going to fix that, just more people coming aboard the ship.
So its not so obvious that a larger investment would scale so we'll immediately. (But it might force Julia to get better with these things...)
You needed much less stuff supported out of the box when Python first came on the scene. Today expectations have gotten much bigger. A minimal viable language has far more requirements.
Edit: seems some current hints are under the roadmap "Ownership and Lifetimes" heading but Python compatibility is not described yet.
But the cost has already been paid. We have NumPy, we have PyTorch and TensorFlow. So I don't see the value-add here. Maybe there's something I'm missing.
Taichi already allows for amazing speedups and supports all the backends (including Metal) https://www.taichi-lang.org/ the fact that they didn't mention Taichi is a glaring omission.
JAX is that next version of TensorFlow, https://jax.readthedocs.io/en/latest/notebooks/quickstart.ht...
This looks like a reboot of Numba with more resources devoted to it. Or a juiced up Shedskin. https://shedskin.github.io/
I think Mojo is a minor mistake, I would caution adoption, it is a superset fork of Python instead of a being a performance subset. Subsets always decay back to the host language. Supersets fork the base language. I would rather see Mojo integrated into Python rather than adopting the language and extending.
I have a theory why Mojo exists. The team was reading a lot of PyTorch and Tensorflow, getting frustrated with what a PIA working with C++ and MLIR is for their model-backend retargeting codegen, so they created their perfect C++/Python mashup rather than use TVM. They nerd sniped themselves and rather than just use Python3.12+mypy, they made a whole new language based off of Python.
They are just not accustomed to seeing libraries being that small. That is possible in Julia because it is all native Julia code which means interfacing with other Julia code works seamless and allows you to mix and match many small libraries very easily. You can reuse much more functionality which means individual libraries can be kept very small.
For PyTorch and TensorFlow e.g. activation functions have to be coded specifically into each library. In Julia these can just be reused for any library. Each ML library doesn't need to reimplement activation functions.
That is why you get these bloated monoliths. They have to reinvent the wheel over and over again. So yeah there is a cost which is constantly paid.
Every time you need to extend these libraries with some functionality you are paying a much higher price than when you do the same with Julia.
Also on a related topic, the PR for parallel GC in Julia just merged 4 days ago (https://github.com/JuliaLang/julia/pull/48600), so GC is in the process of getting a bunch faster.
Any examples you could link to?
What matters is how it is implemented, naturally a general purpose one won't do it.
This isn't true in most cases. If every subtree is only referenced by its (unique) parent, then you can use a standard Rust "Box", which means that during compilation, the compiler inserts calls to malloc() (when the Box is created) and free() (when the Box goes out of scope). There will be no reference counting — or any other overhead — at runtime.
That, and optimized static binaries, would make Julia truly general purpose.
I don't mind Python syntax, I hope Mojo lives up to all these claims...it could easily (and finally!) hit the sweet spot of C performance, elegance, and expressiveness!
With Julia, there is work to be done to get to small, optimized, static binaries - which it sounds like Mojo will provide out of the box, given it’s targeting resource-constrained (and novel) hardware.
The Rust-inspired features are also VERY interesting!
Modular can do exactly the same with existing Python packages, and lift them into Mojo that way.
Reference: https://numba.discourse.group/t/proposal-development-focus-f...
As a comparison, auto industry is moving toward fully automatic transmission especially for the EV but software industry is still undicided and seems cannot even come up with a robust GC mechanism that is on par with no GC in term of performance.
With no GC, interpreted programming language e.g. Python will most probably being used well into the future alongside Mojo/C++/Rust because majority of AI/data science/machine learning programmers cannot even bother to touch the underlying codes for the fear of programming complexity of these no GC languages.
I vehemently disagree. D's GC is the #1 reason for its fade into obscurity, instead of becoming a viable C++ competitor. Now it's completely overshadowed by Rust's success.
Regarding Rust vs D popularity, time will tell. When at the same age of D now, circa 2000s Perl was notably more popular than Python but then Perl lose its steam and fade into obscurity.
Regarding the sibling's comment on borrow checker, D now can support borrow checker and it's just a feature like its many capable features and Rust actually took it from Cyclone [3].
[1]TIOBE Index for April 2023:
https://www.tiobe.com/tiobe-index/
[2]Ownership and Borrowing in D:
https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in...
[3]Cyclone (programming language):
https://en.wikipedia.org/wiki/Cyclone_(programming_language)
It's because, first, there was manual memory management, which was error-prone.
Then came garbage collection, which was safe but slow.
Most recently came borrowing and move semantics, which offers the best of both worlds -- safety and speed -- at the cost of some (arguably justified) cognitive overhead and code flexibility.
So I absolutely don’t think of the borrow checker as superior to a GC, it’s a different tool with different tradeoffs. It was a good choice for a low-level language like Rust, but not necessarily for a high level language.
Looking forward to see where this new adventure will lead, and congratulations !
For Mojo, I'm interested in seeing how the language can be used as a path forward for the Cython community. This could be a stepping-stone towards reimplementation of Python in Mojo. For the past 3 year, I have been talking about the need for a Python-Steering-Council-recommended extension language for Python. This will be particularly important as WebAssembly keeps progressing and potentially redefining what we mean by virtualization and containers.
We have already been using LLVM extensively in Numba and there have been several explorations around MLIR and related technologies. There are several potential paths forward and I'm looking forward to finding ways to cooperate.
Understanding what will be open-source is of course, critical for that.
- Compile time language is ~ the runtime one. That's the model most systems languages seem to have ended up at. It doesn't have macros or reflection, but neither of those seem to be very popular
- The struct/let notation and lifetime model essentially give you C++ semantics with saner syntax. The class/def notation essentially give you python semantics. This is a clean answer to the gradual-typing-for-performance problem
- You can drop into MLIR at will and the std types are implemented like that. This makes the language look a lot like syntactic sugar over writing the IR which closely matches how (at least some) compiler devs think about programming languages
Yeah, I think that'll work. Python/C++ mashup is a popular dev stack and this can make that much cleaner. Faster than C is rather unproven but given the difference in compile time control should be achievable.
If this succeeds, it will allow you to use Python for the entire AI stack: high-level model composition (as usual), fast compiled CPU code (instead of, say, libs written with C++), and on-device operations (instead of, say, libs that use CUDA). Oh, and it will make your Python code parallel (i.e., there's no GIL).
Obviously, we'll have to wait until Mojo is production-ready, but I'm excited after seeing Jeremy Howard's easy-to-follow examples during the live keynote presentation. Jeremy, who sometimes hangs out on HN, must have been dying to tell the world about this for a long while.
Props to the Mojo team!
> Judging by what I've seen so far, it seems Modular has been able to "Rustify+Tritonify" Python code in a way that to me feels... very Pythonic.
I think it "feels Pythonic" because you're looking at Pythonic syntax. I suspect when you're banging your head against a borrow checker it will feel more like writing Rust. Like I'm pretty sure anything with a borrow checker will have to deal with lifetimes, mutable-vs-immutable references, shared mutability (cell/refcell in rust), etc; I don't know how you "Pythonify" that in any meaningful way?
>Further, we decided that the right long-term goal for Mojo is to provide a superset of Python
I have no idea how to reconcile that with the quotes you provided.
[edit] Ah, it seems you can control things running in a bundled CPython:
plt = Python.import_module("matplotlib.pyplot")
fig = plt.figure(1, [width, height], dpi)
ax = fig.add_axes([0.0, 0.0, 1.0, 1.0], False, 1), "hsv", 0, 0, 1.5)
...
plt.imshow(image)If this succeeds, the terminal endpoint will be the Python Software Foundation adopting Modular as the defacto and eventually official implementation since, as Modular noted in their docs, they effectively need Mojo to be absolutely amazing on generalized host CPUs as the key enabler allowing for the unified Python-superset experience across other types of general and specialized hardware ("xPU").
Julia will be dealt an adoption setback proportional to Mojo's growing success.
> Further, we decided that the right long-term goal for Mojo is to provide a superset of Python (i.e. be compatible with existing programs) and to embrace the CPython immediately for long-tail ecosystem enablement.
https://docs.modular.com/mojo/why-mojo.html#intentional-diff...
> our approach to compatibility is two fold:
> 1. We utilize CPython to run all existing Python3 code “out of the box” without modification and use its runtime, unmodified, for full compatibility with the entire ecosystem.
> 2. We will provide a mechanical migrator that provides very good compatibility for people who want to move Python code to Mojo.
> Together, this allows Mojo to integrate well in a mostly-CPython world, but allows Mojo programmers to be able to progressively move code (a module or file at a time) to Mojo. This approach was used and proved by the Objective-C to Swift migration that Apple performed.
Maybe the long-term goal is to try to make it a true superset, but it sounds like the detailed plan is more practical, to basically provide a "Python-next" language, like Swift for Objective-C.
>We utilize CPython to run all existing Python3 code “out of the box” without modification
from the docs the direct opposite of what the commentator claimed?
>We utilize CPython to run all existing Python3 code “out of the box” without modification
Oh yes!
Lemme know if you have any questions and I'll answer as best as I can. (I'm an advisor to Modulo.)
> We utilize CPython to run all existing Python3 code “out of the box” without modification and use its runtime, unmodified, for full compatibility with the entire ecosystem. Running code this way will get no benefit from Mojo, but the sheer existence and availability of this ecosystem will rapidly accelerate the bring-up of Mojo, and leverage the fact that Python is really great for high level programming already.
https://docs.modular.com/mojo/why-mojo.html#how-compatible-i...
Also, will the next version of the FastAI library be written in Mojo?
I'm not sure how long it will take before there's enough ML/DL functionality to write something like fastai in Mojo. I think there will be at least one more major version of fastai in Python. And even when Mojo can support what fastai needs, I expect to continue to supporting fastai on python as well.
(Unless you use `python.import`, which uses the CPython interpreter.)
Reason for asking: Without a stand-alone, open source compiler chain, Mojo will be out of question for one of the most exciting application areas I can think of: Computational biology.
"Will Mojo be open-sourced?
Yes, we expect that Mojo will be open-sourced. However, Mojo is still young, so we will continue to incubate it within Modular until more of its internal architecture is fleshed out. We don’t have an established plan yet.
Why not develop Mojo in the open from the beginning?
Mojo is a big project and has several architectural differences from previous languages. We believe a tight-knit group of engineers with a common vision can move faster than a community effort. This development approach is also well-established from other projects that are now open source (such as LLVM, Clang, Swift, MLIR, etc.)."
(A canonical project can be steered in a way that makes it impractical for you, and forking is often also impractical.)
For now, I'd treat it as closed source, which is a non-starter for investing in, when I can accomplish the same in open source ways. And there's no sense in giving away the open source uptake benefits to a company when the software isn't open source.
1. Patronage
2. Business
Patronage is the Ruby/Python/Linux "one guy + volunteers" model where a few of the devs look for companies to pay them to do it as a full or side project basically for marketing purposes or because that company can afford to subsidize their tools. This clearly isn't that.
A VC backed startup making an open source language is neither patronage nor a business, unless you take the hard-cynic position of saying the investors have been tricked into being patrons.
I'm assuming they've got some sort of cloud related ideas for monetization, but it's tough.
If this is closed source, it's already as irrelevant as matlab so no reason to fight it. If there are useful bits there will be python versions of them.
My man I wish this was true. I am not exaggerating the 10+ year thing, there are very important industries being run today on MATLAB. You remember the moment when you learned that a lot of wall street runs on excel? This is the moment you learn a lot of silicon manufacturing runs on MATLAB. An obscene amount.
According to Buffett, they shouldn’t use Excel in the first place to make investment decisions.
People overestimate how many people are willing to work on the "wrap C numerical library in Python" problem. On the other hand, Mathworks employs many people to work on things like mldivide. At least in the SuiteSparse case, the first class citizen is MATLAB.
When I was in school 15 years ago, matlab was pretty ubiquitous.
Maybe it was to strong to say it's irrelevant as opposed to niche, though it's definitely irrelevant in many fields where it used to be king. I do miss the figures though, I liked the combination of programmatic formatting + manual tweaks.
So Python is often not a realistic alternative. This is where initiatives like Mojo come in. They will be at least an order of magnitude faster than Matlab again.
But if you want to get people to move from Matlab to a powerful Open-Source alternative: Julia has a syntax that is much closer to Matlab than Python's. I had good success to get colleagues to use Julia which wouldn't look at Python, because the syntax was too far out of their comfort zone.
Well, by the number of 3rd party domains you have to allow to see the info it does not look free or OS...
--
[1]: https://docs.modular.com/mojo/why-mojo.html#intentional-diff...
While python the language is easy, and in many ways great for its original purpose as a teaching language, I'll take note of the few ways that Python ML suffers:
- pip hell. Really, having globally installed dependencies was great for the 90s and is terrible now that disk space is more or less a non-issue relative to dependencies. Venv/conda which do sneaky things e.g. with your shell is super dangerous (https://twitter.com/garybernhardt/status/1653171980483575808), and a misstep can trash your system especially when it has to deal with wheels with system-level dependencies (looking at you, tensorflow -- probably half of the reason why people moved to pytorch). Poetry sounds nice. It's been a while since I've checked in with the python ecosystem. Are ML people using that yet?
- Subpar deployment. Let's remember that Containerization basically exists because Python does not have an ops story.
- Subpar integration with web. You are forced to either create a microservice, or, spin it up within Django (nobody really does this). Then you typically have to pull in a bunch of sidecar processes (Redis, Celery, etc.) just to get queuing of your web jobs correct.
- Poor concurrency. Sure, you can run your tensorflow code in an awkward 'with' statement but I think there are very few ML practicioners who could really explain to you what that with is doing. That GPU is actually fundamentally an asynchronous entity. And god help you if you want to run and debug async python.
- No distribution story. Sure, the big guys are able to spin up, e.g. Horovod, but it's not really a thing for someone with less resources for a hot second on a few machines, and again, god help you if something goes wrong and you need to debug it.
Does Mojo solve any of these issues? From a cursory look, it looks like no.
So rather than writing another Python wrapper over c++ they are making a new performant language that can call Python.
To me it makes sense as torch is great and hard to compete with, but everything feeding into it is a mess today (Data loading, distribution logic).
don't forget the control layer/data layer separation principle. Performance mostly only matters at the data layer, and I don't believe that python ML really has a substantial problem with this, aside from not having a real distribution story. So "having a more performant python" doesn't really solve that much.
I'll tell you what could make the control layer better.
- no gil
- better async primitives
- immutability of passed parameters
- better testing story
- better documentation story (python is quite good at documentation, well, when python devs actually do it, which they usually don't).
- project-local dependencies with no shenanigans
Could you explain or give references to what you exactly mean by this? I've heard of separation of concerns, but is this a specific realization of that principle?
The original purpose was to act as a glue language for C++.
This post has me interested in mojo a lot and it has a lot of potential but it's difficult for me to get too excited about it at the moment because so much of it doesn't actually exist at the moment. Nothing is open sourced yet, and from the docs it seems they don't even have classes implemented.
My experience with new languages is that the devil is often in the details and the stuff that gets put off is sometimes where the sticking points are, where performance starts to decline relative to other languages, and where you start to run into dependency hell. It's not so much I want mojo to fail or anything — the contrary in fact — but it's so hard to know where it will end up this early in its development.
I'm curious about the teasing around open source. Obviously the amount of money and the slick product launch dictate a need to capitalize on this pooled expertise. Don't want to give away the game to the hyperscalers.
I wonder what the revenue and license models are going to end up looking like. A cloud of their own, professional services to HW manufacturers to optimize their performance, professional services to hyperscalers?
Curious if anybody has any ideas beyond the obvious.
DynamicVector should be named Array and SIMD should be named Vector and dispatched to whatever SIMD/vector pipeline the host offers, similar to the Flexible Vectors proposal in WASM: https://github.com/WebAssembly/flexible-vectors/blob/main/pr...
And please make Optional[T] as ergonomic as Swift / Kotlin with a simple '?'
Initial impression is that the animation of Mojo code vs. Python code has a bad UX. Why not just show the code side-by-side instead of animating it and making me click?
Another obvious question is how is it different than Numba and so forth?
https://docs.modular.com/mojo/why-mojo.html
The Mojo language has lofty goals - we want full compatibility with the Python ecosystem, we would like predictable low-level performance and low-level control, and we need the ability to deploy subsets of code to accelerators. We also don’t want ecosystem fragmentation - we hope that people find our work to be useful over time, and don’t want something like the Python 2 => Python 3 migration to happen again. These are no small goals!
and
Mojo already supports many core features of Python including async/await, error handling, variadics, etc, but… it is still very early and missing many features - so today it isn’t very compatible. Mojo doesn’t even support classes yet!
So I think the idea is good, but yeah re-implementing Python is a huge effort !
Though the comparison right below is notable:
A major goal of Clang was to be a “compatible replacement” for GCC, MSVC and other existing compilers. It is hard to make a direct comparison, but the complexity of the Clang problem appears to be an order of magnitude bigger than implementing a compatible replacement for Python. The journey there gives good confidence we can do this right for the Python community
Is it though? For Mojo to be a compatible replacement for Python, it would need to match the Python C ABI and the greater set of the standard library in a bug-for-bug compatible way.
The real question is whether it's bug-for-bug compatible or whether it's not. Numerical functions have a lot of nuances that effect that performance quite a bit. Are they constrained so that Python numpy log(x) gives the same as Mojo log(x)? Will C bindings act the same way as in CPython? Whole list of related questions. If there is a no to any of these questions, then code acts subtly differently in a way that is sometimes hard to detect. These differences are of course what have held back "standard code" from being numba/pypy/etc. compatible in many instances.
That said, if the answer isn't yes to anything, then it is very difficult to make optimizations. Not allowing hard to optimize Python behavior is precisely what has allowed Numba, Julia, etc. to achieve accelerations. There were some attempts at that kind of thing with R, which Jan Vitek gives some very interesting talks about (https://www.youtube.com/watch?v=VdD0nHbcyk4).
What I would find worrisome too is that this approach sounds like compile time city. A lot of the recent advancements in Julia have been by sending less to LLVM: optimizations are done in Julia and dead code is eliminated, calls are found to be the same and check caches, and then with v1.9 those caches use precompiled binaries to avoid having to call LLVM again. And the timeline of improvements shows that making LLVM be in the picture as little as possible has lead to some dramatic improvements in Julia's latency (https://viralinstruction.com/posts/latency/). Given what was seen from that, I'm weary of an approach that does everything in LLVM (via MLIR) on an even more dynamic representation (i.e. Python). My guess is that only things with explicit types will compile, and the rest is probably hitting some Python interpreter to avoid this issue.
[If part is using Python/GC through an interpreter though, wouldn't that part be harder to target to accelerators since it wouldn't compile through LLVM? That would mean only the code that is explicitly typed gets the nice new features, but not the Python parts?]
But hey, if this gets Chris Lattner and crew a reason to start taking LLVM compile times more seriously, then it's a win for Julia as well. I'm excited to see how the communities can benefit from one another, especially if Mojo is open source then it can be a win for all (which was definitely not clear in the presentation). And I do think that some of the ideas of lower level memory control are cool and should be added similarly to languages like Julia and Numba.
Your point about LLVM compile time is great one. Mojo is architected from the beginning for fast compile times, including deeply integrated caching and distributed compilation. LLVM "isn't slow" if you don't keep asking it to do the same thing over and over again.
-Chris
Isn't this going backwards? If Mojo delivers what it is trying to do, then these libraries would be rewritten in Mojo, and the issue of having to use two languages and continuously switching between them will be avoided.
* Will Mojo be able to generate portable, standalone binaries and libraries?
* If so, will the size of the binaries / libraries be similar to C / Rust binary sizes?
These are pretty big pain points for both JAX and Julia (Julia is slowly making progress on this front though)
Edit: It's even stripped on HN!
echo $'<Multi_key> <m> <o> <j> <o> : "\U1F525" U1F525 # FIRE' >>~/.XCompose
I'm not personally a fan of emoji, but I do like using and typing more than plain ASCII in the terminal. (One thing I liked about Julia is their partial embrace of Unicode, and one thing I don't is that you can't write lambdas with ‘↦’.)But now, it seems almost certain that Julia will end up a possible replacement-for-Matlab niche language, unknown and unused by most outside the niche. It's a pretty big and important niche, to be sure, but a bit disappointing given how nice the language is.
On the one hand Python's mindshare has been growing exponentially, riding on successive waves of data science, machine learning, deep learning, AI and now AGI hypes. NB: The two hypes it did not benefit from (for obvious reasons) are big data and crypto/blockchain. Given, though, Python's heavy historical baggage, you could think that eventually gravity would re-assert itself - with a potential crash landing.
So in a sense, if the mojo project succeeds becoming a very broad based renewal effort (a Python 4 thing) that fixes some of Python's limitations, it will lock-in Python's current amazing popularity. If not, then the field is still open for a challenger and Julia could well be that.
The broader technology space feels very febrile right now. Lots of talk, much less walk. The winners will be simply those who deliver tangible "next-gen" experiences to developers and end-users.
How does performance compare to Python in the general case, when not dropping into tricks?
Either way, kudos, exciting stuff, just questions I had after reading about it.
One of Python’s powerful features outside of being a great glue language for AI is rich runtime reflection and introspection. This is what allows things like FastAPI/Pydantic to work. Will Mojo support this level of runtime introspection?
I’m also curious about the type system. Will it be Python level or TypeScript level?
I'd love to see a comparison vs Julia though, which I think tried to tackle some of the same problems.
Oh, I guess that's one big philosophical difference.
Edit: just saw this is a project by Chris Latner and Tim Davis. Hahaha ... that's immediate credibility.
julia> using LoopVectorization, BenchmarkTools, Test
function AmulB!(C,A,B)
@turbo for n = indices((C,B),2), m = indices((C,A),1)
Cmn = zero(eltype(C))
for k = indices((A,B),(2,1))
Cmn += A[m,k]*B[k,n]
end
C[m,n]=Cmn
end
end
M = K = N = 144; A = rand(Float32, M,K); B = rand(Float32, K,N); C0 = A*B; C1 = similar(C0);
AmulB!(C1,A,B)
@test C1 ≈ C0
2e-9*M*K\*N/@belapsed(AmulB!($C1,$A,$B))
96.12825754527164
I'm able to achieve 96GFLOPs on a single core (Apple M1) or 103 GFLOPs on a single core (AMD EPYC 7502). And that's not even as good as what you can achieve using e.g. TVM to do the scheduling exploration that Mojo purports to do.Perhaps they have more extensive examples coming that showcase the capabilities further. I understand it's difficult to show all strengths of the entire system in a short demonstration video. :)
EDIT: As expected, there are significantly better benchmarks shown at https://www.modular.com/blog/the-worlds-fastest-unified-matr... so perhaps this whole discussion truly is just a matter of the demo not showcasing the true power of the system. Hopefully achieving those high performance numbers for sgemm is doable without too much ugly code.
I have an idea of a dream GPU infrastructure based on compute shaders, where you compile your problem into GPU IR suitable for your operating system (SPIR-V, Metal, DXIL) and have a very lightweight runtime that just runs those. For the ahead of time compilation case, you wouldn't need to ship GPU compilers in a deployed application, though you would want that for more rapid iteration when doing research and exploratory programming.
From what I can see so far, this seems basically orthogonal to what Modular and Mojo are trying to do, but it's entirely possible I'm missing something. I'm wondering if anyone is actually building this (IREE and MediaPipe are the closest things in the space I'm aware of), and if not, why not.
What does this mean?
Reading the docs it seems there are still some things that aren't settled and I would like to offer my feedback. From https://docs.modular.com/mojo/programming-manual.html:
> Alternative: instead of using the `&` sigil, we could call this an `inout` argument.
I think you should do this. What makes Python great is its readability so don't compromise on this.
[FWIW, folks waiting for this should also look at Cython, which is different, but uses Pythonic syntax for more of a C-like semantics.]
Mojo seems to be targeting Mojo -> Python -> Mojo too (i.e. Mojo can do high level control flow, delegate some more control flow / unsupported ops to Python, then implement some accelerator supports that Python will call back to). This can be quite difficult if you want to have very low bridging cost (Python objects are quite large and different libraries, such as Python / numpy have different representations in C on top of these Python objects).
It is all possible (after all, we are doing computer stuff), but it is a quite difficult path comparing to other success interop stories (Swift / ObjC took a decade to achieve somewhat low bridging cost, Kotlin / Java simply gives up and doing everything in JVM).
Nvidia has a ton of lock-in with CUDA. Seems like it could shake up the GPU industry if this takes hold as a standard tool in ML. Also, I'd imagine AMD, Intel, Apple, and others will be lining up at the door to sponsor this project.
There are a few options for going smaller (e.g. StaticCompiler.jl), but they're not very mature yet.
[1]: https://www.reddit.com/r/Julia/comments/ytegfk/size_of_a_hel...
[2]: https://discourse.julialang.org/t/standalone-hello-world-exe...
Perhaps this time, we finally have one that is a proper replacement for anything requiring intensive compute and performance without being a systems programmer, all thanks to the finest compiler engineers who brought you LLVM, MLIR and now Mojo. (Not the AI hype squad sitting on O̶p̶e̶n̶AI.com's APIs.)
If you know Python you have learned 90% of Mojo. Just waiting to see if it can compile to a binary.
If not, it's going to be hard to make the switch
https://docs.modular.com/mojo/programming-manual.html#python... https://docs.modular.com/mojo/notebooks/Mandelbrot.html
> We utilize CPython to run all existing Python3 code “out of the box” without modification and use its runtime, unmodified, for full compatibility with the entire ecosystem
I’m a bit confused.
Or it's port to TypeScript: https://mojojs.org
The AI industry is currently beholden to Nvidia, in part because of CUDA's superiority over ROCm. Therefore there's a big need for projects like this.
See also: https://openai.com/research/triton
> The Mojo standard library, compiler, and runtime are not available for local development yet, so we created a hosted development environment where you can try it out. We call it the Mojo Playground!
Is this going to be a SaaS-style programming language, or will it be open source and local later? I'm not sure I understand why a new programming language wouldn't start off as open source, or at least able to be used locally?
Like the language is full interop with the existing JS ecosystem, but if I opt into certain restrictions (and run on some novel runtime), I get an insta-performance boost?
Personally wonder if the Typescript team themselves could drive this short of evolution, albeit I know that lately they're very committed to being "just types" and nothing that affects runtime. Which I get.
It looks sooo good. Once it turns into FOSS (if it does), I will start using it as quickly as I can.
Then, if and when it gets more mature, and delivers on its promises, I might start using it at my work.
Do you have an ambitioned release date? Maybe in 2024?
If it’s due to the language design, how will Mojo avoid a GIL, given its goal is to be a superset of Python?
Bit of both? The language expects properties that lend themselves to having a GIL (i.e. attempts at removing it from CPython have turned out to make it slower in many cases), but it's not impossible for an implementation that does more advanced analysis to be able to figure out cases where it isn't needed.
Code written to massively parallelize will want to/have to keep accesses inside the thread context anyways, and thus won't hit cases the GIL serves, and if you allow language extensions they can make that explicit where needed.
(1) cannot be achieved without a custom linker or using a JIT such as LLVM or compiling to WASM and embedding a WASM runtime into the binary
I really hope Nim gets some language/compiler upgrades due to this.
I prefer writing an explicit wrapper anyway. It allows me to rename symbols to a more idiomatic name.