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?

Don't Paste the AI, please

https://dontpastetheai.com/
170•pjerem•1h ago•96 comments

Windows brings out the Rorschach test in everyone

https://devblogs.microsoft.com/oldnewthing/20030825-00/?p=42803
161•luu•3h ago•69 comments

OpenRouter is joining Stripe

https://openrouter.ai/blog/announcements/openrouter-is-joining-stripe/
838•rvz•16h ago•440 comments

Turns are Better than Radians (2022)

https://www.computerenhance.com/p/turns-are-better-than-radians
206•mayoff•8h ago•93 comments

Go 1.27

https://go.dev/blog/go1.27
635•database64128•15h ago•182 comments

Google has stopped pushing Git tags for some Android source code

https://grapheneos.social/@GrapheneOS/117057099753905023
557•Animux•15h ago•229 comments

A faster way to calculate the day of the week

https://www.benjoffe.com/fast-day-of-week
147•gavide•3d ago•25 comments

Manabu Kosaka's Handmade Paper Sculptures

https://coca11272000.wixsite.com/manabukosaka
131•surprisetalk•19h ago•14 comments

A joke domain purchase turned in geopolitical warfare

https://sprocketfox.io/xssfox/2026/08/19/sondehub-and-war/
904•kareiva•22h ago•144 comments

Unsloth Dynamic 3.0 GGUFs

https://unsloth.ai/docs/basics/dynamic-3.0-ggufs
266•jonesy827•15h ago•97 comments

Unlocking a locked/deactivated e-waste Cricut Maker

https://sprocketfox.io/xssfox/2026/07/01/cricut-unlock/
206•1e1a•14h ago•51 comments

The Chauffeur Problem

https://engines.egr.uh.edu/episode/1495
17•leowoo91•3d ago•2 comments

Casio F-B100W-1A

https://www.casio.com/uk/watches/casio/product.F-B100W-1A/
380•__fst__•18h ago•313 comments

Sol loves to cheat

https://jumploops.com/blog/sol-loves-to-cheat/
165•jumploops•1d ago•122 comments

Feature Request: Support AGENTS.md

https://github.com/anthropics/claude-code/issues/6235
258•fg137•12h ago•153 comments

Geolocating a random island using geometry and CUDA programming

https://yassa9.github.io/osint/gralhix-004/
475•yassa9•21h ago•78 comments

Os8088.com: IBM XT OS now has a Browser, CP/M 2.2 with Z80 core and MS Word 1.1a

https://os8088.com/spotlight/
91•jggonz•12h ago•43 comments

fx :Tiny, open, native coding agent.

https://fx.sh
265•handfuloflight•1d ago•113 comments

PostgreSQL for Everything

https://www.raphaelbauer.com:443/posts/postgresql-everything/
369•karlmush•20h ago•217 comments

Mathematics in the age of AI

https://arxiv.org/abs/2608.16753
168•jonbaer•18h ago•198 comments

What's missing to have reproducible builds on PyPI

https://snarky.ca/whats-missing-to-have-reproducible-builds-on-pypi/
12•Ravencentric•4d ago•2 comments

Pixel 11 Pro Fold feels like the end of an era

https://www.theverge.com/tech/981956/google-pixel-11-pro-fold-review
67•animalcule•14h ago•153 comments

The little-known winstart.bat batch file

https://devblogs.microsoft.com/oldnewthing/20260811-00/?p=112605
118•ingve•4d ago•32 comments

Launch HN: OneCLI (YC S26) – OSS sandboxed agent harness for teams

https://github.com/onecli/onecli
76•guyb3•17h ago•22 comments

Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)

https://github.com/cesarblum/sectorforth
23•sigalor•3d ago•5 comments

RAPx: A static analysis tool for Rust programs

https://github.com/safer-rust/RAPx
4•rendaw•4d ago•1 comments

Air Theremin – A browser theremin you play by waving at your webcam

https://theremin.bizibah.com/
274•gurov•23h ago•95 comments

Why Microsoft Entertainment Pack had a sticker announcing that it had Tetris?

https://devblogs.microsoft.com/oldnewthing/20260818-00/?p=112621
56•tybulewicz•5h ago•29 comments

Xorshift Generators

https://www.alanzucconi.com/2026/08/15/xorshift-generators/
83•tobr•4d ago•43 comments

Extensible Software in the age of LLMs

https://jeremymorrell.dev/blog/extensible-software-in-the-age-of-llms/
151•coloneltcb•17h ago•62 comments