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?

Gemini 4 Argon

https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-argon/
1127•bradleyg223•8h ago•752 comments

The top secret URSALA, RAQUEL, and FARRAH satellites (2025)

https://www.thespacereview.com/article/4951/1
165•Bluestein•6h ago•70 comments

56k.rip – the 1996 dial-up internet experience

https://56k.rip/
112•adunk•6h ago•61 comments

Why the Bronze Age Collapsed

https://www.worksinprogress.news/p/why-really-caused-the-bronze-age
129•AnodicElegy•1d ago•70 comments

Surprisingly complex waves reveal the brain's inner workings

https://www.quantamagazine.org/surprisingly-complex-waves-reveal-the-brains-inner-workings-20260930/
141•ibobev•9h ago•49 comments

Singapore govt dating app uses Gale-Shapley stable marriage algorithm

https://twitter.com/tuakdotsol/status/2105105417760391258
280•rzk•19h ago•205 comments

Cities Are Forced to Funnel License Plate Data to a Federal Surveillance Program

https://www.404media.co/how-cities-are-forced-to-funnel-license-plate-data-to-a-massive-federal-s...
60•ripe•2h ago•13 comments

EDG C++ front-end goes public

https://edgcpp.org/#transition
177•iandinwoodie•9h ago•80 comments

Launch HN: Magnitude (YC S25) – Self-optimizing inference engine for agents

https://github.com/magnitudedev/magnitude
137•anerli•10h ago•61 comments

Show HN: Yantra – an LALR(1) parser generator for C++

https://github.com/TantrixAuto/yantra
7•renjipanicker•2h ago•2 comments

Halfspace experimental IDE for solid modeling with distance fields

https://www.mattkeeter.com/projects/halfspace/
90•luu•8h ago•9 comments

A brief history of the Bloomberg terminal

https://spectrum.ieee.org/bloomberg-terminal
239•rbanffy•14h ago•97 comments

5x faster Edge Functions: V8 isolates to Firecracker MicroVMs

https://www.netlify.com/blog/edge-functions-firecracker-microvms/
137•jbott•10h ago•53 comments

Before pixels: Modular industrial dashboards

https://unsung.aresluna.org/before-pixels-modular-industrial-dashboards/
70•leephillips•9h ago•13 comments

CHOMPI portable sampler instrument is now open-source (hardware and software)

https://www.chompiclub.com/opensource
60•lashkari•10h ago•12 comments

Doing a Machine Learning PhD While Working in Japan

https://www.tokyodev.com/articles/doing-a-machine-learning-phd-while-working-in-japan
61•pwim•21h ago•21 comments

I could've accessed 17T Microsoft records

https://blog.faav.net/how-i-couldve-accessed-17-trillion-microsoft-records
267•luispa•2d ago•115 comments

What TLA+ can and can't check

https://buttondown.com/hillelwayne/archive/what-tla-can-and-cant-check/
157•b-man•14h ago•34 comments

The last time my family was replaced by technology

https://manuel.darcemont.fr/posts/the-last-time-my-family-was-replaced-by-technology/
197•megalomanu•15h ago•446 comments

Great Dirhombicosidodecahedron ("Miller's Monster")

https://www.software3d.com/MillersMonster.php
50•cobbzilla•11h ago•4 comments

Jevotron: Multiple Jev integrations from the command line

https://cmungall.github.io/jevotron/
6•chrismungall•2h ago•0 comments

Burning Man death rates – A short lesson in statistics

https://ihavenapkinthoughts.substack.com/p/burning-man-death-rates-a-short-lesson
114•viraj_shah•2d ago•150 comments

PlayBook: A Programmable Paper Notebook [video]

https://www.youtube.com/watch?v=GurWDZ8ENpA
3•surprisetalk•1d ago•0 comments

Coltrane's Tone Circle

https://jtomschroeder.com/blog/tone-circle/
39•jtomschroeder•13h ago•16 comments

Responsible Release of AI-Generated Mathematics

https://agmai.org/general-sep29/
83•aureianimus•1d ago•104 comments

Functional Ultrasound Imaging (fUSI) from scratch

https://www.neuroai.science/p/functional-ultrasound-imaging-from
33•pminimax•8h ago•7 comments

cmart's Hardcore Coworking

https://cmart.blog/hardcore-coworking/
8•zdw•1d ago•2 comments

Bild AI (YC W25) Is Hiring a Founding Product Engineer

https://www.ycombinator.com/companies/bild-ai/jobs/dAbC3Gd-founding-product-engineer
1•rooppal•11h ago

SDF vs. MSDF vs. Slug: GPU Text Rendering

https://alphapixeldev.com/sdf-vs-msdf-vs-slug-vs-rive-gpu-text-rendering/
142•ibobev•14h ago•54 comments

Show HN: Lathoa, a math app for kids where the AI is wrong on purpose

https://lathoa.ai/en
42•thanouil1411•13h ago•18 comments