frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Faster sorting with SIMD CUDA intrinsics (2024)

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

Comments

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

New sphere-packing record stems from an unexpected source

https://www.quantamagazine.org/new-sphere-packing-record-stems-from-an-unexpected-source-20250707/
331•pseudolus•15h ago•148 comments

# [derive(Clone)] Is Broken

https://rgbcu.be/blog/derive-broken/
81•RGBCube•3d ago•51 comments

Berry Script: lightweight embedded scripting language for microcontrollers

https://berry-lang.github.io/
13•hasheddan•2d ago•3 comments

Epanet-JS

https://macwright.com/2025/07/03/epanet-placemark
98•surprisetalk•3d ago•10 comments

Mercury: Ultra-fast language models based on diffusion

https://arxiv.org/abs/2506.17298
461•PaulHoule•21h ago•201 comments

The chemical secrets that help keep honey fresh for so long

https://www.bbc.com/future/article/20250701-the-chemical-secrets-that-help-keep-honey-fresh-for-so-long
148•bookofjoe•3d ago•83 comments

LookingGlass: Generative Anamorphoses via Laplacian Pyramid Warping

https://studios.disneyresearch.com/2025/06/09/lookingglass-generative-anamorphoses-via-laplacian-pyramid-warping/
83•jw1224•11h ago•17 comments

I used o3 to profile myself from my saved Pocket links

https://noperator.dev/posts/o3-pocket-profile/
387•noperator•20h ago•147 comments

What Microchip doesn't (officially) tell you about the VSC8512

https://serd.es/2025/07/04/Switch-project-pt3.html
100•ahlCVA•3d ago•21 comments

Launch HN: Morph (YC S23) – Apply AI code edits at 4,500 tokens/sec

184•bhaktatejas922•18h ago•146 comments

The New York Times wants your private ChatGPT history – even the deleted parts

https://thehill.com/opinion/technology/5383530-chatgpt-users-privacy-collateral-damage/
37•isolli•1h ago•39 comments

The Miyawaki Method of micro-forestry

https://www.futureecologies.net/listen/fe-6-5-the-method
154•zeristor•3d ago•29 comments

ChatGPT testing a mysterious new feature called 'study together'

https://techcrunch.com/2025/07/07/chatgpt-is-testing-a-mysterious-new-feature-called-study-together/
19•Bluestein•2h ago•13 comments

The Two Towers MUD

https://t2tmud.org/
99•astronads•2d ago•62 comments

Adding a feature because ChatGPT incorrectly thinks it exists

https://www.holovaty.com/writing/chatgpt-fake-feature/
905•adrianh•18h ago•331 comments

What is going on in Unix with errno's limited nature

https://utcc.utoronto.ca/~cks/space/blog/unix/ErrnoWhySoLimited
41•ingve•4d ago•18 comments

When Figma starts designing us

https://designsystems.international/ideas/when-figma-starts-designing-us/
246•bravomartin•1d ago•110 comments

My first verified imperative program

https://markushimmel.de/blog/my-first-verified-imperative-program/
148•TwoFx•15h ago•69 comments

François Chollet: The Arc Prize and How We Get to AGI [video]

https://www.youtube.com/watch?v=5QcCeSsNRks
191•sandslash•4d ago•169 comments

Why are there no good dinosaur films?

https://briannazigler.substack.com/p/why-are-there-no-good-dinosaur-films
99•fremden•3d ago•228 comments

CU Randomness Beacon

https://random.colorado.edu/
27•wello•3d ago•6 comments

Show HN: NYC Subway Simulator and Route Designer

https://buildmytransit.nyc
160•HeavenFox•19h ago•19 comments

SIMD.info – Reference tool for C intrinsics of all major SIMD engines

https://simd.info/
24•pabs3•7h ago•6 comments

Lightfastness Testing of Colored Pencils

https://sarahrenaeclark.com/lightfast-testing-pencils/
148•picture•3d ago•39 comments

Man of Glass: Boccaccio: A Biography

https://literaryreview.co.uk/man-of-glass
5•Thevet•3d ago•0 comments

Integrated photonic source of Gottesman–Kitaev–Preskill qubits

https://www.nature.com/articles/s41586-025-09044-5
9•gnabgib•3d ago•1 comments

Analysing Roman itineraries using GIS tooling

https://link.springer.com/article/10.1007/s12520-025-02175-w
28•diodorus•3d ago•3 comments

Hymn to Babylon, missing for a millennium, has been discovered

https://phys.org/news/2025-07-hymn-babylon-millennium.html
193•wglb•4d ago•84 comments

Solving Wordle with uv's dependency resolver

https://mildbyte.xyz/blog/solving-wordle-with-uv-dependency-resolver/
160•mildbyte•2d ago•15 comments

The era of exploration

https://yidingjiang.github.io/blog/post/exploration/
93•jxmorris12•18h ago•8 comments