Mojo Is Finally Open Source... So I Tested It

BBetter Stack
컴퓨터/소프트웨어

스크립트

00:00:00Mojo, the programming language, just hit 1.0, and the timing is a bit weird.
00:00:05It launched with a closed compiler, seven days later they open-sourced it,
00:00:09and Qualcomm had just bought the company.
00:00:12But let's forget all that for a second.
00:00:14Mojo's real thing is Python-like code without dropping the C++ or CUDA for speed.
00:00:20So let's see if this actually delivers.
00:00:27The whole thing with Mojo is the question.
00:00:30What if you could write code that feels and looks just like Python,
00:00:34but run the parts that actually matter without dropping the C++ or CUDA?
00:00:39One readable language across CPU and GPU.
00:00:42That's the whole thing here.
00:00:43And now that Mojo is finally 1.0, I wanted to actually see how much of this is actually real.
00:00:49So before we get into Qualcomm open-source any of that, let's just run it.
00:00:53If you enjoy coding tools to speed up your workflow, be sure to subscribe.
00:00:57We have videos coming out all the time.
00:00:59I'm going to do this on my machine, but I'm not going to do a Mojo tutorial here.
00:01:03If you've never seen it before, then yes, it's going to look like Python,
00:01:07but you're going to see some key differences.
00:01:10On the left side is Python.
00:01:12On the right side is Mojo.
00:01:13It's the same loop, the same grid, the same iteration cap.
00:01:17I'm not going to walk through any of the math on this.
00:01:20Watch the two while loops.
00:01:21They're doing the same thing.
00:01:23We're going to run Python first here.
00:01:26Okay, great.
00:01:27It ran.
00:01:28It executed.
00:01:28Now, the same program that is compiled with Mojo.
00:01:32Again, let's run it.
00:01:35And boom.
00:01:35There we go.
00:01:36Now, the check sums will not match the last digit.
00:01:39They differ by a couple of hundred on a quarter million.
00:01:43Python does multiply, then add.
00:01:45The Mojo compile can fuse that into one instruction.
00:01:49A few pixels take an extra iteration.
00:01:51Treat the seconds here as the real number.
00:01:54And this is not NumPy.
00:01:55It's not a model.
00:01:56Performance is not only the CPU loop got faster.
00:02:00You can start in Python because it is easy.
00:02:03Then the path moves to C++ or CUDA.
00:02:06Now you own two files and they start to kind of drift apart.
00:02:09So, here is the question Mojo is asking.
00:02:12Can the file you read in the same file that hits the GPU be the same file?
00:02:17This function is the kernel.
00:02:18Each GPU thread adds one pair of numbers.
00:02:20That's it.
00:02:21I did not switch to Metal or Swift or CUDA.
00:02:24Compile it.
00:02:26And now we got the code running.
00:02:28So, yes.
00:02:30Mojo can do something pretty interesting here.
00:02:32And I just compiled a working GPU kernel on a MacBook using the same language I was writing
00:02:38normal code in, Python.
00:02:40Your machine learning code starts in Python because Python is easy to work with.
00:02:44We all know this.
00:02:45Then, eventually, down the line, performance starts to matter.
00:02:48So, the important parts get rewritten in C++ or CUDA.
00:02:52Now, we're maintaining two versions of the same system.
00:02:55And again, over time, that just adds to confusion.
00:02:58Mojo's thing is that the readable file and the fast file are just the same thing.
00:03:03Now, the person behind all this is Chris Lattner.
00:03:06He built LLVM, then Clang, and then Swift.
00:03:10But getting a GPU kernel running is one thing.
00:03:14Calling the language 1.0, that's a bit different here.
00:03:18So, what does 1.0 actually mean here?
00:03:21Not that Mojo is finished.
00:03:23It more or less means stability.
00:03:25There are promises that the code you write today won't break.
00:03:29That's what a major release like this is.
00:03:30But then you hit the first weird part.
00:03:32Mojo reached 1.1 before its compiler was even open source.
00:03:37The standard library had already opened in March 2024.
00:03:40The max kernels opened in 2025.
00:03:43But the compiler, the actual thing doing compiling, that stayed proprietary until August 18th of this year.
00:03:50Apache 2.0, and that's important because just seven days earlier when Mojo 1.0 was shipped, it was still closed.
00:03:57And that answers one of the biggest criticisms Mojo has had in three straight years.
00:04:02You used to be able to say, sure, but the compiler is closed.
00:04:05We can't really say that anymore, which sounds like, okay, this is moving in the right direction.
00:04:10It might be.
00:04:10Until you look at what happened three weeks earlier.
00:04:14Qualcomm's acquisition completed July 29th.
00:04:16Mojo 1.0 shipped August 11th.
00:04:19The compiler opened August 18th.
00:04:21So the biggest openness milestone in Mojo's history happened in less than three weeks after Modular stopped being their own independent company.
00:04:29And that immediately creates two completely different ways to read this.
00:04:33Number one is Qualcomm Bot Modular because it wants Mojo everywhere.
00:04:37Probably not.
00:04:37Or a Qualcomm Bot Modular, and eventually this whole thing gets absorbed into a much bigger company.
00:04:44Qualcomm makes chips.
00:04:45A language that compiles well to chips becomes a lot more valuable.
00:04:49We can actually use it freely.
00:04:50So, the open source move, that makes sense.
00:04:53But whether Mojo succeeds probably won't come down to Qualcomm.
00:04:57It's going to come down to whether the language is actually good enough to justify switching in the first place.
00:05:02But again, this is where all that starts to get messy.
00:05:05Mojo has a benchmark problem.
00:05:07Back in 2023, the big number was Mojo could be 68,000 times faster than Python.
00:05:13That's insane.
00:05:14There's also a post still live claiming Mojo is 50% faster than Rust on DNA parsing.
00:05:19That benchmark was taken apart.
00:05:21They showed that the benchmark wasn't measuring what it claimed to measure.
00:05:25And you'll still see the 35,000 times floating around.
00:05:29That comes from matrix multiplication.
00:05:31But what they're comparing is, well,
00:05:34on one side, a fully vectorized, paralyzed, tiled Mojo implementation.
00:05:40On the other side, a pure Python triple loop.
00:05:44Yeah, a triple loop.
00:05:45Not NumPy, just a nested loop that nobody on Earth would actually use.
00:05:49So I don't really care about the 35,000 times faster thing.
00:05:52I wanted numbers from this machine.
00:05:54I'm on an M4 Pro against pure Python.
00:05:57Against pure Python, 26 and a half times faster.
00:06:00Against NumPy, per operation, close to about two times faster.
00:06:05Now, obviously, 26 is not 68,000.
00:06:08But 26 times is still a good number because NumPy is already C underneath.
00:06:14At that point, you're not really beating Python.
00:06:16You're beating C with better memory behavior.
00:06:19And that's the frustrating thing about Mojo.
00:06:21But performance isn't actually the biggest reason I'd hesitate to use Mojo today.
00:06:25I've played with it before.
00:06:27I'm running it here today.
00:06:28The big thing is stable.
00:06:30Now, how stable is this?
00:06:32Because Mojo 1.0 ships with 41 unstable API warnings, including int, print, and len, core built-ins.
00:06:40They were flagged unstable inside a so-called stability release.
00:06:45And on the same day Mojo promises your code wouldn't break, removing the FN keyword broke roughly 39 package ecosystem.
00:06:52Now, the FN keyword that was huge in how Mojo operated completely removed.
00:06:58No FC process.
00:06:59And while the compiler is now open source, they're not accepting contributions to it yet.
00:07:04So Mojo 1.0 is stable, I guess.
00:07:07But maybe not as stable as they're saying.
00:07:09Which brings us to the only question that really matters.
00:07:12Should you use this?
00:07:13Now, if you write GPU kernels, CUDA, Triton, that world, I think Mojo is absolutely worth a day or two.
00:07:21One language across CPU and GPU, and I compiled a working GPU kernel on a laptop.
00:07:27There isn't much else that does that.
00:07:29But this still has a lot of room to grow.
00:07:31So I wouldn't prioritize this by any means just yet.
00:07:35Three years ago, the argument against Mojo was pretty simple.
00:07:38Cool new language, but who's going to use this?
00:07:40It was a closed language from a startup asking devs to bet everything on this.
00:07:44Today, the compiler is Apache 2.0.
00:07:47The language is 1.0.
00:07:48And that startup is now a part of Qualcomm.
00:07:51I'm Josh from BetterStack.
00:07:53If you enjoy coding tips and tricks like this, be sure to subscribe.
00:07:56We'll see you in another video.

핵심 요약

Mojo reached 1.0 and open-sourced its compiler under Apache 2.0 following Qualcomm's acquisition, achieving 26.5x faster performance than pure Python while still navigating early ecosystem instability.

하이라이트

  • Mojo reached 1.0 stability and open-sourced its compiler under the Apache 2.0 license following Qualcomm's acquisition of Modular.

  • Mojo runs CPU loops 26.5 times faster than pure Python and operates about twice as fast per operation compared to NumPy on an M4 Pro.

  • Mojo 1.0 launched with 41 unstable API warnings affecting core built-ins like int, print, and len.

  • Removing the FN keyword in Mojo 1.0 broke roughly 39 packages within the ecosystem.

  • The compiler is open source under Apache 2.0, but external contributions to it are not yet accepted.

타임라인

Mojo 1.0 Performance and GPU Kernels

  • Mojo aims to provide Python-like syntax while maintaining C++ or CUDA-level speeds across CPU and GPU.
  • A single Mojo file can execute as a working GPU kernel without switching to separate languages like Metal or Swift.
  • Performance benchmarks on an M4 Pro show Mojo running 26.5 times faster than pure Python and roughly 2 times faster than NumPy per operation.

Mojo eliminates the traditional machine learning workflow divide where code starts in easy Python and gets rewritten in C++ or CUDA for performance. Compiling a working GPU kernel directly on a laptop demonstrates the language's ability to maintain a single readable and fast file across different hardware targets.

Open Source Release and Qualcomm Acquisition

  • Mojo reached 1.0 to guarantee API stability so written code does not break.
  • Qualcomm's acquisition of Modular concluded on July 29th, preceding the Mojo 1.0 release on August 11th and the compiler open-sourcing on August 18th.
  • The compiler is now licensed under Apache 2.0, resolving three years of criticism regarding its closed-source nature.

The timeline connects Modular's acquisition by chipmaker Qualcomm directly to the rapid open-sourcing of the Mojo compiler under the Apache 2.0 license. This move aligns chip production capabilities with a language designed to compile efficiently to hardware targets.

Ecosystem Stability and Adoption Verdict

  • Early benchmark claims citing extreme speedups often compared optimized tiled Mojo against unoptimized pure Python triple loops.
  • Mojo 1.0 ships with 41 unstable API warnings on core built-ins like int, print, and len.
  • The removal of the FN keyword broke approximately 39 packages in the ecosystem despite stability promises.

Despite impressive performance numbers against NumPy and Python, Mojo exhibits significant ecosystem instability at version 1.0. Core built-in warnings, broken packages from keyword removals, and a closed contribution policy for the newly open-sourced compiler suggest the language still requires maturation before broad prioritization.

커뮤니티 글

아직 글이 없습니다. 이 영상에 대한 첫 번째 글을 작성해 보세요!

이 영상에 대해 글쓰기