Remix.run Logo
LegNeato 6 days ago

The demo is admittedly a rube goldberg machine, but that's because this was the first time it is possible. It will get more integrated over time. And just like normal rust code, you can make it as abstract or concrete as you want. But at least you have the tools to do so.

That's one of the nice things about the rust ecosystem, you can drill down and do what you want. There is std::arch, which is platform specific, there is asm support, you can do things like replace the allocator and panic handler, etc. And with features coming like externally implemented items, it will be even more flexible to target what layer of abstraction you want

flohofwoe 6 days ago | parent | next [-]

> but that's because this was the first time it is possible

Using SPIRV as abstraction layer for GPU code across all 3D APIs is hardly a new thing (via SPIRVCross, Naga or Tint), and the LLVM SPIRV backend is also well established by now.

LegNeato 6 days ago | parent | next [-]

Those don't include CUDA and don't include the CPU host side AFAIK.

SPIR-V isn't the main abstraction layer here, Rust is. This is the first time it is possible for Rust host + device across all these platforms and OSes and device apis.

You could make an argument that CubeCL enabled something similar first, but it is more a DSL that looks like Rust rather than the Rust language proper(but still cool).

socalgal2 6 days ago | parent [-]

> This is the first time it is possible for Rust host + device across all these platforms and OSes and device apis.

I thought wgpu already did that. The new thing here is you code shaders in rust, not WGSL like you do with wgpu

LegNeato 6 days ago | parent [-]

Correct. The new thing is those shaders/kernel also run via CUDA and on CPU unchanged. You could not do that with only wgpu...there is no rust shader input, (and the thing that enables it rust-gpu which is used here) and if you wrote your code in a shader lang it wouldn't run on the CPU (as they are made for GPU only) or via CUDA.

winocm 6 days ago | parent | prev [-]

LLVM SPIR-V's backend is a bit... questionable when it comes to code generation.

90s_dev 6 days ago | parent | prev [-]

"It's only complex because it's new, it will get less complex over time."

They said the same thing about browser tech. Still not simpler under the hood.

a99c43f2d565504 6 days ago | parent | next [-]

As far as I understand, there was a similar mess with CPUs some 50 years ago: All computers were different and there was no such thing as portable code. Then problem solvers came up with abstractions like the C programming language, allowing developers to write more or less the same code for different platforms. I suppose GPUs are slowly going through a similar process now that they're useful in many more domains than just graphics. I'm just spitballing.

jcranmer 6 days ago | parent | next [-]

The first portable programming language was, uh, Fortran. Indeed, by the time the Unix developers are thinking about porting to different platforms, there are already open source Fortran libraries for math routines (the antecedents of LAPACK). And not long afterwards, the developers of those libraries are going to get together and work out the necessary low-level kernel routines to get good performance on the most powerful hardware of the day--i.e., the BLAS interface that is still the foundation of modern HPC software almost 50 years later.

(One of the problems of C is that people have effectively erased pre-C programming languages from history.)

dotancohen 6 days ago | parent | prev | next [-]

  > I suppose GPUs are slowly going through a similar process now that they're useful in many more domains than just graphics.
I've been waiting for the G in GPU to be replaced with something else since the first CUDA releases. I honestly think that once we rename this tech, more people will learn to use it.
ecshafer 6 days ago | parent [-]

MPU - Matrix Processing Unit

LAPU - Linear Algebra Processing Unit

carlhjerpe 6 days ago | parent | next [-]

PPU - Parallel processing unit

dotancohen 6 days ago | parent | prev [-]

LAPU is terrific. It also means paw in Russian.

pjmlp 6 days ago | parent | prev | next [-]

Computers have been enjoying high level systems languages, a decade predating C.

Yoric 6 days ago | parent [-]

But it's true that you generally couldn't use the same Lisp dialect on two different families of computers, for instance.

pjmlp 6 days ago | parent [-]

Neither could you with C, POSIX exists for a reason.

Yoric 5 days ago | parent [-]

Good point.

Maken 6 days ago | parent | prev [-]

And yet, we are still using handwritten assembly for hot code paths. All these abstraction layers would need to be porous enough to allow per-device specific code.

pizza234 6 days ago | parent [-]

> And yet, we are still using handwritten assembly for hot code paths

This is actually a win. It implies that abstractions have a negligible (that is, existing but so small that can be ignored) cost for anything other than small parts of the codebase.

luxuryballs 6 days ago | parent | prev | next [-]

now that is a relevant username

turnsout 6 days ago | parent | prev | next [-]

Complexity is not inherently bad. Browsers are more or less exactly as complex as they need to be in order to allow users to browse the web with modern features while remaining competitive with other browsers.

This is Tesler's Law [0] at work. If you want to fully abstract away GPU compilation, it probably won't get dramatically simpler than this project.

  [0]: https://en.wikipedia.org/wiki/Law_of_conservation_of_complexity
jpc0 6 days ago | parent | next [-]

> Complexity is not inherently bad. Browsers are more or less exactly as complex as they need to be in order to allow users to browse the web with modern features while remaining competitive with other browsers.

What a sad world we live in.

Your statement is technically true, the best kind of true…

If work went into standardising a better API than the DOM we might live in a world without hunger, where all our dreams could become reality. But this is what we have, a steaming pile of crap. But hey, at least it’s a standard steaming pile of crap that we can all rally around.

I hate it, but I hate it the least of all the options presented.

bromantic 6 days ago | parent | prev [-]

I swear, if I had 2c for every <insert computer guy surname> supposed "law", I would be a millionaire now. Slogans make no law, but programmers sure love "naming things." In all fairness, the obsessive elevating of good-sounding slogans into colloquial "laws" is a uniquely American phenomenon. My pet-theory is that this goes back to old days when computer science wasn't considered a "real" science. That is, in "real" sciences there are laws, so the American computer science guys felt like inventing "laws" to be taken seriously.

turnsout 5 days ago | parent [-]

Okay sure, but Larry Tesler was a real one, and whatever you want to call it, his observation is spot-on.

If I had 2c for every time I've seen a "Senior" dev push the complexity around on their plate like it's spinach, I'd be a millionaire with you.

lukan 6 days ago | parent | prev | next [-]

Who said that?

90s_dev 6 days ago | parent [-]

They did.

Ygg2 6 days ago | parent [-]

Who is they? Aka [citation needed] aka weasel word.

Yoric 6 days ago | parent | prev [-]

Who ever said that?