Skip to content

LSRA: Heuristics for callee saved reg allocation.  #6824

Closed

Description

@sivarv

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

Activity

  1. self-assigned this
    on Oct 17, 2016
  2. transferred this issue fromdotnet/coreclron Jan 31, 2020
  3. added this to the Future milestone on Jan 31, 2020
  4. modified the milestones: Future, 6.0.0 on Oct 27, 2020
  5. added
    needs-further-triage
    on Mar 23, 2021
  6. kunalspathak commented on Apr 9, 2021

    @kunalspathak
    Contributor

    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.

  7. modified the milestones: 6.0.0, Future on Apr 9, 2021
  8. removed
    needs-further-triage
    on Apr 9, 2021
  9. kunalspathak commented on Dec 22, 2022

    @kunalspathak
    Contributor

    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.

  10. ghost locked as resolved and limited conversation to collaborators on Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrenhancementoptimizationtenet-performance

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions