Skip to content

Introduce semantic conversion traits #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

Ralith
Copy link
Contributor

@Ralith Ralith commented Jul 10, 2025

This proposes a generic API for conversions between vectors of the same element size and count, usable on generic native-width vectors. If I get positive feedback I'll fill out some more cases before merging.

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch 3 times, most recently from 1b0786f to 28aba20 Compare July 10, 2025 01:38
@Ralith
Copy link
Contributor Author

Ralith commented Jul 10, 2025

Open question: Should this supplant Simd::cvt_*? If not, it could probably be blanket-implemented based on those methods rather than separately implemented for each backend as in this PR. I do feel like the naming of those methods is a bit confusing.

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from 28aba20 to cbafbac Compare July 10, 2025 03:15
@ajakubowicz-canva
Copy link
Collaborator

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch 3 times, most recently from 3a57607 to 5b83500 Compare July 10, 2025 03:59
@Ralith Ralith changed the title Introduced SimdCast Introduce semantic conversion traits Jul 10, 2025
@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from 5b83500 to 80b5c5c Compare July 10, 2025 04:00
@Ralith
Copy link
Contributor Author

Ralith commented Jul 10, 2025

Second draft:

  • Multiple, semantically meaningful traits instead of a single overloaded "cast"
  • Helper methods on SimdFloat and SimdInt

I don't like the trait or primitive method names much at all; please bikeshed. Especially "float" as a verb feels bad.

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch 5 times, most recently from 788569b to 39df826 Compare July 10, 2025 19:53
@Ralith Ralith marked this pull request as ready for review July 10, 2025 19:53
@Ralith
Copy link
Contributor Author

Ralith commented Jul 10, 2025

Tweaked naming, factored out common generation logic, and expanded to a superset of existing conversion operations. I think this is ready now, though still happy to brainstorm on better names.

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from 39df826 to f9f9141 Compare July 10, 2025 19:56
@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch 6 times, most recently from 1f94ffd to 7a9bd6d Compare July 10, 2025 22:27
@Ralith
Copy link
Contributor Author

Ralith commented Jul 10, 2025

Reworked to allow conversions for e.g. f32x4<S> rather than just S::f32s, by building on top of, rather then replacing, the Simd methods.

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch 2 times, most recently from d26ca59 to eed1d41 Compare July 13, 2025 00:23
@ajakubowicz-canva
Copy link
Collaborator

ajakubowicz-canva commented Jul 18, 2025

Sorry for the lack of communication – I plan to discuss this PR and proposal at the next Renderer office hours. Thank you for your excellent work!

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from eed1d41 to b1b3115 Compare July 18, 2025 05:36
Copy link
Collaborator

@ajakubowicz-canva ajakubowicz-canva left a comment

Choose a reason for hiding this comment

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

Raised this PR at the Linebender Renderer Office Hours and we have consensus to move forward with names as currently written. I love the direction of this PR. We discussed not worrying too much about bike-shedding as fearless_simd is still very early and we can always make a breaking change in these early days if we find something doesn't work well for us.

One minor complexity is that I think you need to rebase this PR and make sure that the code generator output is updated to reflect the latest main branch.

Thank you thank you!

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from b1b3115 to 6d2898b Compare July 24, 2025 19:47
@Ralith
Copy link
Contributor Author

Ralith commented Jul 24, 2025

Rebased and regenerated.

@Ralith
Copy link
Contributor Author

Ralith commented Jul 24, 2025

Whoops, needs some tweaks to handle i64.

@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from 6d2898b to 27b6088 Compare July 24, 2025 19:58
@Ralith Ralith force-pushed the push-wxrnnqzyxynn branch from 27b6088 to cc4e07d Compare July 24, 2025 19:58
@Ralith
Copy link
Contributor Author

Ralith commented Jul 24, 2025

We don't actually have u/i64xN yet, so I've just masked those cases off for now.

@LaurenzV LaurenzV added this pull request to the merge queue Jul 24, 2025
@LaurenzV
Copy link
Collaborator

Thanks!

Merged via the queue into linebender:main with commit b2fbd3d Jul 24, 2025
11 checks passed
@Ralith Ralith deleted the push-wxrnnqzyxynn branch July 24, 2025 21:08
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.

3 participants