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?

Building an HTML-first site doubled our users overnight

https://mohkohn.co.uk/writing/html-first/
243•edent•2h ago•90 comments

PgDog is funded and coming to a database near you

https://pgdog.dev/blog/our-funding-announcement
48•levkk•51m ago•25 comments

Mercedes‑Benz starts large‑scale production of electric axial flux motor

https://media.mercedes-benz.com/en/article/bebac2af-acdc-465a-9538-adb0bf3d8ccf
313•raffael_de•7h ago•177 comments

All 9,300 Japanese train station, animated by the year it opened (1872–2026)

https://jivx.com/eki
71•momentmaker•2h ago•26 comments

macOS Container Machines

https://github.com/apple/container/blob/main/docs/container-machine.md
991•timsneath•14h ago•347 comments

I Hate (Most) Keyboard 'Fn' Keys

https://danq.me/2026/06/09/fn-keys/
114•speckx•1h ago•94 comments

Buy a train, bridge or tracks from the Swiss Railway

https://sbbresale.ch/
82•kisamoto•2d ago•45 comments

Claude Fable 5

https://www.anthropic.com/news/claude-fable-5-mythos-5
2424•Philpax•21h ago•1919 comments

Who Runs Your Rust Future? Hands-On Intro to Async Rust

https://aibodh.com/posts/async-rust-chapter-1-hands-on-intro-to-async-rust/
31•febin•2d ago•0 comments

Britain Became as Poor as Mississippi

https://www.theatlantic.com/magazine/2026/07/uk-productivity-economy-reform-party/687303/
41•SanjayMehta•30m ago•31 comments

A €0.01 bank transfer could compromise a banking AI agent

https://blue41.com/blog/how-we-helped-bunq-secure-their-financial-ai-assistant/
8•tvissers•1h ago•1 comments

AWS Bedrock to require sharing data with Anthropic for Mythos and future models

263•TomAnthony•6h ago•167 comments

Reviving Papers with Code

https://paperswithcode.co/
119•nielz_r•2d ago•24 comments

Hacking for Defense Stanford 2026 – Lessons Learned Presentations

https://steveblank.com/2026/06/08/g-for-defense-stanford-2026-lessons-learned-presentations/
54•sblank•1d ago•26 comments

Show HN: macOS menu bar gauges for your Claude Code quota

https://github.com/grzegorz-raczek-unit8/claude-quota
39•grzracz•5h ago•27 comments

Upcoming breaking changes for npm v12

https://github.blog/changelog/2026-06-09-upcoming-breaking-changes-for-npm-v12/
437•plasma•17h ago•176 comments

Magnetoelectric antennas could transform how underwater robots talk

https://newatlas.com/engineering/magnetoelectric-antennas-submarine-robots-communications/
49•breve•3d ago•19 comments

German ruling declares Google liable for false answers in AI Overviews

https://the-decoder.com/landmark-german-ruling-declares-googles-ai-overviews-are-googles-own-word...
801•ahlCVA•13h ago•442 comments

Rich Sutton on AI creativity and discovery

https://twitter.com/RichardSSutton/status/2061216087744946656
173•yimby•12h ago•87 comments

ICE denies having a protester database. A letter to Congress sheds more light

https://www.npr.org/2026/06/10/nx-s1-5843159/ice-protester-database-dhs
78•Jimmc414•1h ago•18 comments

RIP software hackathons. Long live the hardware hackathon

https://blog.oscars.dev/posts/rip-software-hackathons-long-live-the-hardware-hackathon/
234•ozcap•16h ago•113 comments

Notes on DeepSeek

https://twitter.com/NikoMcCarty/status/2064686557400100884
28•vinhnx•50m ago•12 comments

Ultrafast machine learning on FPGAs via Kolmogorov-Arnold Networks

https://aarushgupta.io/posts/kan-fpga/
261•ag2718•19h ago•39 comments

Surprise, pay $1000

https://forestwalk.ai/blog/surprise-blacksmith-costs/
273•apike•16h ago•117 comments

What it feels like to work with Mythos

https://www.oneusefulthing.org/p/what-it-feels-like-to-work-with-mythos
332•swolpers•21h ago•291 comments

I thought I knew how electrolysis worked [video]

https://www.youtube.com/watch?v=eq7fR9ISuCw
80•tambourine_man•5d ago•9 comments

'They take you out of life, out of time': a journey into Spain's cave paintings

https://www.theguardian.com/science/2026/jun/02/journey-into-spain-palaeolithic-cave-paintings-al...
6•NaOH•1d ago•0 comments

The oldest surviving animated feature film at 100

https://www.bbc.com/culture/article/20260603-how-a-26-year-old-german-woman-made-the-worlds-oldes...
137•1659447091•3d ago•27 comments

OpenCV 5 Is Here: The Biggest Leap in Years for Computer Vision

https://opencv.org/opencv-5/
797•ternaus•4d ago•143 comments

More Molly Guards

https://unsung.aresluna.org/more-molly-guards/
164•zdw•3d ago•19 comments