Skip to content
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

Ensure Arm64 method local constants don't live next to the code #71155

Open
tannergooding opened this issue Jun 22, 2022 · 2 comments
Open

Ensure Arm64 method local constants don't live next to the code #71155

tannergooding opened this issue Jun 22, 2022 · 2 comments
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@tannergooding
Copy link
Member

tannergooding commented Jun 22, 2022

As per #71044 (comment), we currently have "method local constants" emitted as part of the method body block on Arm64. This is unlike x64 where we allocate a distinct area separate from the method.

We do this to ensure that these constants can be cheaply accessed via ldr. However, much like on x86/x64, placing "data" in the same page as your "code" can be problematic as it can negatively impact the instruction decoder, instruction cache, lead to poor speculative execution, etc.

We should look at a better approach to handling this to ensure that this data can be placed in a distinct page from the code. One recommendation was to create an "anchor" to the data section and then offset from that anchor to access the constants. It can be assumed that re-materializing the constant is "cheap" to avoid spilling.

category:implementation
theme:memory-usage

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 22, 2022
@tannergooding tannergooding added arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Jun 22, 2022
@ghost
Copy link

ghost commented Jun 22, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

As per #71044 (comment), we currently have "method local constants" emitted as part of the method body block on Arm64. This is unlike x64 where we allocate a distinct area separate from the method.

We do this to ensure that these constants can be cheaply accessed via ldr. However, much like on x86/x64, placing "data" in the same page as your "code" can be problematic as it can negatively impact the instruction decoder, instruction cache, lead to poor speculative execution, etc.

We should look at a better approach to handling this to ensure that this data can be placed in a distinct page from the code. One recommendation was to create an "anchor" to the data section and then offset from that anchor to access the constants. It can be assumed that re-materializing the constant is "cheap" to avoid spilling.

Author: tannergooding
Assignees: -
Labels:

arch-arm64, area-CodeGen-coreclr, untriaged

Milestone: -

@BruceForstall BruceForstall added this to the 8.0.0 milestone Jun 22, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 22, 2022
@BruceForstall BruceForstall removed the untriaged New issue has not been triaged by the area owner label Jun 22, 2022
@TIHan TIHan self-assigned this Mar 17, 2023
@TIHan TIHan modified the milestones: 8.0.0, Future Mar 27, 2023
@kunalspathak kunalspathak assigned kunalspathak and unassigned TIHan Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

No branches or pull requests

4 participants