Skip to content

Conversation

@valadaptive
Copy link
Contributor

Depends on #148.

This PR intertwines codegen and API changes, unfortunately. Some of the codegen cleanups depend on it.

All the inherent impl methods on individual SIMD types are now gone entirely. Most of them were previously already accessible via the core::ops traits, SimdBase/SimdInt/SimdFloat/SimdMask, or individual bespoke traits. The exceptions were split/combine. There was no inherent split method at all, and I've removed the inherent combine method. In its place I've added new SimdCombine and SimdSplit traits, which are implemented for types of the proper vector width.

Since all the operations need to be accessed via trait methods, I've added a prelude module to fearless_simd, which re-exports just the traits. This lets API consumers import every necessary trait to access all the methods, without being forced to either import every trait individually or just wildcard-import every single item from fearless_simd.

I'm not entirely happy with the current SimdCvtTruncate and SimdCvtFloat traits--it's unclear which is the source and which is the destination, to_int and to_float are technically implemented for all SimdFloat and SimdInt types even though they only work on 32-bit ones, and they require passing in the full vector equivalent (with S type parameter) as a type. Improving that is future work.

Aside from all that, this PR is about further centralizing the codegen in preparation for adding documentation generation. I want to make it as operation-centric as possible, moving op-specific special cases out of each module generation method and into the operation metadata itself.

We exposed an eclectic set of inherent methods on each SIMD type. Most
of them have now been subsumed by trait-based operations, so we should
get rid of them to avoid redundancy.
Since the intent is to move from inherent methods to trait methods, it's
important to provide a way to import all the traits so the methods are
in scope, without having to import them all separately or
wildcard-import the entire library.
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.

1 participant