frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Faster sorting with SIMD CUDA intrinsics (2024)

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

Comments

ashvardanian•1y 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•1y 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•1y 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•1y 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•1y ago
Parallel compares: https://graphics.stanford.edu/~seander/bithacks.html#ZeroInW...
DennisL123•1y 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•1y 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•1y 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•1y 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•1y ago
As someone who doesn't know very much about graphics (ironically), you're welcome and hope it helps!
fourseventy•1y ago
What are the biggest use cases of GPU accelerated sorting?

One Year of Sponsored Servo Development

https://servo.org/blog/2026/09/15/one-year-of-sponsorship/
22•AshleysBrain•37m ago•2 comments

Nvidia announces native GPU programming in Rust

https://developer.nvidia.com/blog/introducing-cuda-rust-two-tracks-for-writing-gpu-kernels/
659•nonmaskable•21h ago•250 comments

Keys Not Included: recovering the signing keys for US driver's license barcodes

https://ryan.science/blog/keys-not-included
156•Ryan5453•5h ago•55 comments

The Relation Between Mathematics and Physics by Paul Dirac

https://www.damtp.cam.ac.uk/events/strings02/dirac/speach.html
36•rramadass•3d ago•8 comments

My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

https://jakeasmith.com/blog/http-build-url/
88•jakeasmith•1d ago•10 comments

Training a 4B model to produce 81% faster query plans than Postgres

https://rohanbansal.com/qorl
535•polyphilz•14h ago•112 comments

Comparison of Malloc() Algorithms

https://egbert.net/blog/articles/comparison-of-arena-architecture-in-malloc.html
65•egberts1•1d ago•8 comments

Xiaomi Mimo 2.6 live post-training dashboard

https://mimo.xiaomi.com/rl/
421•krackers•12h ago•104 comments

Lucasart's Afterlife

https://togameforlife.wordpress.com/2023/12/09/on-lucasarts-afterlife/
8•Bondi_Blue•1d ago•2 comments

Cloudflare/Security-Audit-Skill

https://github.com/cloudflare/security-audit-skill
47•donk8r•4h ago•5 comments

Backups Aren't Simple

https://filipovski.net/2026/09/16/backups-arent-simple.html
225•afilipovski•12h ago•136 comments

Small programming tricks

https://will-keleher.com/posts/small-programming-tricks-matter/
512•signa11•16h ago•228 comments

Developing provably correct Rust code with Verus

https://www.amazon.science/blog/developing-provably-correct-rust-code-with-verus
106•Betelbuddy•2d ago•12 comments

Breaking the 1.58-bit Barrier for Ternary LLMs

https://arxiv.org/abs/2609.16338
201•matt_d•11h ago•31 comments

The engineering behind the US Strategic Petroleum Reserve

https://johnjwang.com/post/2026/09/15/engineering-behind-us-strategic-petroleum-reserve
198•johnjwang•1d ago•77 comments

A 32-year-old bug walks into a Telnet server

https://labs.watchtowr.com/a-32-year-old-bug-walks-into-a-telnet-server-gnu-inetutils-telnetd-cve...
53•paimapi•1d ago•21 comments

The Return of Sail Power: Cargo Ships Are Turning Back to the Wind

https://gcaptain.com/the-return-of-sail-power-cargo-ships-are-turning-back-to-the-wind/
87•gumby•8h ago•52 comments

OpenSpec – A lightweight and configurable AI spec framework

https://openspec.dev/
136•etoxin•9h ago•55 comments

PCB is brought to you by Fable 5

https://a6mzero.com/posts/this-pcb-is-brought-to-you-by-fable-5/
95•jasonpeacock•2d ago•45 comments

Show HN: An e-ink frame that hears birds and draws them as 1800s illustrations

https://github.com/arnegiacomo/fugleramme
2154•arnemunthekaas•1d ago•243 comments

HarnessTax: How Much Does the Harness Matter for Coding Agents?

https://harnesstax.github.io/
120•matt_d•10h ago•48 comments

AWS says it can't restore some data from mideast facilities struck by Iran

https://www.wsj.com/world/middle-east/aws-says-it-cant-restore-some-data-from-mideast-facilities-...
386•berkeleyjunk•1d ago•328 comments

Performance Improvements in .NET 11

https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-11/
280•soheilpro•1d ago•58 comments

Jev Ultrafast: A browser agent with a dynamic, indexed action space

https://github.com/browser-use/jev-ultrafast
51•rahimnathwani•5h ago•3 comments

Japan's book scene is moving from bookstores to libraries

https://untranslatedjp.substack.com/p/japans-book-scene-is-quietly-moving
183•herbertl•4d ago•77 comments

US interest rates raised for first time in three years

https://www.bbc.com/news/articles/cw4gmlyvj422o
53•higginsniggins•9h ago•30 comments

Reversing Factorio's RNG

https://gegell.github.io/posts/factorio-rng/
201•jheitmann•4d ago•29 comments

Part-human part-mouse brain developed in science breakthrough

https://www.bbc.com/news/articles/c60m3k28j81mo
40•marc__1•7h ago•27 comments

Anecdotally, programmers dislike "reduce"

https://evanhahn.com/posts/2026-09-13-programmers-dislike-reduce/
149•vinhnx•3d ago•224 comments

Reverse-engineered Jev-like model

https://github.com/vinnylarouge/jevlike
123•rochansinha•14h ago•18 comments