frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Faster sorting with SIMD CUDA intrinsics (2024)

https://winwang.blog/posts/bitonic-sort/
92•winwang•9mo ago
Code at https://github.com/wiwa/blog-code/

Comments

ashvardanian•9mo ago
The article covers extremely important CUDA warp-level synchronization/exchange primitives, but it's not what is generally called SIMD in the CUDA land .

Most "CUDA SIMD" intrinsics are designed to process a 32-bit data pack containing 2x 16-bit or 4x 8-bit values (<https://docs.nvidia.com/cuda/cuda-math-api/cuda_math_api/gro...>). That significantly shrinks their applicability in most domains outside of video and string processing. I've had pretty high hopes for DPX on Hopper (<https://developer.nvidia.com/blog/boosting-dynamic-programmi...>) instructions and started integrating them in StringZilla last year, but the gains aren't huge.

winwang•9mo ago
Oh wow, TIL, thanks. I usually call stuff like that SWAR, and every now-and-then I try to think of a way to (fruitfully) use it. The "SIMD" in this case was just an allusion to warp-wide functions looking like how one might use SIMD in CPU code, as opposed to typical SIMT CUDA.

Also, StringZilla looks amazing -- I just became your 1000th Github follower :)

ashvardanian•9mo ago
Thanks, appreciate the gesture :)

Traditional SWAR on GPUs is a fascinating topic. I've begun assembling a set of synthetic benchmarks to compare DP4A vs. DPX (<https://github.com/ashvardanian/less_slow.cpp/pull/35>), but it feels incomplete without SWAR. My working hypothesis is that 64-bit SWAR on properly aligned data could be very useful in GPGPU, though FMA/MIN/MAX operations in that PR might not be the clearest showcase of its strengths. Do you have a better example or use case in mind?

winwang•9mo ago
I don't -- unfortunately not too well-versed in this field! But I was a bit fascinated with SWAR after I randomly thought of how to prefix-sum with int multiplication, later finding out that it is indeed an old trick as I suspected (I'm definitely not on this thread btw): https://mastodon.social/@dougall/109913251096277108

As for 64-bit... well, I mostly avoid using high-end GPUs, but I was of the impression that i64 is just simulated. In fact, I was thinking of using the full warp as a "pipeline" to implement u32 division (mostly as a joke), almost like anti-SWAR. There was some old-ish paper detailing arithmetic latencies in GPUs and division was approximately more than 32x multiplication (...or I could be misremembering).

bobmcnamara•9mo ago
Parallel compares: https://graphics.stanford.edu/~seander/bithacks.html#ZeroInW...
DennisL123•9mo ago
Interesting stuff. Not sure if I read this right that it‘s 16 und 32 bit values of integers that get sorted. If yes, I‘d love to see if the GPU implementation can beat a competitive Radix sort implementation on a CPU.
winwang•9mo ago
It's 32 32-bit values which get sorted. I don't think a GPU sort would beat a CPU sort at this scale, even if you don't take kernel launch time into account. CPUs are simply too fast for (super-)small data, especially with AVX-512. But if we're talking about a larger amount of data, that would be a different story, i.e. as part of a normal gpu mergesort.
maeln•9mo ago
It is also useful if your data already lives on the GPU memory. For example, when you need to z-sort a bunch of particles in a 3d renderer particle system.
exDM69•9mo ago
A 32 way GPU sorting algorithm might be just what I need for sorting and deduplicating triangle id's in a visibility buffer renderer I am working on.

Thanks for sharing.

winwang•9mo ago
As someone who doesn't know very much about graphics (ironically), you're welcome and hope it helps!
fourseventy•9mo ago
What are the biggest use cases of GPU accelerated sorting?

Attention Media ≠ Social Networks

https://susam.net/attention-media-vs-social-networks.html
343•susam•5h ago•152 comments

Fix Your Tools

https://ochagavia.nl/blog/fix-your-tools/
75•vinhnx•2h ago•33 comments

What Is a Database Transaction?

https://planetscale.com/blog/database-transactions
146•0x54MUR41•6h ago•24 comments

Fresh File Explorer – VS Code extension for navigating recent work

https://github.com/FreHu/vscode-fresh-file-explorer
4•frehu•13m ago•2 comments

Show HN: 3D Mahjong, Built in CSS

https://voxjong.com
32•rofko•2h ago•21 comments

Xweather Live – Interactive global vector weather map

https://live.xweather.com/
62•unstyledcontent•3h ago•18 comments

We hid backdoors in ~40MB binaries and asked AI + Ghidra to find them

https://quesma.com/blog/introducing-binaryaudit/
135•jakozaur•3h ago•55 comments

Back to FreeBSD: Part 1

https://hypha.pub/back-to-freebsd-part-1
171•enz•11h ago•80 comments

Git's Magic Files

https://nesbitt.io/2026/02/05/git-magic-files.html
22•chmaynard•4h ago•8 comments

Man accidentally gains control of 7k robot vacuums

https://www.popsci.com/technology/robot-vacuum-army/
106•Brajeshwar•3h ago•58 comments

How Taalas “prints” LLM onto a chip?

https://www.anuragk.com/blog/posts/Taalas.html
332•beAroundHere•23h ago•198 comments

Gamedate – A site to revive dead multiplayer games

https://gamedate.org/
264•msuniverse2026•1d ago•38 comments

How far back in time can you understand English?

https://www.deadlanguagesociety.com/p/how-far-back-in-time-understand-english
691•spzb•4d ago•353 comments

Monkey Patching in VBA

https://ecp-solutions.github.io/ASF/Language%20reference.html
22•n013•4d ago•3 comments

Show HN: Llama 3.1 70B on a single RTX 3090 via NVMe-to-GPU bypassing the CPU

https://github.com/xaskasdf/ntransformer
337•xaskasdf•21h ago•88 comments

How I use Claude Code: Separation of planning and execution

https://boristane.com/blog/how-i-use-claude-code/
802•vinhnx•18h ago•513 comments

Iran students stage first large anti-government protests since deadly crackdown

https://www.bbc.com/news/articles/c5yj2kzkrj0o
226•tartoran•4h ago•274 comments

Japanese Woodblock Print Search

https://ukiyo-e.org/
170•curmudgeon22•15h ago•26 comments

I Analyzed Every Nootropic Study on PubMed

https://outspeaker.com/post/217
11•paulpauper•1h ago•4 comments

Two Bits Are Better Than One: making bloom filters 2x more accurate

https://floedb.ai/blog/two-bits-are-better-than-one-making-bloom-filters-2x-more-accurate
168•matheusalmeida•5d ago•24 comments

ReferenceFinder: Find coordinates on a piece of paper with only folds

https://mutsuntsai.github.io/reference-finder/
53•icwtyjj•3d ago•7 comments

zclaw: personal AI assistant in under 888 KB, running on an ESP32

https://github.com/tnm/zclaw
241•tosh•1d ago•129 comments

Claws are now a new layer on top of LLM agents

https://twitter.com/karpathy/status/2024987174077432126
374•Cyphase•1d ago•839 comments

Volatility: The volatile memory forensic extraction framework

https://github.com/volatilityfoundation/volatility3
29•transpute•5h ago•2 comments

Evidence of the bouba-kiki effect in naïve baby chicks

https://www.science.org/doi/10.1126/science.adq7188
177•suddenlybananas•20h ago•55 comments

The Four-Color Theorem 1852–1976

https://www.ams.org/journals/notices/202603/noti3305/noti3305.html
44•bikenaga•1d ago•5 comments

Parse, Don't Validate and Type-Driven Design in Rust

https://www.harudagondi.space/blog/parse-dont-validate-and-type-driven-design-in-rust/
235•todsacerdoti•22h ago•66 comments

Show HN: TLA+ Workbench skill for coding agents (compat. with Vercel skills CLI)

https://github.com/younes-io/agent-skills/tree/main/skills/tlaplus-workbench
14•youio•4h ago•2 comments

How I launched 3 consoles and found true love at Babbage's store no. 9 (2013)

https://arstechnica.com/gadgets/2013/01/how-i-launched-3-consoles-and-found-true-love-at-babbages...
57•zepearl•3d ago•21 comments

Unreal numbers

https://lcamtuf.substack.com/p/unreal-numbers
51•surprisetalk•5d ago•19 comments