ChrisHegarty commented on PR #12703:
URL: https://github.com/apache/lucene/pull/12703#issuecomment-1773365569
Well... as simple wrapping of float[] into MemorySegment is not going to
work out, the Vector API does not like it due to alignment constraints (which
seems overly pedantic since it can operate fine when accessing a float[]
directly! )
```
FloatVector fromMemorySegment(...)
throws IllegalArgumentException - if the memory segment is a heap segment
that is not backed by a byte[] array.
```
This approach would of course work fine for the binary computations, since
they are byte[] backed.
The current approach has three variants:
1. `dotProduct(float[] a, float[] b)`
2. `dotProduct(float[] a, RandomAccessVectorValues<float[]> b, int bOffset)`
3. `dotProduct(RandomAccessVectorValues<float[]> a, int aOffset,
RandomAccessVectorValues<float[]> b, int bOffset)`
.. no.1 is used as a fallback when we span segments.
I suspect that no.1 and no.2 are not as perf sensitive as no.3? In fact, we
could try to trace the float[] back to where it originates, maybe read and
store it as bytes but access it as a float.
Maybe there are other ways to invert things? I'll need to sleep on it!!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]