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
Add option to change SVE vector length for current and children processes #101295
Add option to change SVE vector length for current and children processes #101295
Changes from 4 commits
1393c30
2c040a7
19dce8d
22aa47e
43ece1e
9140d82
aca2809
1d14227
23dda80
c080aad
a0c5247
4c0ffa7
aaeb733
8b07210
c0a6910
528e157
63a2be8
ec0c317
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.
When
DOTNET_MaxVectorTBitWidth
is not specified, it is0
and in that case, we should use the full vector length, the system offers (as the comment says). In that case, we should setCPUCompileFlags.Clear(InstructionSet_VectorT256);
on 256-bit machine andCPUCompileFlags.Clear(InstructionSet_VectorT256);
andCPUCompileFlags.Clear(InstructionSet_VectorT512);
on a 512-bit 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.
We wouldn't want to
CPUCompileFlags.Clear
, as that's implicitRather instead we would
CPUCompileFlags.Set(InstructionSet_VectorT256);
if the reported SVE length is256-bits
andCPUCompileFlags.Set(InstructionSet_VectorT512);
if the reported SVE length is512-bits
.They should be off unless otherwise set, but we double check that via a cleanup check anyways (which should be moved to be shared with Arm64):
runtime/src/coreclr/vm/codeman.cpp
Lines 1564 to 1573 in 22aa47e
-- I think we also need a TODO here explaining that we're artificially restricting the size to 128-bits for the time being, as the support for larger vector sizes hasn't been plumbed through for Arm64 yet.
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, that's what I meant...if they are already enabled, then we should disable it or vice-versa.
Yes, I think that's what we should do and leave the change of setting
Vector256
, etc. for later PR, when we address some of the things in #101477 , specificallygetVectorTByteLength()
.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'd expect this to fail for MSVC, which doesn't allow inline assembly?
Can we just call
svcntb()
on Windows instead, or is there potentially an official OS API for this?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 wasn't sure this was available for MSVC yet. If so, then great, that's easier.
Is there a min version of MSVC needed to build coreclr?
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.
Hmmm, it might not be available yet, at least its not available in the MSVC version CI is using. -- @kunalspathak might know better when that support is expected to land.
I expect we need some ifdef here regardless since
__asm
is explicitly unsupported on MSVC for anything but 32-bit x86 and for the general function to be configured to assert if called from Windows, as a safety measure. -- This function directly executing an SVE instruction unguarded is a bit dangerous and there isn't really a way to assert that it's being done safely. It's only safe in the current use-case since its only called if the relevant support was queried from the OS.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, I checked around and they haven't added that support yet, so it will not be anytime sooner
They do not and the guidance was to use whatever is exposed by the compiler, so we won't have it at least for new few months.
So, I think in short-term, let us do it in
asm
guarded with if CPU-capability supports SVE.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 consideration is the msvc compiler does not support asm
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 noting that we won't be able to actually ship in November in such a state. We will require some form of actual query of the hardware size from the OS to avoid any issues if its run on hardware that has larger length.
It might be overall simpler to just get such a fallback setup now so we don't need to worry about it, risk forgetting it about it, or anything along those lines.
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.
Agreed, but AIUI, for windows today:
I'm not aware of any other method.
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 think the solution is what @jkotas mentioned of emitting hex code or just write the assembly
cntb
in the.asm
and.S
file - https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/arm64/asmhelpers.asm.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.
It looks like MASM v14.4 supports things and we can just define a function that does:
Earlier versions may also support the functionality, but I don't have such earlier versions installed at the moment.
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.
Updated the PR to test how the ci handles use of
rdvl
.