Live data from Hacker News

Highly efficient matrix transpose in Mojo

veitner.bearblog.dev

21–30 of 70 posts

Re: Highly efficient matrix transpose in Mojo

#21
post #5

Mojos compiler is closed source. Thats a big no-no

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

Re: Highly efficient matrix transpose in Mojo

#23
post #8

The "Switching to Mojo gave a 14% improvement over CUDA" title is editorialized, the original is "Highly efficient matrix transpose in Mojo". Also, the improvement is 0.14%, not 14% making the editorialized linkbait particularly egregious.

Yeah, it seems like the blog post is just meant to be an example of how to do something in Mojo and not a dunk on CUDA.

FWIW I didnt take the blog as a dunk on CUDA, just as an impressive outcome from the blog writer in Mojo. It's awesome to see this on Hopper - if it makes it go faster thats awesome.

Re: Highly efficient matrix transpose in Mojo

#24
post #20
post #8

The "Switching to Mojo gave a 14% improvement over CUDA" title is editorialized, the original is "Highly efficient matrix transpose in Mojo". Also, the improvement is 0.14%, not 14% making the editorialized linkbait particularly egregious.

[op here] To be clear: Yes, there are 3 kernels - you can see those in the linked github at the end of the article if you clicked that. These are: transpose_naive - Basic implementation with TMA transfers transpose_swizzle - Adds swizzling optimization for better memory access patterns transpose_swizzle_batched - Adds thread coarsening (batch processing) on top of swizzling Performance comparison with CUDA: The Mojo…

Users of the site only have one control available: the flag. There's no way to object only to the title but not to the post, and despite what you say that title hit the trifecta: not the original title, factually incorrect, and clickbait. So I'm not that surprised it got flagged (even if I did not flag it myself).

Email the mods at hn@ycombinator.com. There's a chance they'll remove the flag and re-up the post.

Re: Highly efficient matrix transpose in Mojo

#25

Why do we ever need to transpose a matrix? Isn't it better to simply combine the transposition with whatever next operation one wishes to do with the matrix?

The next operation might need the data in column major order to read it fast. So you might have to transpose first. And these maybe be concurrent stages of a processing pipeline.

Re: Highly efficient matrix transpose in Mojo

#26
post #24
post #20

Earlier quoted context omitted.

[op here] To be clear: Yes, there are 3 kernels - you can see those in the linked github at the end of the article if you clicked that. These are: transpose_naive - Basic implementation with TMA transfers transpose_swizzle - Adds swizzling optimization for better memory access patterns transpose_swizzle_batched - Adds thread coarsening (batch processing) on top of swizzling Performance comparison with CUDA: The Mojo…

Users of the site only have one control available: the flag. There's no way to object only to the title but not to the post, and despite what you say that title hit the trifecta: not the original title, factually incorrect, and clickbait. So I'm not that surprised it got flagged (even if I did not flag it myself). Email the mods at hn@ycombinator.com. There's a chance they'll remove the flag and re-up the post.

thanks jsnell - i did they and they appreciated the comment above, and unflagged it. i appreciate it!

Re: Highly efficient matrix transpose in Mojo

#27

Why do we ever need to transpose a matrix? Isn't it better to simply combine the transposition with whatever next operation one wishes to do with the matrix?

You're right that a good graph compiler will do this for you. There still may be times, like if you're interfacing with another library, where you'll need to switch a matrix between row major or column major layouts.

Re: Highly efficient matrix transpose in Mojo

#29
post #5

Mojos compiler is closed source. Thats a big no-no

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?

Re: Highly efficient matrix transpose in Mojo

#30

Why do we ever need to transpose a matrix? Isn't it better to simply combine the transposition with whatever next operation one wishes to do with the matrix?

The next operation might need the data in column major order to read it fast. So you might have to transpose first. And these maybe be concurrent stages of a processing pipeline.

Now I'm curious, how many times do you have to fully read the matrix in GPU for the total impact of reading columns to be higher than one-off actual transpose and then sequential row reads? I know it depends on lots of things, I'm after a rough estimate.
Post reply on HN