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?

Livenerf: Has Opus 5.5 been nerfed yet?

https://github.com/ninjahawk/livenerf
492•bryan0•8h ago•211 comments

Dots: Always-on agents

https://openai.com/index/introducing-dots/
553•alvis•13h ago•416 comments

Responsible Release of AI-Generated Mathematics

https://agmai.org/general-sep29/
38•aureianimus•4h ago•37 comments

U.S. postal inspectors shut down website selling counterfeit postage labels

https://postalemployeenetwork.com/news/2026/09/26/u-s-postal-inspectors-shut-down-website-selling...
207•ilamont•11h ago•123 comments

Vermont replacing power plants with home batteries

https://www.bbc.com/future/article/20260928-a-virtual-power-plant-hidden-in-vermont-homes-is-keep...
149•devonnull•12h ago•123 comments

NASA asked several former SR-71A staffers to help secret restart

https://aviationweek.com/defense/aircraft-propulsion/nasa-asked-several-former-sr-71a-staffers-he...
123•ilamont•20h ago•116 comments

RSS Feeds for Last.fm

https://lfm.xiffy.nl/
38•Baljhin•4h ago•5 comments

America.gov

https://america.gov/
508•plesiv•16h ago•415 comments

Testing WebGPU data layouts with Facet

https://www.mattkeeter.com/blog/2026-08-23-wgpu-facet/
18•luu•1d ago•0 comments

Show HN: Real-time Solar System with 526k asteroids and all tracked satellites

https://space.bl2.net/
196•wanick•11h ago•46 comments

PSSA: A non-transformer language model written from scratch in Rust

https://github.com/Sparticle62ops/pssa
68•sparticle62•3h ago•23 comments

How Delhi cut electricity loss from 50 to 5 percent

https://spectrum.ieee.org/delhi-electricity-loss
494•rbanffy•18h ago•280 comments

GPT 6.1 Sol: Near-Astra intelligence for a fifth of the price

https://openai.com/index/introducing-gpt-6-1-sol/
884•crorella•13h ago•802 comments

Backblaze drive stats for Q2 2026

https://www.backblaze.com/blog/backblaze-drive-stats-for-q2-2026/
160•HieronymusBosch•17h ago•38 comments

Needed 1+1, built a functional programming language

https://hereticpleb.vercel.app/blog/needed-one-plus-one/
78•birdculture•14h ago•18 comments

Phyllotaxis: An audio-reactive LED display

https://jagi.studio/posts/phyllotaxis/
276•evakhoury•1d ago•46 comments

When oil prices spike, where does the money go?

https://theconversation.com/when-oil-prices-spike-where-does-the-money-go-280763
67•thelastgallon•1d ago•59 comments

Language models for text classification: From bag-of-words to Jev

https://magazine.sebastianraschka.com/p/classifier-history-and-jev
83•Anon84•19h ago•2 comments

PS5 Relapse Exploit

https://github.com/ntfargo/Relapse-Exploit
280•therepanic•15h ago•169 comments

NAND-16: a computer built from 277,248 NAND gates

https://somethingbig.ai/computer
130•rossant•2d ago•71 comments

Ask HN: What are you reading?

233•dan-bailey•17h ago•493 comments

A Staff Engineer's Guide to Inventing Work

https://sujithjay.com/inventing-work
245•amortize•1d ago•49 comments

We’re forgetting what darkness feels like

https://www.theguardian.com/environment/2026/sep/29/night-sky-darkness-city-regulation
136•pseudolus•12h ago•72 comments

Show HN: Using 2D DFT, dithering, etc. to maximize eInk manga image quality

https://github.com/ciromattia/kcc
8•seam_carver•1d ago•1 comments

Ballmer Peak

https://en.wikipedia.org/wiki/Ballmer_Peak
41•thunderbong•4h ago•6 comments

Show HN: NSL – WSL for Linux

https://frostyard.github.io/nsl/
120•bketelsen•16h ago•78 comments

Tcl/Tk 9.1

https://www.tcl-lang.org/software/tcltk/9.1.html
264•dmux•13h ago•107 comments

NRC issues first U.S. construction permit for a BWRX-300 small modular reactor

https://www.gevernova.com/news/press-releases/nrc-issues-first-us-construction-permit-bwrx-300-sm...
21•papa-whisky•7h ago•2 comments

Commodore 64: Mercenary

https://gamesexplained.com/c64/mercenary/
45•a1r•3d ago•6 comments

Stuck in the Suez Canal – the short version (2021)

https://cathsenker.co.uk/stuck-in-the-suez-canal-the-short-version/
51•joebig•2d ago•6 comments