Skip to content
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

Parametrize NumOps by element type instead of SIMD type #631

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Mar 20, 2025

Make the generic argument to NumOps independent of the SIMD ISA. For example <Avx2Isa as Isa>::f32 now returns an impl NumOps<f32> instead of impl NumOps<float32x4_t>. This in turn will make it possible to add generic methods to get the NumOps impl for a given element type, enabling writing SimdOps that are generic over the element type.

The downside is that a single struct can no longer implement NumOps for two different SIMD vectors with the same element type. This would prevent eg. Avx2Isa from implementing NumOps for both 256 and 128-bit f32 vectors. So far the need to half or quarter-width vectors has been avoided by defining operations in a way that avoids this.

@robertknight robertknight marked this pull request as draft March 20, 2025 20:24
@robertknight robertknight marked this pull request as ready for review March 21, 2025 07:10
Make the the generic argument to `NumOps` independent of the SIMD ISA. For
example `<Avx2Isa as Isa>::f32` now returns an `impl NumOps<f32>` instead of
`impl NumOps<float32x4_t`. This in turn will make it possible to add generic
methods to get the `NumOps` impl for a given element type, enabling writing
`SimdOp`s that are generic over the element type.
@robertknight robertknight merged commit 4f088e6 into main Mar 21, 2025
2 checks passed
@robertknight robertknight deleted the numops-lane-type branch March 21, 2025 08:00
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