linebender / linebender/fearless_simd

vectorize() + #[inline(always)] is error-prone and hard to teach

Open
#338 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
457
Forks
30
Avg merge
1d 10h
Merged PRs (30d)
25

Description

After seeing an HPC expert who literally wrote a book on HPC and SIMD struggle with it (and entirely failing to get it to work when combined with criterion benchmarks), I'm convinced that we need to provide a more robust and convenient way to handle this.

Ideally I want to have some sort of annotation that you just put on every function generic over `Simd` and do not think about inlining at all, ever. The compiler just does the right thing automatically.

I see multiversion's `#[multiversion(targets=simd)]` ([PR adding it](https://github.com/calebzulawski/multiversion/pull/52)) and [thermite](https://github.com/raygon-renderer/thermite)'s `#[thermite::dispatch(V)]` as prior art that does this well.

AFAIK (I haven't re-checked yet) `multiversion` has an indirect dispatch through a cached atomic pointer on every function call, but doesn't require functions to be generic over `Simd`. I haven't looked into how `thermite` works yet.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked multiversion PR and the thermite dispatch approach, then compare their dispatch and inlining behavior with the current vectorize() and #[inline(always)] workflow. The issue does not name files or tests, and the desired annotation and completion criteria still need to be specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.