8/17/2026 at 9:20:18 PM
> This module is under active development. Once upstream, it should allow Rust developers to run Rust code on GPUs. We aim to develop a rusty GPU programming interface, which is safe, convenient and sufficiently fast by default. This includes automatic data movement to and from the GPU, in a efficient way. We will (later) also offer more advanced, possibly unsafe, interfaces which allow a higher degree of control.I really appreciate the work and the effort that went into this. However, such an approach has previously not really worked for C++ with LLVM offload. Why would it work for Rust?
by whateverboat
8/17/2026 at 10:19:48 PM
> However, such an approach has previously not really worked for C++ with LLVM offload. Why would it work for Rust?They're very different languages, with different semantics. Without reading more than the synopsis of the paper, they're 100% leveraging the substructural type system and will have a really tight requirement for you to use a certain kind of Rust code at the CPU/GPU boundary.
by ux266478
8/18/2026 at 5:42:46 PM
To answer my own question apparently,With C++ the last time, the problem was that there was no MLIR and it's dialects. So, the lowering could not take advantage of any vendor specific features like CUDA graphs and co-operative groups. That has apparently now change with MLIR being a possibility, but with C++, it is still in the experimental phase with CIR not finalized yet, even though people are working quiet hard on it.
With Rust, I am not sure if Rust lowers to MLIR, but if it does, then things should work otherwise not. However, knowing that all GPU vendors are working very hard on CIR and lowering to MLIR, and seeing how much time it is taking them, I would be surprised (pleasantly so) if Rust --> MLIR --> Backend would be faster.
Nvidia has started experimenting with Native Rust so it is still a possibility but still a pleasantly surprising one.
by whateverboat
8/18/2026 at 7:11:36 AM
Unfortunately, the Rust description itself is inconsistent. It claims to be "sufficiently fast by default", yet "sufficiently fast" depends entirely on the requirements of a specific user project. And then it also plans to provide options that do not guarantee memory safety when the default speed is insufficient. It is already common for Rust projects to sprinkle memory unsafe code around when performance is needed.by erupti
8/18/2026 at 9:45:16 AM
> It claims to be "sufficiently fast by default", yet "sufficiently fast" depends entirely on the requirements of a specific user project.I think that's why the "by default" is there; the goal is to offer a safe/convenient API that performs well enough that by default you don't need to reach beyond said safe/convenient API. And if you happen to be in a situation where the default performance of the safe/convenient APIs is insufficient, more advanced APIs will be provided.
It's a mirror of Rust's general design goals, if anything.
by aw1621107
8/18/2026 at 1:42:25 PM
But it still depends on the requirements of the specific user project, whether the default is sufficiently fast, ESL. It is still entirely inconsistent. Basic logic 101, clear as day. Why do you even try to contest this?> It's a mirror of Rust's general design goals, if anything.
Do you claim that "it's a mirror of Rust's general design goals, if anything" to be forced into memory unsafe, extra-difficult Rust code being required, when the going already gets tough regarding performance requirements? That is not a great design goal, and it is not conducive to memory safety nor high quality software.
by erupti2
8/20/2026 at 2:44:44 PM
Could you please stop creating accounts for every few comments you post? We ban accounts that do that. This is in the site guidelines: https://news.ycombinator.com/newsguidelines.html.You needn't use your real name, of course, but for HN to be a community, users need some identity for other users to relate to. Otherwise we may as well have no usernames and no community, and that would be a different kind of forum. https://hn.algolia.com/?sort=byDate&dateRange=all&type=comme...
by dang
8/18/2026 at 2:34:49 PM
> But it still depends on the requirements of the specific user project, whether the default is sufficiently fastI mean, "by default" means "by default", not "in all cases". Situations that the default doesn't address are not inconsistent with the existence of a default; it's just that said situations are expected to be a relative minority.
Perhaps a more concrete example would help: say the API the devs come up with is sufficiently fast enough for 99 common use cases and not fast enough for 1 uncommon one. I don't think it'd be inconsistent to call said API "sufficiently fast by default" since "sufficiently fast" is an accurate description of the API for "normal" use (i.e., that's the "default" state).
> Do you claim that "it's a mirror of Rust's general design goals, if anything" to be forced into memory unsafe, extra-difficult Rust code being required, when the going already gets tough regarding performance requirements?
No, I think that's a rather... imaginative interpretation of what I said.
by aw1621107
8/18/2026 at 10:54:27 AM
I wonder if they're looking to achieve easy speedups. I can see lots of value enabling performance gains where normally people wouldn't bother because it's too much effort. I don't think this will take away work from those who hand-optimise their kernels and scheduling, this is to enable GPU acceleration for those, who otherwise wouldn't.by eptcyka
8/17/2026 at 9:48:19 PM
> However, such an approach has previously not really worked for C++ with LLVM offload. Why would it work for Rust?I think that will depend on the exact reason(s) C++ with LLVM offload didn't work out? If Rust differs from C++ in a way that addresses pain points/failure modes/etc. from the C++ attempt, for instance, then perhaps it isn't unreasonable to think Rust could succeed where C++ didn't (c.f., Mozilla's pre-Rust attempts to parallelize Firefox's CSS styling engine). Inversely, if Rust doesn't do things differently in the right way perhaps one might expect the effort to also not work out. Or maybe the problems are entirely non-technical and things could work out in either language.
by aw1621107
8/18/2026 at 7:14:27 AM
[flagged]by erupti
8/17/2026 at 11:05:48 PM
Seems to work out well for Mojo, so I'd guess it's more an issue with C++.by boxed
8/18/2026 at 11:47:04 AM
Well mojo handles it by introducing an additional step of lowering code to MLIR as an intermediate representation. Something that can be done with C++ as wellby nylonstrung
8/18/2026 at 2:08:13 PM
In fact, clang is in the process of adding an MLIR layer as well, ClangIR.by pjmlp
8/17/2026 at 11:22:01 PM
> However, such an approach has previously not really worked for C++ with LLVM offload... isn't Metal shading language just C++17 compiled with LLVM ? working on every Mac and iPhone in the world is not what I would call "not really worked". Likewise, SYCL works just fine.
by jcelerier
8/18/2026 at 7:28:50 AM
It is C++14.by pjmlp
8/21/2026 at 3:21:03 AM
no, it has been updated to C++17 in metal 4: https://developer.apple.com/metal/Metal-Shading-Language-Spe...by jcelerier
8/17/2026 at 11:48:03 PM
bruh lol this is so wrong and so confident i don't want to even attempt to explain how wrong you are.> just C++17 compiled with LLVM
i invite you to attempt to compile/run absolutely any C++17 codebase on your iphone's GPU lol!
by mathisfun123
8/18/2026 at 7:28:26 AM
For starters Metal Shading Language is based on C++14, so naturally any C++17 will fail.by pjmlp
8/18/2026 at 1:20:08 AM
I mean "any C++ codebase" doesn't make sense in general. I run C++23 code on ESP32, that doesn't mean I'm gonna build KDE or chrome for it, and that doesn't make it any less C++.by jcelerier
8/18/2026 at 12:55:26 AM
Wouldn't any metal app have to be written in C++17?by nish__
8/17/2026 at 10:52:22 PM
[dead]by winningChild
8/17/2026 at 10:52:47 PM
[dead]by winningChild