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?

Escape IntelliJ: Scala and Kotlin LSPs on Emacs Eglot

https://jointhefreeworld.org/blog/articles/emacs/emacs-eglot-scala-kotlin/index.html
54•jjba23•1d ago•11 comments

Terence Tao's ChatGPT conversation about the Jacobian Conjecture counterexample

https://chatgpt.com/share/6a5fdc7a-d6f8-83e8-bbea-8deb42cfed56
864•gmays•15h ago•499 comments

git's –end-of-options Flag

https://nesbitt.io/2026/07/21/end-of-options.html
138•Erenay09•1d ago•70 comments

Cruller: Bun's Zig Runtime, Continued on Zig 0.16

https://ziggit.dev/t/cruller-buns-zig-runtime-continued-on-zig-0-16/16734
43•Erenay09•3h ago•15 comments

Quality non-fiction books are the antithesis of AI slop

https://resobscura.substack.com/p/quality-non-fiction-books-are-the
357•benbreen•19h ago•118 comments

ANSI escape injection in MCP servers: Hidden from humans, visible to AI

https://brightsec.com/research/detecting-ansi-escape-sequence-injection-in-mcp-servers-with-dast/
10•xgpyc2qp•2d ago•2 comments

GigaToken: ~1000x faster Language model tokenization

https://github.com/marcelroed/gigatoken/
503•syrusakbary•16h ago•102 comments

Show HN: Bento - An entire PowerPoint in one HTML file (edit+view+data+collab)

https://bento.page/slides/
825•starfallg•18h ago•184 comments

Everyone should know SIMD

https://mitchellh.com/writing/everyone-should-know-simd
421•WadeGrimridge•15h ago•152 comments

Amiga 1000: Ten years ahead of its time

https://dfarq.homeip.net/amiga-1000-ten-years-ahead-of-its-time/
72•giuliomagnifico•3h ago•41 comments

Are AI labs pelicanmaxxing?

https://dylancastillo.co/posts/pelicanmaxxing.html
524•dcastm•16h ago•205 comments

So Reddit has decided that plain HTML is unsafe

https://www.cole-k.com/2026/07/21/reddit/
455•montroser•20h ago•460 comments

Making ASCII Art in Vim

https://alexyang.dev/vim-ascii-art/
62•evakhoury•2d ago•6 comments

Show HN: Cactus Hybrid: We taught Gemma 4 to know when it's wrong

https://github.com/cactus-compute/cactus-hybrid
130•HenryNdubuaku•15h ago•24 comments

Making

https://beej.us/blog/data/ai-making/
356•erikschoster•17h ago•141 comments

Medici family mystery may be solved after more than 400 years

https://www.cnn.com/2026/07/15/science/medici-family-mystery-dna-malaria
120•effects•11h ago•32 comments

Why malloc always does more than I asked for?

https://ssenthilnathan3.github.io/blog/malloc/
31•nathaah3•2d ago•22 comments

The startup's Postgres survival guide

https://hatchet.run/blog/postgres-survival-guide
406•abelanger•20h ago•191 comments

John C. Dvorak has died

https://twitter.com/na_announce/status/2079952538040672302
745•coleca•14h ago•244 comments

Malleable Computing, Emacs, and You

http://yummymelon.com/devnull/malleable-computing-emacs-and-you.html
107•kickingvegas•12h ago•30 comments

Protecting our FLOSS commons from LLMs

https://blog.codeberg.org/protecting-our-floss-commons-from-llms.html
44•acmnrs•8h ago•3 comments

Computing Camera Rays

https://momentsingraphics.de/CameraRays.html
3•ibobev•1w ago•0 comments

Fairphone 6 wide camera experimental Linux support

https://nondescriptpointer.com/articles/fairphone-6-wide-camera-linux/
121•helonaut•13h ago•31 comments

ascdraw: Editor for ASCII/UTF-8 diagrams (in 144FPS)

https://github.com/exlee/ascdraw
43•xlii•2d ago•5 comments

Businesses with ugly AI menu redesigns

https://blog.fiddery.com/businesses-with-ugly-ai-menu-redesigns/
287•speckx•20h ago•191 comments

Nobody knows what a used GPU cluster is worth

https://ciphertalk.substack.com/p/nobody-knows-what-a-used-gpu-cluster
229•rbanffy•1w ago•208 comments

Restructuring GitHub's bug bounty program

https://github.blog/security/next-chapter-restructuring-githubs-bug-bounty-program/
45•soheilpro•6h ago•16 comments

Back to Kagi

https://blog.melashri.net/micro/back-to-kagi/
266•speckx•20h ago•197 comments

All 253 Patterns from Christopher Alexander's a Pattern Language Summarized

https://claytondorge.com/patterns-list
73•toomuchtodo•11h ago•13 comments

Ghost Cut – Or why Cut and Paste is broken everywhere

https://ishmael.textualize.io/blog/ghost-cut/
166•willm•18h ago•111 comments