-
Notifications
You must be signed in to change notification settings - Fork 82
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
API to specify max number of elements #373
Comments
I think something like this would be nice, but difficult to implement. The difficult part is accounting for detected target features. My |
other things that make this harder is that on some architectures you can't get the maximum length at compile time, e.g. on RISC-V V, the maximum length is decided by the cpu manufacturer and may be all the way up to 16384 but can be much shorter. Some architectures you can't get a reasonable maximum length, e.g. SVP64 on PowerISA has a maximum length of 64, but you can only have 3 |
That's another good point--you could conceivably have two versions of such a function, one that's const and one that isn't. In |
Thanks for the responses, I hadn't even considered non-mainstream architectures yet! Your One potential annoyance one could have with the Which is why I thought an associated method on the To implement this functionality within |
It would be difficult to make it an associated function because the return type needs to have the number of elements in it, and that number of elements is contextual, at least on the statically enabled features but also potentially from the |
Thanks all for the great project, I can't wait until this is made stable!
To help with the portability I thought it would be useful to have some way of asking for a SIMD struct with the maximum number of elements supported by the target, such that you could write something like:
And that would give you
Simd<f32, 16>
for a target which supports 512 bits butSimd<f32, 4>
on targets which only support 128 bits.I thought this would be a fairly easy addition so I tried a couple of different implementations (including the one above) but each on so far has had problems. I'm very keen to contribute to the project and would happily write this up but wanted to check a couple of things:
The text was updated successfully, but these errors were encountered: