Skip to content

Scalar replacement of aggregates #6494

Closed

Description

@DemiMarie

This is a feature request for scalar replacement of aggregates in RyuJIT. RyuJIT currently does not optimize value types very well, and this will hopefully fix this.

category:cq
theme:promotion
skill-level:expert
cost:extra-large

Activity

  1. pgavlin commented on Aug 15, 2016

    @pgavlin
    Contributor

    cc @CarolEidt @dotnet/jit-contrib

    RyuJIT does perform some limited SROA, but the terminology is different: RyuJIT refers to this optimization as "struct promotion".

  2. DemiMarie commented on Aug 18, 2016

    @DemiMarie
    Author

    I was thinking of full SROA, at least where that would be beneficial.

    On Aug 15, 2016 3:16 PM, "Pat Gavlin" notifications@github.com wrote:

    cc @CarolEidt https://github.com/CarolEidt @dotnet/jit-contrib
    https://github.com/orgs/dotnet/teams/jit-contrib

    RyuJIT does perform some limited SROA, but the terminology is different:
    RyuJIT refers to this optimization as "struct promotion".

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    https://github.com/dotnet/coreclr/issues/6733#issuecomment-239899991,
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AGGWB9F_-IU1o_sR79fUNltb12eugJBtks5qgLsRgaJpZM4JjumT
    .

  3. CarolEidt commented on Aug 18, 2016

    @CarolEidt
    Contributor

    @DemiMarie - as @pgavlin mentions, this is called "struct promotion" in RyuJIT, and it is limited in what it will do. Some of the fundamental constraints are:

    • The struct must not be address-taken (and it is currently somewhat conservative about what it considers to be address-taking, which could be improved).
    • It must have no overlapping fields.

    Some of the heuristic or implementation-limited constraints are:

    • It must have only primitive fields.
    • It must not be an argument or a return value that is passed in registers.
    • It can't be larger than 32 bytes.
    • It can't have more than 4 fields.

    We expect to make improvements in this area relatively soon, but if there are specific scenarios you're interested (especially if you have some code, ideally in the form of a benchmark, that demonstrates it) we'd love to hear about it.

    If you're interested in the work that I'm currently doing to improve code generation for structs (aka value types), see https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/first-class-structs.md

  4. changed the title [-]Scalar replacement of aggrigates[/-] [+]Scalar replacement of aggregates[/+] on Aug 22, 2016
  5. BruceForstall commented on Sep 20, 2019

    @BruceForstall
    Contributor

    Given that we already have struct promotion, and various documents and issues discussing improvements, I'm going to close this.

  6. transferred this issue fromdotnet/coreclron Jan 31, 2020
  7. added this to the Future milestone on Jan 31, 2020
  8. ghost locked as resolved and limited conversation to collaborators on Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions