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?

A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth

https://www.gpupartner.com/blog/beginners-guide-local-ai-inkling-qwen-unsloth
231•Retell15•4h ago•86 comments

The Birds of GTA 6: A Field Guide to Vice City and Leonida's Wildlife

https://www.audubon.org/magazine/birds-of-gta-6-field-guide-vice-city-wildlife
357•gaws•6h ago•161 comments

Free alternative TV network built from the Internet Archive's forgotten videos

https://spelunkr.tv
19•SockThief•44m ago•2 comments

Cathedral floor emerges in Sudan, revealing one of the biggest medieval churches

https://apnews.com/article/sudan-antiquities-nubia-cathedral-1b16f67da881ee5592de4481ee55c527
105•graemep•4d ago•5 comments

GL.iNet Security Notice 2026-11-20

https://www.gl-inet.com/en-us/blogs/blog/glinet-security-notice-2026-11-20
87•gregsadetsky•2h ago•35 comments

A miniature San Francisco with live buses, planes and boats

https://smallsf.com/
145•dutilh•5h ago•60 comments

The Usefulness of Useless Knowledge [pdf] (1939)

https://www.ias.edu/sites/default/files/library/UsefulnessHarpers.pdf
63•hectormauer•3h ago•11 comments

Progress map for the Lean formalization of Alessandro Masullo's manuscript

https://claude.ai/artifact/CtQyX8qfYAF822bgHJHHE3
152•Qision•2h ago•125 comments

Nyx, the Oldest Internet Service Provider

https://nyx.net/
98•o_-_o•5h ago•9 comments

The struggle for freedom: How BSD escaped AT&T licensing

https://fosscomics.com/posts/16.%20BSD%20Unix%20Part%206%20-%20The%20Struggle%20for%20Freedom/
46•joonehur•4h ago•13 comments

What should AAA game devs do

https://gamethoughts.bearblog.dev/what-should-aaa-game-devs-do/
21•TuckerBMorgan•2h ago•35 comments

Masullo on the Riemann Hypothesis

https://johncarlosbaez.wordpress.com/2026/11/22/masullo-on-the-riemann-hypothesis/
17•xiaoyu2006•14h ago•0 comments

Perplexity and Intelligence

https://openai.com/index/perplexity-and-intelligence/
483•acossta•8h ago•334 comments

What Happened to Silicon Valley?

https://www.oreilly.com/radar/what-happened-to-silicon-valley/
430•greenyouse•6h ago•248 comments

Assume People Are Not Interested in Your Blog Post

https://danielsada.tech/blog/assume-people-are-not-interested-in-your-blog-post/
59•dshacker•6h ago•32 comments

How the World Draws the World

https://googlemapsmania.blogspot.com/2026/10/how-world-draws-world.html
6•surprisetalk•2d ago•0 comments

Localcode, open source agentic coding on your Mac with one command

https://github.com/mjwsolo/localcode
23•mjwsolo•3h ago•5 comments

Show HN: I built a game where you are an LLM's subagent

https://github.com/gulivan/worker755
272•ivantgam•12h ago•64 comments

Advice for Young Researchers

http://togelius.blogspot.com/2026/11/advice-for-young-researchers.html
51•tcumulus•4d ago•19 comments

Open Social Web Alliance

https://osw-alliance.net/en/
223•doener•10h ago•215 comments

I joined the NTP Pool, but not with my Stratum 1 Pi

https://www.jeffgeerling.com/blog/2026/i-joined-the-ntp-pool/
126•fortran77•10h ago•38 comments

Will the first approved psychedelic become a blockbuster?

https://www.pharmavoice.com/news/race-first-psilocybin-blockbuster-compass-usona/875270/
26•randycupertino•4h ago•23 comments

What we learned operating auth for 1k APIs

https://nango.dev/blog/lessons-from-operating-api-auth-for-900-apis/
3•fagnerbrack•56m ago•1 comments

Nespresso's project to reduce grams of coffee per capsule

https://alvinbunk.wordpress.com/2026/11/01/nespresso-project-olympus/
89•bobbiechen•2h ago•82 comments

Toyota, Nissan, and Honda to standardize parts to lower costs

https://www.caranddriver.com/news/a74490092/toyota-nissan-honda-standardize-parts-lower-costs/
1193•zdw•21h ago•681 comments

Harvard CS 2881R AI Safety

https://boazbk.github.io/mltheoryseminar/
40•enjoyyourlife•7h ago•5 comments

A Better Vocabulary for Testing

https://alperenkeles.com/posts/vocab-for-testing/
114•alpaylan•1d ago•29 comments

Ask HN: Tips for transitioning from web development to embedded/firmware?

118•llmblockchain•4d ago•73 comments

Agent swarm trying to solve P vs. NP

https://pequalnp.com/
111•bananaflag•4h ago•105 comments

Inside PyPy: First Contact with RPython

https://bernsteinbear.com/blog/inside-pypy-first-contact-with-rpython/
61•lumpa•3d ago•9 comments