Readit News logoReadit News
raphlinus commented on Lessons learned from implementing SIMD-accelerated algorithms in pure Rust   kerkour.com/rust-simd?hn=... · Posted by u/randomint64
raphlinus · 11 days ago
There's a new game in town for portable, multiversioned Rust SIMD: fearless_simd. It's still early days (we're gearing up for an 0.2 release soon), but we are using it very successfully to accelerate rendering algorithms in vello_cpu and vello_hybrid. I believe it represents the best compromise on stable Rust today. We're not saying it's ready for production use yet, but I encourage people exploring this space to try it and give us feedback on how well it works.

There's also a big discussion to be had about how the Rust language might more natively support SIMD. There are some hacks in fearless_simd to work around limitations in the language (especially relying on inlining as load-bearing), and it would be excellent to make that more robust. But the best path forward is not obvious.

[1] https://github.com/linebender/fearless_simd

raphlinus commented on Ashet Home Computer   ashet.computer/... · Posted by u/todsacerdoti
raphlinus · 12 days ago
Along similar lines but physically much smaller, there are currently about 3 or 4 boards[1] that have RP2350, DVI, USB host, and SD card, ranging in cost from about $15 to $40.

A particular sweet spot is emulating 8 and 16 bit systems, as latency can be just as good as an FPGA setup. The infoNES emulator has been running on RP2040 for a while, and I see projects for Sega Master System, Genesis, Apple II, and Mac in the works. But you can also write much more powerful software natively.

Likely it will be possible to adapt software between these various RP2350 systems.

[1]: https://github.com/DusterTheFirst/pico-dvi-rs/wiki/RP2350-DV...

raphlinus commented on My first verified imperative program   markushimmel.de/blog/my-f... · Posted by u/TwoFx
addaon · 2 months ago
> If you have INT_MIN along with any other negative number in the array then your program has undefined behavior in C.

What? Why? There’s no addition needed to solve this problem. The example implementation does invert each element, which is undefined for INT_MIN, but it would be trivial to just skip INT_MIN elements (since their additive inverse is never in the set).

raphlinus · 2 months ago
Yes. The problem here is the -x operation. If INT_MIN is in the array, then the negation operation itself is UB. As you say, the fix is to skip values equal to INT_MIN; it's not possible that its negation is in the array, as that number is not representable.

Rust is only a little better. With default settings, it will panic if isize::MIN is in the input slice in a debug build, and in a release build will incorrectly return true if there are two such values in the input. But in C you'll get unicorns and rainbows.

raphlinus commented on The Zen of Quakerism (2016)   friendsjournal.org/the-ze... · Posted by u/surprisetalk
hansonkd · 2 months ago
To the point of the article: A lot of Quakers dont label their worship as meditation. The point of quaker worship is to open your heart to "listen". The point of meditation is often mindfulness. there is some overlap but i think it is a different ends from similar means.

Another contrast is quaker worship is done in a community looking inward towards the center of the room, Zen meditation when done in a temple is done looking at the wall. for me this is a contrast between the quaker "society of friends" and zen can be done in isolation

Quakers for me have a special place in my heart.

I'm a bit sad that in California there are very few Quaker communities when compared to Buddhist or Zen communities. The quaker communities that do exist seem to be hanging on from the counterculture movement several decades ago.

I've attended a Quaker community for the past couple of years and sadly it is dying out. Almost all of the members are past 60 y/o and almost zero young adult members or younger members attend.

I think the Quaker philosophy is powerful and unfortunately i believe it has lead to its downfall. The lack of creed and resistance to structure makes it hard for new members to feel comfortable and make it easy to be more casual about your membership. this leads to people just dropping out.

also the structure of quaker practices can seem offputting for people from more conventional religious backgrounds. For example christmas "celebrations" are done entirely in silence from the moment you enter to when you leave. this is a staggering contrast to almost every other celebration. (also in contrast to most of christianity a lot of quakers dont believe jesus was "holy" but rather an ordinary man who was more in touch with the "light", underscoring the intensity of their egalitarian beliefs)

I think Quaker has a branding problem. People think of quaker oats or amish. (amish have nothing to do with quakers). Zen is more trendy and "mystical". If quakerism was "rebranded" a lot more people would be attracted to it.

My heart yearns for more Quaker communities. Its so sad to see them die out.

raphlinus · 2 months ago
Have you attended recently, as in the past few months? Maybe our meeting is special because it's Berkeley, but we have a solid core of young people regularly attending. I was on Nominating Committee last cycle, and we've gotten a number of Young Friends, where in the recent past it's been pretty much aging members.

You might be right about rebranding, but to me a lot of what appeals is the focus on the substance rather than perceptions.

raphlinus commented on RP2350pc Open Source Hardware all in one computer   olimex.wordpress.com/2025... · Posted by u/AlexeyBrin
crest · 2 months ago
I want to use the 2nd core to a evaluate a command buffer per line with linewise double buffering instead of keeping a whole frame buffer around. With commands to draw lines, boxes, curves, bitmaps, text etc.
raphlinus · 2 months ago
We're very much thinking along similar lines. I also have an idea for a 4bpp image encoding that could be fast enough for streaming from SD card, and high quality, given preprocessing.
raphlinus commented on RP2350pc Open Source Hardware all in one computer   olimex.wordpress.com/2025... · Posted by u/AlexeyBrin
Lerc · 2 months ago
Once you have video out, Memory eating options become quite available. Framebuffers are quite large.

I've got a 1.4inch screen waveshare rp2350 sitting beside me at the moment. I'm currently fighting getting paletted display update via DMA with limited success. As I work through it it does become apparent to me that you could generate a tiled+sprites mode a scanline at a time on demand with PIO and DMA. I'm not convinced it could be run with zero CPU involvement, but it could certainly be done with very little CPU.

raphlinus · 2 months ago
For 640x480 output not overclocked, I estimate tile + sprite CPU utilization to be about 50% of one core. Of course you have two cores. That number goes up and down depending on resolution, particularly when you're pixel doubling.

It's absolutely doable. There's the beginning of a tile demo (a scrolling brick wall) in the pico-dvi-rs repo.

raphlinus commented on RP2350pc Open Source Hardware all in one computer   olimex.wordpress.com/2025... · Posted by u/AlexeyBrin
raphlinus · 2 months ago
This looks really cool, I ordered one. I'm also waiting for the Fruit Jam, mentioned elsethread.

The pico-dvi-rs project has an early prototype of race-the-beam video generation, which I think has a lot of potential, it's going to allow much richer content than a framebuffer on this kind of device. One fun thing we've got going is proportionally spaced bitmap fonts, which is fairly unusual in this form factor. Please get in touch with me if you're interested in driving this thing with Rust.

[1]: https://github.com/DusterTheFirst/pico-dvi-rs

raphlinus commented on Faster, easier 2D vector rendering [video]   youtube.com/watch?v=_sv8K... · Posted by u/raphlinus
morio · 2 months ago
You got a long way to go. Writing a rasterizer from scratch is a huge undertaking.

What's the internal color space, I assume it is linear sRGB? It looks like you are going straight to RGBA FP32 which is good. Think how you will deal with denormals as the CPU will deal with those differently compared to the GPU. Rendering artifacts galore once you do real world testing.

And of course IsInf and NaN need to be handled everywhere. Just checking for F::ZERO is not enough in many cases, you will need epsilon values. In C++ doing if(value==0.0f){} or if (value==1.0f){} is considered a code smell.

Just browsing the source I see Porter Duff blend modes. Really, in 2025? Have fun dealing with alpha compositing issues on this one. Also most of the 'regular' blend modes are not alpha compositing safe, you need special handling of alpha values in many cases if you do not want to get artifacts. The W3C spec is completely underspecified in this regard. I spent many months dealing with this myself.

If I were to redo a rasterizer from scratch I would push boundaries a little more. For instance I would target full FP32 dynamic range support and a better internal color space, maybe something like OKLab to improve color blending and compositing quality. And coming up with innovative ways to use this gained dynamic range.

raphlinus · 2 months ago
It's device sRGB for the time being, but more color spaces are planned.

You are correct that conflation artifacts are a problem and that doing antialiasing in the right color space can improve quality. Long story short, that's future research. There are tradeoffs, one of which is that use of the system compositor is curtailed. Another is that font rendering tends to be weak and spindly compared with doing compositing in a device space.

raphlinus commented on Faster, easier 2D vector rendering [video]   youtube.com/watch?v=_sv8K... · Posted by u/raphlinus
leetrout · 2 months ago
Raph - I know enough to be very dangerous with GPUs so please forgive my ignorance. Two questions:

1. Do you have a favorite source for GPU terminology like draw calls? I optimized for them on an unreal engine project but never "grokked" what all the various GPU constructs are and how to understand their purpose, behavior and constraints. (For this reason I was behind the curve for most of your talk :D) Maybe this is just my lack of understanding of what a common / modern pipeline consists of?

2. I replayed the video segment twice but it is still lost on me how you know which side of the path in a tile is the filled side. Is that easy to understand from the code if I go spelunking for it? I am particularly interested in the details on how that is known and how the merge itself is performed.

raphlinus · 2 months ago
1. I like ryg's "A trip through the Graphics Pipeline" [1]. It's from 2011 but holds up pretty well, as the fundamentals haven't changed. The main new topic, perhaps, is the rise of tile based deferred rendering, especially on mobile.

2. I skipped over this in the interest of time. `Nevermark has the central insight, but the full story is more interesting. For each tile, detect whether the line segment crosses the top edge of the tile, and if so, the direction. This gives you a delta of -1, 0, or +1. Then do a prefix sum of these deltas on the sorted tiles. That gives you the winding number at the top left corner of each tile, which in turn lets you compute the sparse fills and also which side to fill within the tile.

[1]: https://fgiesen.wordpress.com/2011/07/09/a-trip-through-the-...

raphlinus commented on Faster, easier 2D vector rendering [video]   youtube.com/watch?v=_sv8K... · Posted by u/raphlinus
Fraterkes · 2 months ago
Is there any specific connection between Rust and the netherlands? A friend of mine helped organize a big rustcon in Delft a while ago, I think Raph spoke there too.

Oh and a question for Raph, did the new spline you invented end up being integrated in any vector/font-creation tools? I remember being really impressed when I first tried your demo

raphlinus · 2 months ago
Yes, I was born in Enkhuizen.

The newest spline work (hyperbezier) is still on the back burner, as I'm refining it. This turns out to be quite difficult, but I'm hopeful it will turn out better than the previous prototype you saw.

u/raphlinus

KarmaCake day13141March 7, 2014
About
I do research on fundamental UI technology and 2D graphics, with a focus on Rust and fonts. Currently on the Google Fonts team.

@raph@mastodon.online

View Original