-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[SIMD] Use fixed width native types for better Java interoperability #138429
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
[SIMD] Use fixed width native types for better Java interoperability #138429
Conversation
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
ChrisHegarty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, yes, yes. Thank you.
|
I assume that we'll bump the native lib version in this PR too. |
I'm torn; yes, I think it's worth it. At least, it will help us testing it going through CI. |
|
|
|
OK, I have re-introduced the fixed 32-bit float type, but this time it's our own type defined in the best possible way:
|
|
I've tested this with a variety of compilers: clang19, clang17, gcc12 and gcc13 (supporting the 23 standards and not), and it seems to work well. We use clang18/17 atm, and that is well covered. |
|
@ChrisHegarty let me know if still LGTM - I have addressed the float situation and bumped versions. |
ChrisHegarty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SLGTM
…-json * upstream/main: (247 commits) Mute org.elasticsearch.xpack.inference.integration.SemanticTextIndexOptionsIT testValidateIndexOptionsWithBasicLicense elastic#138513 Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackLookupJoinIT testLookupExplosionBigString elastic#138510 This shouldn't be zero (elastic#138501) sum of empty histogram is now null (elastic#138378) Test ES|QL bfloat16 support (elastic#138499) Fix exception handling in S3 `compareAndExchangeRegister` (elastic#138488) Mute org.elasticsearch.xpack.exponentialhistogram.ExponentialHistogramFieldMapperTests testFormattedDocValues elastic#138504 Mute org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT test {yaml=ingest_geoip/60_ip_location_databases/Test adding, getting, and removing ip location databases} elastic#138502 ESQL: Refactor HeapAttackIT (elastic#138432) [Inference API] Add ElasticInferenceServiceDenseTextEmbeddingsServiceSettings to InferenceNamedWriteablesProvider (elastic#138484) Store split indices (elastic#138396) ES|QL Update CHUNK to support chunking_settings as optional argument (elastic#138123) Extract common blob-update logic in `S3HttpHandler` (elastic#138490) Cleanup esql request building api (elastic#138398) Round sum and avg in exponential_histogram CSV tests (elastic#138472) ESQL: load exponential_histogram total count as double instead of long (elastic#138417) [SIMD] Use fixed width native types for better Java interoperability (elastic#138429) Do not use Min or Max as Top's surrogate when there is an outputField (elastic#138380) ES|QL: Fix generative tests (elastic#138478) Mute org.elasticsearch.xpack.inference.integration.AuthorizationTaskExecutorIT testCreatesEisChatCompletion_DoesNotRemoveEndpointWhenNoLongerAuthorized elastic#138480 ...
The C and C++ standards do not prescribe a fixed size for integral and floating-point primitive data types (e.g.
intorfloat); those depends on the platform (compiler + OS + architecture).Java, on the other end, has a fixed and precise width for each primitive type. Getting those to match is important for interoperability between Java and the native libraries via FFI.
The newest C/C++ standards define new types with explicit width, e.g. int8_t or float32_t; this PR updates the function definitions of the simdvec native library to use these types.