Skip to content

Allow the first argument of #[simd] functions to be f32x4<S> and such - #383

Merged
Shnatsel merged 2 commits into
linebender:mainfrom
Shnatsel:simd-macro-fancy
Sep 19, 2026
Merged

Shnatsel merged 2 commits into
linebender:mainfrom
Shnatsel:simd-macro-fancy

Conversation

@Shnatsel

@Shnatsel Shnatsel commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Allow the first argument in #[simd] functions to be anything simd-token-carrying, not just a literal _: Simd

Heavily based on the ideas @RunDevelopment outlined in #379

Closes #379

I want to get it in before v1.0 because this is a small semver-breaking change (method moved from one trait to another)

@RunDevelopment please take a look

@Dr-Emann

Copy link
Copy Markdown
Contributor

I know it would be quite the huge change, but the naming feels inconsistent throughout between Simd vs token vs witness. Is there a distinction I'm missing, or could we call them all the same thing? (Simd, ExtractSimd::simd)

@Shnatsel

Copy link
Copy Markdown
Contributor Author

I think Simd would have been SimdLevel if you didn't have to keep repeating it on every function.

I'm open to ExtractToken::token to make the naming more consistent.

@Dr-Emann

Copy link
Copy Markdown
Contributor

I think Simd would have been SimdLevel if you didn't have to keep repeating it on every function.

Or maybe SimdToken, based on this pr.

I still think vector.simd() better matches, especially with vector.simd already existing. vector.token() is less obvious to me (but better than vector.witness())

@Shnatsel

Copy link
Copy Markdown
Contributor Author

Renamed. Any concerns other than naming?

@Dr-Emann Dr-Emann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still say .simd() would be better

@Dr-Emann

Copy link
Copy Markdown
Contributor

Either way, definitely a breaking change to note for 1.0

@Shnatsel

Copy link
Copy Markdown
Contributor Author

This PR adds a mention to the changelog: https://github.com/linebender/fearless_simd/pull/383/changes#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed

@Shnatsel
Shnatsel requested a review from LaurenzV September 19, 2026 12:04
@Dr-Emann

Copy link
Copy Markdown
Contributor

Saw the added section, missed the changed section somehow, awesome!

@Shnatsel
Shnatsel added this pull request to the merge queue Sep 19, 2026
Merged via the queue into linebender:main with commit 00a878f Sep 19, 2026
23 checks passed
@Shnatsel
Shnatsel deleted the simd-macro-fancy branch September 19, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[simd] should work on functions without an explicit SIMD token parameter

3 participants