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

LSRA: Heuristics for callee saved reg allocation. #6824

Closed
sivarv opened this issue Oct 17, 2016 · 2 comments
Closed

LSRA: Heuristics for callee saved reg allocation. #6824

sivarv opened this issue Oct 17, 2016 · 2 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI enhancement Product code improvement that does NOT require public API changes/additions optimization tenet-performance Performance related issue
Milestone

Comments

@sivarv
Copy link
Member

sivarv commented Oct 17, 2016

LSRA allocates callee saved register to the first var (preferenced to a callee saved reg) that is encountered in linear order. Later when a more deserving var is found needing a callee saved register LSRA won't take it back from a less deserving candidate.

Put another way, improve heuristic to decided when LSRA should not allocate at all to a var preferenced to a callee saved reg.

Specifically LSRA is conservative with fp vars.

Example benchmarks:
SciMark FFT
Huffman
MemoryPoolIterator:CopyFrom()

category:cq
theme:register-allocator
skill-level:expert
cost:medium

@sivarv sivarv self-assigned this Oct 17, 2016
@sivarv sivarv assigned russellhadley and unassigned sivarv Mar 9, 2017
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@CarolEidt CarolEidt modified the milestones: Future, 6.0.0 Oct 27, 2020
@JulieLeeMSFT JulieLeeMSFT added the needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration label Mar 23, 2021
@kunalspathak
Copy link
Member

We want to tune our overall heuristics based on the experiments we do as part of #43318. While we will do the experiments in .NET 6, it is highly unlikely that we would bake that in produce during .NET 6. Moving to future.

@kunalspathak kunalspathak modified the milestones: 6.0.0, Future Apr 9, 2021
@kunalspathak kunalspathak removed the needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration label Apr 9, 2021
@kunalspathak
Copy link
Member

Currently, we do track local vars whose refCntWtd meets the threshold.

if (refCntWtd >= thresholdFPRefCntWtd)
{
VarSetOps::AddElemD(compiler, fpCalleeSaveCandidateVars, varDsc->lvVarIndex);
}

Later, when LSRA allocates registers, we never go back and reset the assignment if any other variable deserves that register more.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI enhancement Product code improvement that does NOT require public API changes/additions optimization tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

6 participants