Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. When did Google get so weird? (sancho.bearblog.dev)
    259comments
  2. Ember-1 (fireworks.ai)
    159comments
  3. Lunar Terminator Paradox (secretsauce.net)
    17comments
  4. Alan Kay's answer to “Did the ENIAC have a BIOS”? (quora.com)
    19comments
  5. Show HN: Lofi Cities – Pixel-art city nights with browser-generated lofi (loficities.com)
    55comments
  6. The state of SIMD in Rust in 2026 (shnatsel.github.io)
    18comments
  7. There is more to code review than (automatable) detection (adaptivecapacitylabs.com)
    12comments
  8. Don't couple your Go code to GitHub (iain.rocks)
    49comments
  9. Imp is a full port of DSPy to the BEAM (github.com/deepfates)
    5comments
  10. What I did at Recurse Center (thill.me)
    14comments
  11. In an $80 motel room, a discovery to shed light on the origins of life (nytimes.com)
    76comments
  12. Oral history of John Chowning, inventor of FM synthesis [video] (youtube.com)
    6comments
  13. S3 Is the Future, S3 Is the Past (btrblocks.com)
    8comments
  14. Replacing the old battery on rechargeable bike lights (jvns.ca)
    66comments
  15. Writing Efficient C++ Code (2013) (asawicki.info)
    74comments
  16. The Cartesian Hand: In-Hand Manipulation with All-Linear Fingers (generalroboticslab.com)
    8comments
  17. My Recent Woodworking Projects (notoriousbfg.com)
    —discuss
  18. Previously unheard recordings of John Coltrane, captured by Frank Tiberi (jazzwise.com)
    15comments
  19. Flip Fluid on Flip Dots (mitxela.com)
    23comments
  20. Fragment of oldest known peace treaty found in Turkey (livescience.com)
    8comments
  21. Fakecloud: Local AWS cloud emulator for integration tests (fakecloud.dev)
    49comments
  22. The Normalization of Inexplicable Failures (ihatethefuture.com)
    91comments
  23. Faster prompt lookup drafting in llama.cpp (jadidbourbaki.github.io)
    9comments
  24. Show HN: TinyAIArena watch AI agents battle it out (tinyaiarena.com)
    40comments
  25. Video CDs Break Windows Explorer (clydesnotes.blogspot.com)
    30comments
  26. EV Sales Are Booming in Europe with Gasoline at $10 a Gallon (bloomberg.com)
    10comments
  27. KICKI: a DECsystem1060 (icm.museum)
    2comments
  28. On caring for user data: NeoVim caused Vim undo files to be deleted (aresluna.org)
    303comments
  29. Improving site performance by shipping more CSS (github.blog)
    64comments
  30. C's Flexible Integer Sizes Were Not a Design Mistake (pikuma.com)
    118comments

The state of SIMD in Rust in 2026

64 pointsby 2d agoshnatsel.github.io
18 comments
2h agoHN ↗

Hot take: there is no portable SIMD.

You can either have performance (=write manual ASM for each platform), or portability, but not both.

What so-called "portable SIMD" libraries give you is "portable auto-vectorization". "Portable performance" is a global property of the algorithm. Relying on auto-vectorization will result in e.g. sub-optimal register spills in practice. The microbenchmarks will look great, though. ;)

2h agoHN ↗

there is no portable SIMD

Except in languages with a JIT compiler

2h agoHN ↗

Starts to get a bit philosophical on what constitutes "portable" but JIT compilers would emit an opcode based off of whatever the frontend/IR is saying to do surely?

1h agoHN ↗

That still just gets you autovectorization, and generally locks you out of the performance you could have with direct SIMD intrinsics.

Granted, the number of cases this distinction matters is relatively small, making a function faster only makes a program appreciably faster if that function is a bottleneck.

2h agoHN ↗

What about numpy, numba, and torch.compile?

2h agoHN ↗

Those are manually optimized per arch, aren't they?

1h agoHN ↗

The libraries, yes, but the code you write is portable (at least until you get into squeezing the last few percent and switch to Triton / Helion in case of GPU, and even those are decently portable).

There's also Halide, where you write the algo but the framework gets you the scheduling and SIMD.

2h agoHN ↗

Getting 2x or 4x performance in your inner loops using a reasonable SIMD library is infinitely better than theoretically getting 8x performance with hand-coded nonportable intrinsics, because the latter is never going to happen in most programs, so the actual point of comparison is scalar code, or autovectorized code at best.

4m agoHN ↗

No it's not because it sucks the air out from the actual solution. ISPC more than a decade ago managed to demonstrate close-to-linear speedups for increasing vector sizes, even for branchy code.

Nowadays you can even get AI to write intristics and it works just fine, the portable libraries/autovec aren't really a serious player here.

Portability is also overstated - see the recent shift where Spotify decided to make native Android/iOS apps again instead of React Native. Usually, the number of relevant platforms is somewhere between 2 and 3, so portability concerns are more theoretical than real.

2h agoHN ↗

It's a continuum. Some things basically all SIMD implementations support. Want to add 2 4xf32 vectors together? That's pretty easy to do portably.

But yeah to be fair if you are at that point, you probably want to go fully non-portable anyway. Especially with AI.

Has anyone even figured out how to do vector stuff (SVE/RVV) without assembly?

1h agoHN ↗

I agree with that historically auto-vertorization does not seem to work reliably. I'm not sure about your broad claim.

Thoughts on an abstraction over ARM and x86, at 128, 256, and 512-bit widths which, either in a manual or automatic way (The latter more challenging) makes your floating point computations 4-16x faster with minimal restructuring? I think that's doable, and a nice goal of SIMD.

1h agoHN ↗

You've got a point but are overstating it considerably. There is a big gap between just autovectorization and the portable primitives a library like Highway or Fearless SIMD will give you. For example, I haven't seen autovectorization do select or swizzle.

But there's another point in the tradeoff space. One of the explicit design decisions in Fearless SIMD is to support "downcasting," or specialization to a specific microarchitecture. At least for the kind of problems I've worked on, even when you're doing something fancy with arch-specific permutations or what not, the majority of the operations will be pretty vanilla, and can be expressed well in the portable subset.

So you can think of a library like Fearless SIMD as enabling your extreme optimization use case, just more ergonomically.

Of course, this depends on LLVM compiling intrinsics to assembly efficiently. That hasn't always been the case, and is not perfect now (a number of issues have been filed against rustc and LLVM while developing Fearless SIMD), but is pretty good.

As always, though, you do have to measure performance, and I frequently look at the assembler output to double-check that it's doing the right thing. The day of "fire and forget" portable SIMD has not yet arrived.

1h agoHN ↗

The issue with libraries which offer you portable simd is that the auto vectorizer of the compiler will likely generate faster code.

35m agoHN ↗

The autovectorizer afaik rarely emits optimizations for the different vector units to support + efficiently caches the CPUid check to happen once on program start. It’s a good baseline but the continuum (today) is scalar -> auto vectorized -> portable SIMD -> hand rolled explicit. That portable SIMD lets you bridge into hand rolled explicit ergonomically is a power auto-vectorization doesn’t have. Either the compiler does it or doesn’t but you have no way to even have a check that says “fail to build the program if this function isn’t vectorized”. This is important if you’re relying on that property and someone accidentally adds a data dependency and breaks the optimization without you realizing. Portable and explicit SIMD don’t have this problem by definition.

1h agoHN ↗

Sure, in the same way that there is no such thing as portable code at all. The result will be suboptimal, but it will still be better than not having it.

1h agoHN ↗

I am using my own lib, `lin_alg`, which apes core_simd for floating point values, and extends the concept to vectors and quaternions. I will eventually replace the floating point portions with core::simd upon its arrival in stable Rust.

Downside: It's currently x86 only.

1h agoHN ↗

Can we start using stainless steel instead?

1h agoHN ↗

I am hoping for portable SIMD so much. But I still think that often a manually rolled SIMD will be faster.

Also the state of SIMD in Cranelift is also very WIP. They pretty much just support a subset of 128bit vectors with some rare exceptions.