14,081 karma · joined Mar 7, 2014 (12y ago) · 1,887 submissions
comment 3y ago · link · parent
Agreed, it's extremely distinctive.
comment 3y ago · link · parent
Longer term, I think we can write GPU code that is portable, but it will require building out the infrastructure for it. Vulkan compute shaders are one good starting point, and as of Vulkan 1.3 the "subgroup size control" feature is mandatory. WebGPU is another possible path to get there, but it's currently lacking a lot of important features, including subgroups at all. There's more discussion of subgroups as a potential WebGPU feature in [1], including how to handle subgroup size.
comment 3y ago · link · parent
comment 3y ago · link · parent
Out of scope for this blog post, but I also believe there is tremendous potential for hardware that broadly resembles existing GPUs (same register layout, instruction scheduling, memory hierarchy) but with fewer limitations and performance problems. For example, the queue that's currently hardcoded between vertex and fragment shaders could be exposed as a general purpose queue primitive, allowing more dynamic scheduling of multiple different kernels in parallel. I haven't done a deep enough dive into hardware to make concrete proposals, but as I explore, I get more and more indications that what we have access to is a fairly limited subset of what's possible.
comment 3y ago · link · parent
comment 3y ago · link · parent
https://github.com/linebender/vello/issues/42 is an issue from when Vello (then piet-gpu) had a single-pass prefix sum algorithm. Looking back, I'm fairly confident that it's a shader translation issue and that it wouldn't work with MoltenVK either, but we stopped investigating when we moved to a more robustly portable approach.
comment 3y ago · link · parent
There's also a lot of great material, accessibly written, on Alyssa's blog[2], see in particular the posts titled "Dissecting the Apple M1 GPU, part ${I}".
308.
Metal shader converter and the missing device-scoped barrier(raphlinus.github.io ↗)
62 points · by raphlinus · 3y ago · 20 comments
comment 3y ago · link · parent
I'm also interested in quantitative comparisons with the Rive renderer. My personal feeling is that the compute shader approach is more scalable than pixel local storage, but the latter does seem to perform nicely especially on Apple Silicon GPUs.
310.
Xilem Vector Graphics [video](youtube.com ↗)
129 points · by raphlinus · 3y ago · 14 comments
comment 3y ago · link · parent
There's a project to get this running using Rust[1]. Currently it outputs the blue channel with sync, but has trouble with the other two channels. I don't have a hardware lab with scope, logic analyzer, etc., so it's not easy for me to debug.
In the meantime, I've been doing some experiments in the C codebase as well[2], mostly in the direction of proportionally spaced bitmap text, using the fonts in the X11 distribution.
comment 3y ago · link · parent
comment 3y ago · link · parent
Tensor cores: I can't say there are plans to add it, but it's certainly something I would like to see. You need subgroups in place first, and there's been quite a bit of discussion[1] on that as a likely extension post-1.0.
comment 3y ago · link · parent
Yes.
> Is the reason you can't accomplish that today bc APIs haven't been created or opened up to allow such workloads? Are there not lower level APIs available/exposed today in WebGPU that would allow developers to begin the design of browser based ML frameworks/libraries?
That is correct, there is no way before WebGPU to access compute capability of GPU hardware through the Web. There have been some hacks based on WebGL, but those are seriously limited. The fragmentation of the existing API space is a major reason we haven't seen as much progress on this.
> Was it possible to interact with the GPU before WebGPU via Web Assembly?
Only in limited ways through WebGL - no access to workgroup shared memory, ability to do random access writes to storage buffers, etc.
> Other than ML and graphics/games (and someone is probably going to mention crypto), are there any other potentially novel uses for WebGPU?
Yes! There is research on doing parallel compilers on GPU (Aaron Hsu's co-dfns as well as Voetter's work[1]). There's quite a bit of work on implementing Fourier transforms at extremely high throughput. Obviously, physics simulations and other scientific workloads are a good fit. To me, it feels like things are wide open.
comment 3y ago · link · parent
First, for AI and machine learning type workloads, the infrastructure situation is a big mess right now unless you buy into the Nvidia / CUDA ecosystem. If you're a research, you pretty much have to, but increasingly people will just want to run models that have already been trained. Fairly soon, WebGPU will be an alternative that more or less Just Works, although I do expect things to be rough in the early days. There's also a performance gap, but I can see it closing.
Second, for compute shaders in general (potentially accelerating a large variety of tasks), the barrier to entry falls dramatically. That's especially true on web deployments, where running your own compute shader costs somewhere around 100 lines of code. But it becomes practical on native too, especially Rust where you can just pull in a wgpu dependency.
As for text being one of the missing pieces, I'm hoping Vello and supporting infrastructure will become one of the things people routinely reach for. That'll get you not just text but nice 2D vector graphics with fills, strokes, gradients, blend modes, and so on. It's not production-ready yet, but I'm excited about the roadmap.
[Note: very lightly adapted from a comment at cohost; one interesting response was by Tom Forsyth, suggesting I look into SYCL]
comment 3y ago · link · parent
I have an idea of a dream GPU infrastructure based on compute shaders, where you compile your problem into GPU IR suitable for your operating system (SPIR-V, Metal, DXIL) and have a very lightweight runtime that just runs those. For the ahead of time compilation case, you wouldn't need to ship GPU compilers in a deployed application, though you would want that for more rapid iteration when doing research and exploratory programming.
From what I can see so far, this seems basically orthogonal to what Modular and Mojo are trying to do, but it's entirely possible I'm missing something. I'm wondering if anyone is actually building this (IREE and MediaPipe are the closest things in the space I'm aware of), and if not, why not.
comment 3y ago · link · parent
319.
Simplifying Bézier Paths(raphlinus.github.io ↗)
8 points · by raphlinus · 3y ago · 2 comments
comment 3y ago · link · parent
comment 3y ago · link · parent
This being safe Rust, it fixes the undefined behavior in the C++ version. You can of course implement that in unsafe Rust, but I can't quite bring myself to post that.
comment 3y ago · link · parent
comment 3y ago · link · parent
An entire category of bullshit jobs would be created to write "source code" that met the regulatory requirements but had little connection to the actual code deployed in production. This code would largely be derived from the claims, and, like much patent language, be crafted to be as vague and general as possible. Most of this work could be automated by ChatGPT, as no insight is required. Another class of bullshit jobs would be created to interpret and analyze the code, as it's outside the skill set of lawyers and examiners.
Any code published as part of a patent would immediately be anti-open source, as people actually creating things would be strongly discouraged from even looking at it, as doing so would support "willful infringement." The average level of code quality would be such that nobody would want to, anyway.
There's lots that could be done to make the patent system more beneficial to society (including, in my personal opinion, dropping software patents entirely), but I don't think a code requirement would be particularly helpful.
comment 3y ago · link · parent
This is a larger number than the one cited in the post because the latter only includes "normal" numbers. This includes the "denormals" as well.
It's very easy to generalize this to 64 bits, there are 4,607,182,418,800,017,410 of them.
comment 3y ago · link · parent
comment 3y ago · link · parent
Compute shaders avoid all these problems and work on WebGPU 1.0 today.
comment 3y ago · link · parent