Skip to content

Arm64-SVE: Add scheme for scalable SVE state in the CONTEXT record - #133152

Merged
dhartglassMSFT merged 4 commits into
dotnet:mainfrom
snickolls-arm:sve-suspension
Oct 27, 2026
Merged

dhartglassMSFT merged 4 commits into
dotnet:mainfrom
snickolls-arm:sve-suspension

Conversation

@snickolls-arm

Copy link
Copy Markdown
Contributor

Replaces the fixed-length SVE state from the CONTEXT record with dynamically allocated space, similar to XSTATE, for saving and restoring vector/predicate register state, and the first-faulting register.

This reduces the size of the CONTEXT structure, as the SVE state is now optional. Subsystems that want to consume SVE state should set XSTATE_MASK_ARM64_SVE in CONTEXT::XStateFeaturesMask and allocate sufficient storage space for the trailer.

Replaces the fixed-length SVE state from the CONTEXT record with
dynamically allocated space, similar to XSTATE, for saving and restoring
vector/predicate register state, and the first-faulting register.

This reduces the size of the CONTEXT structure, as the SVE state is now
optional. Subsystems that want to consume SVE state should set
XSTATE_MASK_ARM64_SVE in CONTEXT::XStateFeaturesMask and allocate
sufficient storage space for the trailer.
@github-actions github-actions Bot added the area-PAL-coreclr only for closed issues label Sep 3, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 3, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@snickolls-arm

Copy link
Copy Markdown
Contributor Author

@dotnet/arm64-contrib

I originally planned this work thinking that it was necessary to ensure SVE vector state is preserved across suspension, though I have learned that it's not while writing this patch, as the OS suspension context will do that already.

IIUC x64 saves its vector state in CONTEXT records with XSTATE, so I have updated ARM64's CONTEXT to have a similar view of SVE vector state. If anyone would be able to help me understand where this state might be used, that could be useful for future work.

I have tried to keep this data structure as simple as possible so it's easy to port to XSTATE format later on.

@dhartglassMSFT

Copy link
Copy Markdown
Contributor

@janvorli would you be an appropriate person to take a look here? pal/CONTEXT changes

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor

cc: @dotnet/arm64-contrib

@SwapnilGaikwad

Copy link
Copy Markdown
Contributor

Hi @janvorli, could you take a look at this PR please?

Comment thread src/coreclr/pal/src/thread/context.cpp Resolved
Comment thread src/coreclr/pal/src/thread/context.cpp Resolved
* Add documentation on native_context SVE space guarantees
* Clear up bit tests in context2.S
@snickolls-arm

Copy link
Copy Markdown
Contributor Author

@janvorli I have pushed cd06534 to address your review comments, is there anything further I can add?

@SwapnilGaikwad SwapnilGaikwad mentioned this pull request Oct 26, 2026
27 tasks

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@dhartglassMSFT

Copy link
Copy Markdown
Contributor

Test failure is a timeout in System.Security.Cryptography.Xml.Tests.EncryptedXmlTests.DeepNonRootDecryptedXml_Throws likely the same issue as #136061

@dhartglassMSFT
dhartglassMSFT enabled auto-merge (squash) October 27, 2026 18:34
@dhartglassMSFT

Copy link
Copy Markdown
Contributor

/ba-g known test failure

@dhartglassMSFT
dhartglassMSFT merged commit fb3c4f9 into dotnet:main Oct 27, 2026
106 of 108 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-PAL-coreclr only for closed issues arm-sve Work related to arm64 SVE/SVE2 support community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants