Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Mono] [Arm64] Added SIMD support for vector 2/3/4 methods #98761
[Mono] [Arm64] Added SIMD support for vector 2/3/4 methods #98761
Changes from 6 commits
a5f8a38
8a3cee4
87d97d9
5b1fa3d
70c4d7e
f205632
874448c
4e3f2b8
646724e
2b8a85c
4a005d2
f8f1557
5bbe5c4
1ebb378
b30e41f
a134bae
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Worth noting that Arm has typically pushed us away from using
FADDV
as it does not perform well on some hardware.Rather instead they had us use a sequence of
FADDP
(AddPairwise
) instructions which tend to have better perf/throughput: https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/gentree.cpp#L25190-L25210There 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.
Thanks for sharing the information, @tannergooding. @jkurdek Feel free to create an issue to address it in a future PR.
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.
#99749
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.
Quaternion.Lerp is not marked as intrinsic in the libraries:
runtime/src/libraries/System.Private.CoreLib/src/System/Numerics/Quaternion.cs
Lines 493 to 498 in db7d269
However, if this implementation generates better codegen we should probably keep it.
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.
The intrinsified version is around 40% faster on my machine
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.
Why is the intrinsified version faster here? Is it fundamentally doing something differently from the managed implementation or is there potentially a missing JIT optimization?
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.
Or perhaps there is simply missing a change on the managed side and so its using scalar logic rather than any actual vectorization and a better fix is to update the managed impl?
We've typically tried to keep a clear separation between
intrinsic
functionality and more complex methods.APIs like
operator +
orSqrt
are generally mapped to exactly 1 hardware instruction and this is the case for most platforms.APIs like
DotProduct
or evenCreate
may be mapped to exactly 1 hardware instruction on some platforms and are fairly "core" to the general throughput considerations of many platforms.APIs like
Quaternion.Lerp
orCopyTo
are more complex functions which use multiple instructions on all platforms and which may even require branching or masking logic. So, we've typically tried to keep them in managed and have them use the intrinsic APIs instead.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.
I agree that we should align Mono's behavior with CoreCLR, not intrinsifying
Quaternion.Lerp
orCopyTo
for mono either.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.
In general, Mono's mini JIT doesn't have as comprehensive optimizations as CoreCLR's RyuJIT.