-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add missing Builtin vector functions to SIMD with FloatingPoint #78744
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
base: main
Are you sure you want to change the base?
Conversation
@kntkymt This particular error which you are facing is actually expected: if we try to differentiate a function defined in a different file, this function should either be explicitly marked as As for issues related to So, I see 2 ways here.
|
@kovdan01 Thanks for detailed explanation 🙇
understood.
let me go with 1. I will add derivatives implementations in |
let me convert this PR into draft until I address AutoDiff issue as we mentioned above, thanks! |
Motivation
SIMDn where Scalar is
FloatingPoint
don't have concrete builtin vector operations thatFixedWidthInteger
have. that means currentlySIMDn<Float>
/SIMDn<Double>
just expand operations into for loop.Since one of the objectives of SIMD is providing api for vector programing (mentioned in SE-0229 SIMD), It would be better to provide concrete builtin vector operations for FloatingPoint as well.
(note that: auto-vectorization by LLVM backend may convert loop into vector instruction but not guaranteed.)
In this PR, I added builtin vector operations (+,-, *, /) to SIMDn where Scalar is FloatingPoint.
Asm outputs
I can see
fadd.4s
(which is a vector instruction for float on arm64) in asm outputfull output
benchmarks
-Onone: builtin operations are around 10x faster than current implementation
-O: almost same (or builtin operations are bit faster) at this sample
Error on AutoDiff (need help 🙏 )
by this PR, test/AutoDiff/stdlib/simd.swift will fail due to issue that derivative does not yet support alwaysEmitIntoClient. I have no idea for fixing this issue 😓 . How can I move forward?
error log
[edited] I disabled these test at this moment.