Better HN
topnewbestaskshowjobs
Log inSign up

raphlinus

14,081 karma · joined Mar 7, 2014 (12y ago) · 1,887 submissions

I do research on fundamental UI technology and 2D graphics, with a focus on Rust and fonts. @raph@mastodon.online
Submissions

comment 3y ago · link · parent

Some more links. Bellingcat broke the Discord server story 5 days ago[1]. The Washington Post has a stunning story, including barely obscured video (unaltered voice) from a teenager who was active in the group and considers himself a good friend of the leaker[2]. The Guardian story cites and quotes extensively from the WP story, so that should be considered the original source, but does add more context. Emptywheel (who has been pretty consistently excellent when it comes to leaks and the like) has more analysis[3].

[1]: https://www.bellingcat.com/news/2023/04/09/from-discord-to-4...

[2]: https://www.washingtonpost.com/technology/2023/04/12/discord...

[3]: https://www.emptywheel.net/2023/04/13/bear-versus-pig-on-the...

comment 3y ago · link · parent

I was expecting this to be the recent conversation[1] about Medley Interlisp, presented at Bay Area Lisp almost a month ago. It's been on my list to watch.

[1]: https://www.youtube.com/watch?v=HYWFTiai_tA

comment 3y ago · link · parent

The thing that stuck out to me is the assertion that FFT is poorly supported on modern GPU. That's surprising to me, as there's cuFFT offically supported by Nvidia, and vkFFT that achieves similar performance portably using compute shaders. I believe these are based on f32 math, so perhaps the potential win is using tensor cores to compute FFT at lower precision? It seems surprising to me that decomposing into matrix operations is the win here, it seems you'd do better writing a kernel that makes use of the cooperative matrix (aka WMMA, tensor core, simd_matrix) capabilities of the GPU.

comment 3y ago · link · parent

This is still on the web, just with a slightly different URL: https://levien.com/artofcode/fontfocus/

It never went anywhere. One flaw is that it doesn't help with certain glyphs with complex shapes, like the 'g' in Times Roman. These days, even smaller devices tend to have high resolution displays, so the need is not as strong.

comment 3y ago · link · parent

Knowing you would respond in this way is why I added the qualifier "reasonably."

comment 3y ago · link · parent

This depends entirely on your goals. If you're researching the actual machine learning algorithms, then use a framework like TensorFlow or Torch, which provides all the tensor operations and abstracts away the hardware. If you're trying to get maximum performance on hardware today, stick with Nvidia and use CUDA. If you're interested in deploying across a range of hardware, or want to get your hands dirty with the actual implementation of algorithms (such as wonnx), then WebGPU is the way to go.

comment 3y ago · link · parent

This is a huge milestone. It's also part of a much larger journey. In my work on developing Vello, an advanced 2D renderer, I have come to believe WebGPU is a game changer. We're going to have reasonably modern infrastructure that runs everywhere: web, Windows, mac, Linux, ChromeOS, iOS, and Android. You're going to see textbooks(*), tutorials, benchmark suites, tons of sample code and projects to learn from.

WebGPU 1.0 is a lowest common denominator product. As 'FL33TW00D points out, matrix multiplication performance is much lower than you'd hope from native. However, it is possible to run machine learning workloads, and getting that performance back is merely an engineering challenge. A few extensions are needed, in particular cooperative matrix multiply (also known as tensor cores, WMMA, or simd_matrix). That in turn depends on subgroups, which have some complex portability concerns[1].

Bindless is another thing everybody wants. The wgpu team is working on a native extension[2], which will inform web standardization as well. I am confident this will happen.

The future looks bright. If you are learning GPU, I now highly recommend WebGPU, as it lets you learn modern techniques (including compute), and those skills will transfer to native APIs including Vulkan, Metal, and D3D12.

Disclosure: I work at Google and have been involved in WebGPU development, but on a different team and as one who has been quite critical of aspects of WebGPU.

(*): If you're writing a serious, high quality textbook on compute with WebGPU, then I will collaborate on a chapter on prefix sums / scan.

[1]: https://github.com/gpuweb/gpuweb/issues/3950

[2]: https://docs.rs/wgpu/latest/wgpu/struct.Features.html#associ...*

comment 3y ago · link · parent

Hey, patio11 doesn't post that often.

comment 3y ago · link · parent

Yes, the tool is cargo-gnaw. It does not evaluate build.rs files itself, but there is a process for evaluating them at the time the crate is vendored.

https://fuchsia.googlesource.com/fuchsia/+/master/tools/carg...

comment 3y ago · link · parent

This is in fact one part of the post that was based on an unironic kernel of truth. I've wrestled with this more than most people. In particular I tried to fit cargo into the Fuchsia build system, with only partial success. That approach has been abandoned and Fuchsia now translates Cargo manifests into GN build rules, which seems to be the prevailing approach for polyglot builds, especially with Bazel.

However, the experience when doing pure Rust is night and day compared with stuff like CMake. And even in a polyglot build, the Cargo manifest is a reasonably good starting point, as argued recently by matklad[1].

Obviously, build systems and package managers at large scale are very challenging to get right, otherwise we'd have a good solution by now. I personally think Bazel is a pretty good step in the right direction, but it's very clunky and awkward for smaller projects. I found Neil Mitchell's classification[2] useful. Cargo is best-in-class for the "small" and arguably "medium" cases, but starts showing its limitations beyond that. Bazel is the reverse, one of the few really workable choices for "huge" but not a great experience otherwise.

[1]: https://matklad.github.io/2023/03/28/rust-is-a-scalable-lang...

[2]: https://neilmitchell.blogspot.com/2021/09/small-project-buil...

comment 3y ago · link · parent

I'll explain the joke, as it's subtle. Rust indeed has an explicitly stated backwards compatibility guarantee, which limits evolution of the language. One example of that is Range not being Copy because of some decisions taken early on; most people would agree that this was a mistake. There is an "edition" mechanism that allows some evolution, for example adding new keywords, but it can't solve everything.

C++, by contrast, has a tradition of maintaining backwards compatibility, but it is not enforced systematically, and in practice migrating to newer versions of C++ can be a painful process. Thus, in many application domains (especially embedded), developers are stuck on very old versions of the language. There's also a very sticky issue of whether binary (ABI) compatibility is guaranteed. There's nothing in the standards process that guarantees this, but there has been huge resistance to proposed improvements that break ABI. This was a particular sticking point for Google[1], as it affects unique_ptr, making it not so much the zero cost abstraction as originally hoped.

Language evolution is a difficult problem, and there is no magic, obviously correct answer to it. But I think Rust has a good, pragmatic approach, and the flaws such as Range are a very small part of the overall language surface area.

Modules are a particularly disruptive to the ecosystem. It's taking a long time to get them properly implemented in C++, and it also requires fairly major changes to code bases, build systems, and other infrastructure to migrate to them. By contrast, Rust has had a decent module system since 1.0 (with various tweaks and changes through the edition mechanism).

Edit: and as 'wongarsu says in a sibling comment, another part of the joke is that Rust doesn't need as much evolution as C++, as it already has a lot of the advantages such as a working module system.

[1]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p20...

comment 3y ago · link · parent

Yeah, it's no walk in the park, let me tell you that.

comment 3y ago · link · parent

You are right, and that is an excellent way to state my goals: I hope to create systems that have as much lasting impact as autotools.

comment 3y ago · link · parent

I think you nailed it. I wake up each morning consumed with anxiety, thinking to myself, "how do I become relevant?" Clearly, having shipped advanced multilingual typesetting capabilities to billions of users didn't do it, nor developing high performance GPU rendering algorithms, nor having made a popular programming font. But posting a language comparison to Hacker News, that should put me on the map.

comment 3y ago · link · parent

I was only tangentially involved in X, but was active in a lot of related projects (some Gtk infrastructure, Ghostscript, the seeds of what became Inkscape), and now work on GPU-accelerated font rendering. I also played a central role in getting Rust adopted at Google, and now one of my passions is advancing the Rust GUI space, as I feel like that has enormous potential.

comment 3y ago · link · parent

I think the tradition of April Fools (and related, Onion-like satire) serves an important epistemological function, even more relevant and important in today's information environment. You cannot rely on tone and confident expression, but rather read critically.

In this particular case, what's being satirized are a fairly complex mix of perceptions about community and what actually builds a programming language ecosystem. I was able to poke gentle fun at myself (the Android font vulnerability) while also taking down some of the worst arguments out there, sadly common though. All this would be hard to express as a straight opinion piece.

Probably the biggest problem with this piece is that it has a moderately specialized audience. If you follow the adoption of Rust closely, hopefully you'll get a good chuckle. If you're only dimly aware of that, then there are too many insider jokes.

[I had intended to be "in character" in the comments here today, but have reconsidered. Appreciate the feedback, and happy to discuss substantive points]

347.

Moving from Rust to C++(raphlinus.github.io ↗)

280 points · by raphlinus · 3y ago · 132 comments

comment 3y ago · link · parent

This will be changing soon. I believe Chrome M113 is scheduled to ship to stable on May 2, and will support WebGPU 1.0. I agree it's a game-changing technology.

comment 3y ago · link · parent

The specific thing I asked for is very technically challenging. One of the things I can offer is some tests that fail in, among other things, MoltenVk, as the mapping to Metal barriers is imprecise. I'm not sure whether the Vulkan CTS test will catch it, I've seen it miss memory model failures on other hardware. I'm always happy to chat about this if someone from the team wants to reach out.

comment 3y ago · link · parent

The big question I have is whether this can possibly support mandatory Vulkan features that are not available in Metal. The one I care about most is device scoped barriers, which in turn are needed for single-pass prefix sum techniques.

comment 3y ago · link · parent

It is. I've been waiting for the brilliant take, the one that makes me say, "wow, this really gets to the essence of the whole thing." I haven't found it yet. It's not the blurry jpeg one, it's not the "old-school computational linguistics/GOFAI had it right" ones, it's not the one with various Mario analogies. By having at its heart, "I don't know," this one perhaps comes closest.

By all means, please write the brilliant take yourself, and I will happily upvote and reference it.

comment 3y ago · link · parent

I'm curious why they haven't done more forensic typographic analysis of the fonts themselves. There are a number of images of actual Selectric fonts, including [1], and that includes symbols and other variations. Close examination would either confirm the use of that equipment, or else discrepancies would be a valuable clue.

Thomas Phinney, Font Detective[2] is the first person I'd ask, as he's done this professionally, though I have done a bit of it myself.

[1]: http://luc.devroye.org/fonts-44934.html

[2]: https://thefontdetective.com/

comment 3y ago · link · parent

Three. You can also do it in Metal, which as of recently has cooperative matrix multiplication in the form of the simd_matrix type (this is similar functionality as "tensor cores" in the Nvidia world). I have no idea what the software support is, but I have seen analysis suggesting that the raw tensor multiplication throughput is larger than ANE for the high-end GPUs.

comment 3y ago · link · parent

Another interesting analysis: https://armoxon.substack.com/p/the-case-for-shunning

comment 3y ago · link · parent

Carry is also a monoid. Consider addition of two binary numbers. If the two digits are zero, then the output carry is zero no matter the input carry. If the two digits are one, then the output carry is one no matter the input carry. And if one is a zero and the other a one, then the output carry is the input carry. Call these values 0, 1, and X respectively.

Now consider a binary operator combining two such values. It is associative and has X as an identity element, thus is a monoid:

    \   0 1 X
      +------
    0 | 0 0 0
    1 | 1 1 1
    X | 0 1 X
Now you can express the carry output of bit i as the inclusive scan (prefix sum) of these values from 0 to i. Because it's a monoid, you can implement it efficiently in parallel. There's a nontrivial literature in digital electronics exploiting this basic fact.

Of course, to me everything is a monoid (including rendering vector graphics paths), so it should come as no surprise that I see things this way.

comment 3y ago · link · parent

Yes, according to Apple official documentation, OpenCL was deprecated as of macOS 10.14. It is reported to work, including on Apple Silicon (M1 and M2), but don't expect any updates.

[1]: https://developer.apple.com/library/archive/documentation/Pe...

comment 3y ago · link · parent

These chipsandcheese articles are fantastic, they really go into depth.

Last week I had occasion to dig deeply into the microarchitecture of the Apple M1 and M2 GPUs (which are very similar to the A series on mobile). I found the metal-benchmarks[1] repo to be very useful, and, relevant to this article, it contains a comparison to the RDNA generations. From that it appears that GPU microarchitectures are starting to converge, even if terminology is not. The standard configuration these days seems to be blocks of 128 threads (WGP's in AMD terminology, "cores" in Apple), organized into 4 SIMDs. Resources like workgroup memory (LDS in AMD lingo) are shared among each of these 128-blocks.

The linked repo also has links to other resources, including the incredible work being done by the Asahi Linux people to reverse engineer M1 and deliver working open source GPU drivers.

[1]: https://github.com/philipturner/metal-benchmarks

comment 3y ago · link · parent

It's an instance of "argument from fallacy." This whole comment section is like a zoo of logical fallacies, with golden oldies such as ad hominem (both sides), false equivalence, and of course both-siderism well represented.

comment 3y ago · link · parent

I'm not actually salty. Rather, sometimes I half-joke that I have 28 years of Rust programming experience, and when people do the double-take I explain that I'm including ML-derived languages with explicit lifetimes/regions, so close enough.

comment 3y ago · link · parent

My one criticism of this post is referring to the work of Aiken in improving the static memory management in ML Kit. That should be "Aiken et al".
1
111213
63