Announcement
Collapse
No announcement yet.
Linux's VGEM Kernel Driver Being Rewritten In Rust
Collapse
X
-
Originally posted by sinepgib View PostThere are logical reasons to restrict Rust though. As with pretty much everything in engineering, there is a tradeoff and different programmers will tilt toward different decisions. For example, lifespan is a reasonable argument: compared to C, Rust is young, which means C is a (slightly, IMO) better bet for expecting it to be around in 20-30 years from now, simply because it already lived such long times.
Originally posted by sinepgib View PostYeah, I don't know how I missed this part really, as it is the most obvious one. But the parts that absolutely need assembly language tend to be few and small and are already not C (I mostly assume we only mean to rewrite the C parts, I may be wrong). Some will also be kept as assembly for performance, the sufficiently smart compiler that vectorizes complicated algorithms isn't yet here AFAIK.
Comment
-
Originally posted by jacob View PostIt definitely isn't there yet, but in many cases Rust already does a better job than C or C++ at autovectorising.
- Likes 1
Comment
-
Originally posted by jacob View PostThat is a fallacy, although I'm surprised how common it is. But by that logic, critically important new software should be written in COBOL because it has been around much longer than C. I'm not saying that Rust should always be the automatic choice, there are still cases where C is the better option (platform support, extreme memory constraints or the need to be entirely binding-friendly to the lowest common denominator), but the fact that C is older is neither here or there.
Originally posted by jacob View PostIt definitely isn't there yet, but in many cases Rust already does a better job than C or C++ at autovectorising.
- Likes 1
Comment
-
Originally posted by ssokolow View Post...and the use-cases for actual assembly language instead of compiler intrinsics (which are exposed by Rust) have become so niche that MSVC doesn't allow inline assembly on 64-bit targets.
As an aside, I wouldn't recommend inline assembly in C at all unless you definitely support one compiler only like Linux does or it's trivial enough to write an implementation per compiler. It's implementation defined and often incompatible between compiler, it's not very well defined, etc. Just write a function in a .s and link it like civilized people do.
- Likes 1
Comment
-
Originally posted by sinepgib View PostAll hand vectorization is niche. But the thing about niches is that they're irrelevant until you need them but they become critical when you do. Note this is not at all a criticism to Rust. Besides, Rust has decent support for inline assembly from what I'm told (haven't had to use it, so I can't confirm).
Originally posted by sinepgib View PostAs an aside, I wouldn't recommend inline assembly in C at all unless you definitely support one compiler only like Linux does or it's trivial enough to write an implementation per compiler. It's implementation defined and often incompatible between compiler, it's not very well defined, etc. Just write a function in a .s and link it like civilized people do.
- Likes 1
Comment
-
Originally posted by sinepgib View PostI see how it is a bit fallacious, but you have to acknowledge that many languages were oh so popular for a few years and then faded away in that time. IMO that happens mostly in the web backend space, but I see reasons to be skeptical in history. Rust is at its height in popularity right now. I don't think it's going away and I don't think critical infrastructure should be written in C (or COBOL lol). If anything, writing critical infrastructure in Rust is what will make it stay around after the ADHD of our collective mindshare finds some new shiny toy.
Originally posted by sinepgib View PostI didn't mean that in comparison to C or C++ FWIW. I don't think it's really that much worse (if worse at all) compared to those, after all it's the same code generator and the iteratoanecdoticallyr style probably helps in generating more obviously vectorizable code (citation needed). But compilers in general tend to need quite a bit of help to vectorize the non-trivial, you need to structure your code thinking about how you can lead it to vectorize or directly tell it how via intrinsics. For that case it just makes about as much sense to hand-roll your own assembly.
- Likes 2
Comment
-
Originally posted by jacob View PostYou are right to say that it happens mainly in web development, which seems to be driven almost entirely by fads anyway. But I don't think that it applies to system languages. Of those that vanished, PL/1 and BCPL were never fads and D was never a fad either (and it's still alive and well, albeit on the sidelines). There was the Modula-2 family and that's pretty much it. I suppose one could say that Lisp-as-a-system-language was also a fad of sorts, but even that never really became mainstream. As far as Rust is concerned, I think it's now past the Too Big To Fail milestone. While I agree with being cautious about passing fads, being overly skeptical and holding off indefinitely until something is sufficiently "proven" (which by definition never happens) isn't a sensible policy either IMHO. Even if Rust were to somehow disappear or become totally forgotten, rewriting those parts in C or in whichever other language would pop up wouldn't be wasted effort. In fact it would almost certainly result in a better quality implementation than if it was written in C from the start.
Originally posted by jacob View PostI'm not aware of any in-depth study on the subject, but from some anecdotal tests and benchmarks I've done, Rust often autovectorises better than Clang or Clang++, presumably because of its const-by-default and one-single-mutating-pointer-at-a-time rules.
Comment
Comment