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?

Midjourney Medical

https://www.midjourney.com/medical/blogpost
236•ricochet11•2h ago•212 comments

Lore – Open source version control system designed for scalability

https://lore.org/
1031•regnerba•13h ago•553 comments

Taxonomy of the Occlupanida (parasitoids on bread bag tags)

https://www.horg.com/horg/?page_id=921
95•beatthatflight•4h ago•17 comments

US holds off blacklisting DeepSeek, more than 100 firms deemed security risks

https://www.reuters.com/world/china/us-holds-off-blacklisting-chinas-deepseek-more-than-100-firms...
399•giuliomagnifico•1d ago•441 comments

Storied Colors – a catalogue of named colors

https://storiedcolors.com/
114•susiecambria•6h ago•27 comments

[x86] AI Compute Extensions (ACE) Specification

https://x86ecosystem.org/resource/ai-compute-extensions-ace-specification/
13•matt_d•1h ago•5 comments

Clojure Hosted on Go

https://github.com/glojurelang/glojure
51•dnlo•4h ago•9 comments

Show HN: Spin Lab

https://srijanshukla.com/artifacts/spin-lab/
13•srijanshukla18•1d ago•3 comments

Loreline – Tools for writing interactive fiction

https://loreline.app/en/
96•smartmic•7h ago•12 comments

U.S. science is in chaos

https://www.scientificamerican.com/article/americas-compact-between-science-and-politics-is-broken/
736•presspot•18h ago•885 comments

Show HN: We built an 8-bit CPU as 2nd year EE students

https://github.com/c0rRupT9/STEPLA-1
44•CorRupT9•2d ago•10 comments

Launch HN: Adam (YC W25) – Open-Source AI CAD

https://github.com/Adam-CAD/CADAM
167•zachdive•11h ago•84 comments

How we run Firecracker VMs inside EC2 and start browsers in less than 1s

https://browser-use.com/posts/firecracker-browser-infra
225•gregpr07•1d ago•147 comments

Biological evolution and information acquisition

https://www.construction-physics.com/p/biological-evolution-and-information
23•chmaynard•6d ago•1 comments

How Madrid built its metro cheaply (2024)

https://worksinprogress.co/issue/how-madrid-built-its-metro-cheaply/
55•trymas•8h ago•16 comments

RFC 10008: The new HTTP Query Method

https://www.rfc-editor.org/info/rfc10008/
335•schappim•17h ago•147 comments

Show HN: An 8-bit live gamecast for baseball

https://ribbie.tv/watch
215•brownrout•11h ago•120 comments

Tesco moving 40k server workloads off VMware amid Broadcom's abusive conduct

https://arstechnica.com/information-technology/2026/06/tesco-moving-40000-server-workloads-off-vm...
206•Bender•6h ago•113 comments

Volkswagen started blocking GrapheneOS users

https://discuss.grapheneos.org/d/35949-volkswagen-app?page=3
528•microtonal•12h ago•348 comments

Why thinking out loud with someone beats thinking alone

https://www.thesignalist.io/s/the-dialogue-dividend/
190•kodesko•14h ago•92 comments

Show HN: Inkwash, a watercolor sketching app and explanation

https://johnowhitaker.github.io/inkwash/about
186•Yenrabbit•4d ago•21 comments

GLM-5.2 is the new leading open weights model on Artificial Analysis

https://artificialanalysis.ai/articles/glm-5-2-is-the-new-leading-open-weights-model-on-the-artif...
816•himata4113•18h ago•391 comments

Kirkland Roundabouts

https://kirklandroundabouts.com
171•DenisM•3d ago•137 comments

The Return of Rigorous Full-System Timing Simulation

https://www.sigarch.org/the-return-of-rigorous-full-system-timing-simulation/
37•matt_d•1d ago•0 comments

A robot is sprinting towards you. Do you want it running on Claude or Grok?

https://openrouter.ai/blog/insights/royale-last-agent-standing/
193•Usu•6h ago•171 comments

MicroUI – A tiny, portable, immediate-mode UI library written in ANSI C

https://github.com/rxi/microui
205•peter_d_sherman•15h ago•72 comments

Made a free macOS menu bar app that fixes typing in the wrong keyboard layout

https://flickey.site
55•tal_alfi•8h ago•29 comments

Trellis AI (YC W24) hiring a product lead to build agents for healthcare access

https://www.ycombinator.com/companies/trellis-ai/jobs/Cg94htp-product-lead
1•macklinkachorn•10h ago

Image Compression

https://www.makingsoftware.com/chapters/image-compression
180•vinhnx•4d ago•28 comments

Pink Cosmo berries a hit in their trial season (2023)

https://fruitgrowersnews.com/article/pink-cosmo-berries-a-hit-in-their-trial-season/
11•mooreds•3d ago•3 comments