[HN Gopher] The Piet-GPU Vision ___________________________________________________________________ The Piet-GPU Vision Author : adwn Score : 67 points Date : 2020-12-11 08:08 UTC (1 days ago) (HTM) web link (github.com) (TXT) w3m dump (github.com) | nemo1618 wrote: | Gotta say, I was hoping this was an implementation of Piet that | ran on the GPU: https://www.dangermouse.net/esoteric/piet.html | boothby wrote: | Glad I wasn't the only one! I could probably shoehorn a cuda | backend into repiet... but I don't even know where to start on | generating optimized code from this horrible stack-based | language. | 6d65 wrote: | I've been playing with OpenCL lately. Is such a shame that the | support is so spotty, and even Apple(who I think started it, | probably as a CUDA alternative for their AMD cards), are | deprecating it. | | Even with it not being able to squeeze all the perf from a | device, it's still handy, especially being a cross device api. | | It would've been ideal for piet, especially since compute kernels | can also be run on CPU on all cores, given a CPU driver. And I | think some OpenCL implementations support spirv. So it wouldn't | have needed any fallbacks, the same kernels would run either on | CPU or GPUs. | | I'm still going to use it for my project. But, it's a shame that | AMD RoCm OpenCL doesn't support running kernels on their CPUs. | | Also, Rust might benefit from something like SYCL. There is some | attractive convenience in having a DSL built into the language | for parallel computing. But one can dream. | littlestymaar wrote: | I have one question in case Raph passes by: | | Isn't that a bit risky to go this deep? If I understand things | correctly, you are currently trying to build a font editor in | Rust(runebender). Because there is no good UI library in Rust, | and there's good reason to think Rust is a good fit for this, you | want to build your own (Druid). So far so good. But, now you are | also trying to build your own 2D renderer and not a basic one: | you want to advance the state of the art in that field too. | | Not that I'm not exited, because if all this lands, it will be | super great for the Rust ecosystem, but sometimes because you're | so deep in the rabbit hole, I'm afraid you get burned-out (or | bored) and that everything would be lost because nothing would be | polished enough to be usable at that point. | | Is that a risk you're taking on purpose? Or is it just that you | have a plan to avoid it? | | Thanks in advance. | fhars wrote: | On the other hand, looking at Raph's previous activities, I | wouldn't be too surprised if all those other things you | describe are just project management kung-fu to put him in a | position where he just hast to continue to do research that | advances the state of 2D rendering. | chrismorgan wrote: | One thing that Raph is exceptionally good at is building a | community around these sorts of things, and guiding it in the | right direction. None of these things are being built by Raph | alone, though he's definitely still a primary worker in a lot | of them. | pavlov wrote: | I'm not someone of Raph's caliber, but this reminds me of my | own career rabbit hole. | | In 2002 I was a film student with a "new media" side job | (that's what they used to call web/Flash development). I had | cleared my schedule for six months so I could work on an | ambitious animation project mixing 2D and 3D. As I got started, | I figured I'd need to write some scripts for a 3D application I | was using (Softimage). Looking deeper, I came to the conclusion | my needs were complex enough that I should write a small | separate application rather than scripts. Then I realized my | application would need a little compositing engine to mirror | what existed in Softimage. To make that work fast enough, I | needed to learn about GPU shaders (brand new at the era). Also | I needed to learn about YUV pixel formats and media | containers... | | Flash forward 18 years, I'm still at the bottom of this rabbit | hole, sometimes halfheartedly looking for the door to go back | up but just finding more glimpses into weirder wonderlands. I | wrote another YUV compositor just a couple of months ago, but | haven't made a serious attempt at animation in probably 15 | years. | | I wonder if other people have this kind of experience, and | whether there's some kind of law of "tech stack career gravity" | in evidence here. When you become expert in something lower | level, it increases the "career delta-v" to move back up. | [deleted] | raphlinus wrote: | This is a good question, and I'm well aware of the broad scope | of my projects, especially spanning low to high level. | | A few things might help put this in context. First, Druid well | predated Runebender, though Runebender is now the "hero app" | (before, it was xi-editor, now on the back burner). | | Second, I have a _lot_ of experience doing high performance 2D | and font rendering, from libart to working on the PDF 1.4 blend | modes in Ghostscript to font-rs. I 've also been curious about | GPU for a while, not least because that was what was actually | painting the text on Android, and I worked on the Android UI | team for almost 5 years. So now that GPU compute is becoming | mainstream, I see an almost unique opportunity to apply my | skills there. | | Third, I'm not doing all this by myself. I'm deliberately | trying to cultivate open source community involvement and, | really, building a team, though it has diffuse borders. Now is | also a good time to acknowledge my long-time collaboration with | Colin Rofls, who does a huge amount of the day to day work on | both Runebender and Druid. | | Lastly, I published this in advance of a career move, which is | becoming a research software engineer on the Google Fonts team. | I believe this is a perfect position for me to continue pushing | this research agenda forward, and I'm hoping will bring more | resources and focus. | | There is no chance of me getting bored doing this. Burnout is | something I'm watching carefully, as I have experienced it (it | was the end of my time on Android), but one thing I discovered | in my 2.5 years away from being a full-timer at Google is that | graphics research is what I love the most, and would probably | be doing even if it wasn't also a good career move. | jancsika wrote: | > a lot of experience doing high performance 2D | | Is there a good ELI5 about the current state of 2D GPU | acceleration? | raphlinus wrote: | As I posted to a similar request, this is an arcane field, | and different things are meant by 2D - in games, it's | largely painting sprites from sprite sheets, I think of it | as involving vector graphics, and there are other contexts. | | I think a good blog post that motivates some of the main | differences between 2D and 3D in the GPU context is this | one: https://blog.mecheye.net/2019/05/why-is-2d-graphics- | is-harde... | anchpop wrote: | I think Rust and Haskell, due to their irrelevance in industry | and general "nerdiness", attract a certain type of hacker. | Specifically I've noticed that there are some libraries for both | languages that are just _so_ good that they make you never want | to use anything else. One example in Haskell is Megaparsec [0], | by far the best point in the parser framework design-space I 'm | aware of. An example in Rust is wgpu-rs, which maybe isn't "all | the way there" yet but is already turning into a very ergonomic | low-level rendering API. Although I haven't used them, I think | piet-gpu and pathfinder may be in this category also. I don't | have a link handy but I remember seeing a tweet from the | developer of Pathfinder where he was reverse-engineering MacOS's | idiosyncratic font rendering so he could generate identical- | looking output as the native renderer. That's going above-and- | beyond what any reasonable library developer would do and I love | it. | | I'm not saying there aren't any great libraries for other | languages (there certainly are, like Halide for C++) but that I'm | more often pleasantly surprised by the library quality in Haskell | and Rust than I am in other languages (when there are libraries | available, anyway). | | [0]: https://hackage.haskell.org/package/megaparsec | | [1]: https://github.com/gfx-rs/wgpu-rs | nicoburns wrote: | I'm not sure you can really characterise Rust as irrelevant to | industry anymore (with some of the most widely used software | written in Rust and FAANG companies hiring core developers), | but I do agree that it has an unusually high quality standard | for libraries (I'm unfamiliar with the Haskell ecosystem but I | hear good things). | | However, I think that while some of it is certainly cultural, a | lot of it is due to the type systems in these languages being a | lot more powerful which allows for more expressive APIs and | more robust error handling, etc. | kvark wrote: | Wgpu-rs is also going down the rabbit hole of re-inventing the | world: in addition to implementing WebGPU and targeting all the | GPU APIs that are available, we are also trying to do all the | shader translation ourselves now (project Naga). I hope to not | be burned by this. | | Pathfinder future is unclear. It's not ready to be integrated | into WebRender yet, and Patrick no longer works for Mozilla. I | see no activity on their projects. Would appreciate if they | show up here and clarity. | adamnemecek wrote: | Rust is gaining traction like nothing else. | neolog wrote: | What is an introduction to the basic concepts and terminology | being discussed here? | | (I write software but nothing GPU- or graphics-related.) | raphlinus wrote: | Unfortunately, both 2D graphics and the programming of Vulkan | compute shaders are very arcane topics, and the intersection of | the two basically maxes out. | | For GPU programming, I have a list of resources here: | https://raphlinus.github.io/gpu/2020/02/12/gpu- | resources.htm..., and also a talk here: | https://www.janestreet.com/tech-talks/a-taste-of-gpu-compute... | | Re 2D graphics, a long term ambition of mine is to write a book | on the topic (and I have a repo started with a rough, bullet | point outline), largely because I don't know of any source that | brings the concepts together. I don't think I'll be able to | spend significant time on it, though, as I have my hands pretty | full. I am hoping to do more explaining and public | communication as part of my piet-gpu work. | | A good snapshot of GPU font rendering work from 3 years ago is: | https://aras-p.info/blog/2017/02/15/Font-Rendering-is-Gettin... | . The linked papers are quite good and have informed my | thinking, though of course I hope to advance the state of the | art even further. ___________________________________________________________________ (page generated 2020-12-12 23:00 UTC)