Skip to content

arm64: Select REG_ORDER candidates with ordered masks - #136836

Open
jonathandavies-arm wants to merge 2 commits into
dotnet:mainfrom
jonathandavies-arm:upstream/opt/arm64-register-order-masks
Open

jonathandavies-arm wants to merge 2 commits into
dotnet:mainfrom
jonathandavies-arm:upstream/opt/arm64-register-order-masks

Conversation

@jonathandavies-arm

Copy link
Copy Markdown
Contributor

Use register-mask groups in ARM64 register allocation to preserve the existing register preference order without scanning every candidate's rank. Keep the original scan on other targets and cross-check choices in Checked builds.

Against main (b4548da), Release JITs executed 3,999,913,819,224 instructions versus 4,017,017,735,574 on main across seven published Linux ARM64 SuperPMI collections, a 0.426% reduction. SuperPMI asm diffs found no generated code differences among replayed contexts.

- Related to dotnet#136694

Use register-mask groups in ARM64 register allocation to preserve the
existing register preference order without scanning every candidate's
rank. Keep the original scan on other targets and cross-check choices
in Checked builds.

Against main (b4548da), Release JITs executed 3,999,913,819,224
instructions versus 4,017,017,735,574 on main across seven published
Linux ARM64 SuperPMI collections, a 0.426% reduction. SuperPMI asm diffs
found no generated code differences among replayed contexts.
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 2, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 2, 2026
@azure-pipelines

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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the ARM64 register-selection optimization.

No open issues 🎉

What changed in this PR

This PR reduces ARM64 JIT register-selection work as part of #136694, using ordered register-mask groups to preserve existing register preferences.

Changes:

  • Replaces ARM64’s per-candidate rank scan with mask-based selection.
  • Retains the rank scan on other targets and cross-checks ARM64 choices in Checked builds.
  • Reports a 0.426% instruction-count reduction across seven Linux ARM64 SuperPMI collections, with no generated-code differences in replayed contexts.
File Description
src/​coreclr/​jit/​lsra.cpp Adds ARM64 ordered-mask selection to try_REG_ORDER, retaining the fallback scan and Checked-build validation.

Review effort: Balanced

Comment thread src/coreclr/jit/lsra.cpp Outdated
Comment on lines +12989 to +12990
// These groups preserve REG_VAR_ORDER and REG_VAR_ORDER_FLT. Select from
// the first nonempty group instead of visiting every candidate's rank.

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.

nit: The float/int tier groupings are hard-coded as raw masks. Please name the source tables in the comment (REG_VAR_ORDER / REG_VAR_ORDER_FLT in targetarm64.h) so anyone editing them knows to update this code. The DEBUG assert will catch a mismatch, but a pointer makes it easier to find.

Change-Id: I36210c8a65045a2fa426619325133ce91a7b31e6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI 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.

3 participants