Live data from Hacker News

Highly efficient matrix transpose in Mojo

veitner.bearblog.dev

61–70 of 70 posts

Re: Highly efficient matrix transpose in Mojo

#61
post #59

Earlier quoted context omitted.

My impression is that this is on purpose on their part. They’ve repeatedly stated that by 2026 they will open source the compiler, and I think they’ve wanted a slow adoption ramp in order to spend some more time getting it right first. Possibly rose-tinted glasses on my part, but I’m optimistic for 2026. Chris Lattner has a pretty strong track record of getting these things right.

Yeah, and he's clearly trying to avoid what happened to Swift[1]. Although the danger of "corporate owner priorities dictate releasing half-baked/awful changes" risk is still there, Lattner himself has more influence within Modular (obviously, as co-founder and CEO) than he did at Apple, so it may work out better this time. [1]: https://news.ycombinator.com/item?id=30416070

Yeah, Mojo's development has been pretty transparent. Chris publishes technical documents for most features and takes community feedback into account. A recent example is here: https://forum.modular.com/t/variable-bindings-proposal-discu...

Btw, Mojo's development is a masterclass in language development and community building, it's been fun watching Chris go back to fix technical debts in existing features rather than proceeding with adding new features.

Re: Highly efficient matrix transpose in Mojo

#62

Earlier quoted context omitted.

I work on Mojo. The whole compiler, runtime etc. will get open sourced, most likely within a year. It is just a matter of time and us getting all the required work done. https://docs.modular.com/mojo/faq/#open-source

> runtime Are you talking about your libc equivalent or MAX?

Both.

Mojo standard library is already open source. Mojo at the moment does not need a runtime (but if it ever needs one it'd get open sourced). My point was, Mojo as a whole, as a programming language & a reference implementation, will definitely get open sourced.

MAX itself is a bigger beast to work with, and I am out of my depth to talk about it. I think it'll get open sourced as well, just the timeline might be different (shorter or longer, IDK).

Re: Highly efficient matrix transpose in Mojo

#63
post #59

Earlier quoted context omitted.

My impression is that this is on purpose on their part. They’ve repeatedly stated that by 2026 they will open source the compiler, and I think they’ve wanted a slow adoption ramp in order to spend some more time getting it right first. Possibly rose-tinted glasses on my part, but I’m optimistic for 2026. Chris Lattner has a pretty strong track record of getting these things right.

Yeah, and he's clearly trying to avoid what happened to Swift[1]. Although the danger of "corporate owner priorities dictate releasing half-baked/awful changes" risk is still there, Lattner himself has more influence within Modular (obviously, as co-founder and CEO) than he did at Apple, so it may work out better this time. [1]: https://news.ycombinator.com/item?id=30416070

> he's clearly trying to avoid what happened to Swift

Also to MLIR while Lattner was at Google:

> MLIR was born—a modular, extensible compiler infrastructure designed to bring order to the chaos. It brought forth a foundation that could scale across hardware platforms, software frameworks, and the rapidly evolving needs of machine learning. It aimed to unify these systems, and provide a technology platform that could harmonize compute from many different hardware makers.

But unification is hard. What started as a technical project quickly turned into a battleground: open-source governance, corporate rivalries, and competing visions all collided. What could have been a straightforward engineering win became something much more complicated.

https://www.modular.com/blog/democratizing-ai-compute-part-8...

Re: Highly efficient matrix transpose in Mojo

#64

Earlier quoted context omitted.

,,will get open sourced'' means closed source, parent wrote the same

Chris Lattner (the CEO of Modular) was previously the technical lead behind the creation of LLVM, Clang and Swift, all of which were open sourced. He has a bit of a track record already.

Sure, but at that time he was employed by Apple for example.

Now he's making a for profit company and there's already MAX and MAX Enterprise stuff to not trust that the open source part would be competitive with already great inferencing frameworks for example.

Re: Highly efficient matrix transpose in Mojo

#65
post #55

Fast matrix transpose? Agree for a transposed matrix, just change the indexing arithmetic that converts row i and column j to an offset in the storage for the matrix and then remember that this is a transposed matrix. Some software object semantics could make this easy for other software to use.

i think the problem with changing the indexing arithmetic is that you could end up with arithmetic incompatible with vector instructions in hardware that you're hoping to use for parallelism.

Re: Highly efficient matrix transpose in Mojo

#66
post #59

Earlier quoted context omitted.

My impression is that this is on purpose on their part. They’ve repeatedly stated that by 2026 they will open source the compiler, and I think they’ve wanted a slow adoption ramp in order to spend some more time getting it right first. Possibly rose-tinted glasses on my part, but I’m optimistic for 2026. Chris Lattner has a pretty strong track record of getting these things right.

Yeah, and he's clearly trying to avoid what happened to Swift[1]. Although the danger of "corporate owner priorities dictate releasing half-baked/awful changes" risk is still there, Lattner himself has more influence within Modular (obviously, as co-founder and CEO) than he did at Apple, so it may work out better this time. [1]: https://news.ycombinator.com/item?id=30416070

It was just very difficult primarily because of the way the license limitations and install steps made it difficult to drop it into the existing python tooling ecosystem.

I haven’t tried it in a long time, but as it’s a Python superset, I tried to drop it into my jupyter notebook docker container and you had to agree to license terms and register your email and install a modular package that contained a bunch of extra things.

If you want to get widespread adoption for a python superset, you would probably want to get it included in the official jupyter docker images as people who do this sort of programming like to use a jupyter repl, but they just made it so difficult.

I’m no open source zealot and I’m happy to pay for software, but I think the underlying language needs to be a lot more open to be practical.

Re: Highly efficient matrix transpose in Mojo

#67
post #55

Fast matrix transpose? Agree for a transposed matrix, just change the indexing arithmetic that converts row i and column j to an offset in the storage for the matrix and then remember that this is a transposed matrix. Some software object semantics could make this easy for other software to use.

i think the problem with changing the indexing arithmetic is that you could end up with arithmetic incompatible with vector instructions in hardware that you're hoping to use for parallelism.

> vector instructions

Gee, for the polar decomposition, Gauss-Seidel, etc., looked really hard for those in my IBM PC/XT and couldn't find any!!!

Re: Highly efficient matrix transpose in Mojo

#69

Earlier quoted context omitted.

Unfortunately the issue (alluded to in the blog post you linked) is that transposes do absolutely no work but memory loads. Sure, they test that you can swizzle your accesses, but modern accelerators are all about pipelining and feeding matrix multiply units, which is considerably harder than loading from memory as fast as possible. Actually, even the Mojo post barely beats CUDA for most of its kernels, because you c…

I totally agree that the resulting kernel will be rarely useful. I just wanted to highlight that it is a commonly used educational exercise to showcase how to optimize for memory throughput. If the post showed how to fuse a transpose + rmsnorm epilogue to a gemm then the kernel would be more functional but the blog post would be much harder to follow for newcomers. Jay Shah’s later articles contain examples that invo…

It's less that the result is kind of useless and more that hitting memory throughput on a simple algorithm like this is not very difficult. It takes a complex example to actually have trouble doing this.

Re: Highly efficient matrix transpose in Mojo

#70

Earlier quoted context omitted.

Look the frontier AI companies need something other than reversing binary trees to give interview candidates

No one is going to ask this on an interview. Used to be matmul. These days it's FA.

I think these would be rather difficult to fit in a standard 1-hour interview slot
Post reply on HN