-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix Vector256.IsHardwareAccelerated in R2R binaries #65351
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
should
Vector<T>
be normalized on the same handling?Should there be a comment covering that:
__m128
and__m256
, respectivelyVector128/256.IsHardwareAccelerated
property only returnstrue
under Sse2/Avx2 (this is when users can depend on most functions exposed to be SIMD accelerated)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.
Abi handling is actually separate from this entirely and is handled by an abi stability protection construct which works independently of all of this. (Mostly as the ABI for both Vector128 and Vector256 doesn't match the native vector ABI on Windows, and there was a desire at one point to unify on the actual official ABI. This has not yet happened.
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.
So is this check only for
IsHardwareAccelerated
then?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.
Just trying to understand what these particular checks line up with.
We support efficiently passing and some acceleration for
Vector128<T>
underSSE
andVector256<T>
underAVX
.However,
IsHardwareAccelerated
will only returntrue
underSSE2
andAVX2
, respectively.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.
This lines up with the Vector128/Vector256 api usage in the JIT. Effectively, when the jit determines that it cannot use a VectorXXX api it will call up, and notify crossgen that It has determined that if VectorXXX is useable at runtime via any intrinsics the generated code cannot be used. At that stage crossgen needs to encode that one of the instruction sets is not permitted, as it cannot encode that the VectorXXX intrinsics are not available. So, what it does it encode that the minimum required instruction set for the VectorXXX intrinsics is not available. Handling of IsHardwareAccelerated is actually a side-effect of this. In the encoding there are actually more states for how this works than is pleasant to contemplate. For instance, the options available to crossgen for encoding a method which calls
Vector256<T>.IsHardwareAccelerated
are:The problem that this bug solves is that while the previous logic correctly handled cases 2 and 3, it did not handle case 1. (What would happen is that the JIT would notify crossgen that Vector256 could not be used, and be we would fail to record that there was an instruction set restriction on the generated code.)