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

RyuJIT: Implement induction variable analysis #93143

Closed
BruceForstall opened this issue Oct 6, 2023 · 5 comments
Closed

RyuJIT: Implement induction variable analysis #93143

BruceForstall opened this issue Oct 6, 2023 · 5 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@BruceForstall
Copy link
Member

BruceForstall commented Oct 6, 2023

This analysis would be used for IV widening (#7312) as well as to help implement better arm64 post-increment addressing modes.

Strength reduction: Re-express "secondary" IVs involving multiplication into addition. Pre-requisite for general post-increment. May be an alternative to IV widening if secondary IVs appear as addresses.

@BruceForstall BruceForstall added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 6, 2023
@BruceForstall BruceForstall added this to the 9.0.0 milestone Oct 6, 2023
@ghost
Copy link

ghost commented Oct 6, 2023

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

Issue Details

This analysis would be used for IV widening (#7312) as well as to help implement better arm64 post-increment addressing modes.

Author: BruceForstall
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: 9.0.0

@Sergio0694
Copy link
Contributor

Will this allow the JIT to automatically achieve the same codegen for loops over eg. spans or arrays, that you can do today if you manually write them as a while (Unsafe.IsAddressLessThan(...)) and then increment a moving ref, rather than indexing every single iteration? Eg. we adopted this pattern everywhere in ImageSharp and while it did give us a noticeable ~10% perf boost overall (which admittedly is fairly big), but the code ended up being basically unreadable and very error prone and quite not safe 😅

@BruceForstall
Copy link
Member Author

Will this allow the JIT to automatically achieve the same codegen for loops over eg. spans or arrays...

I hope the answer is "yes", either via this or other improvements to the JIT.

we adopted this pattern everywhere in ImageSharp

Hmmm... that's unfortunate. Maybe you could open an issue with this example (before, and after, and why the Unsafe version is faster), if you haven't already?

@jakobbotsch
Copy link
Member

#97865 adds an initial framework for IV analysis, but let's keep this issue open for strength reduction which I expect to work on in March.

@jakobbotsch jakobbotsch self-assigned this Feb 28, 2024
@jakobbotsch
Copy link
Member

I split out strength reduction into #100913. I'm going to consider this one fixed by #97865.

@github-actions github-actions bot locked and limited conversation to collaborators May 12, 2024
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
Projects
None yet
Development

No branches or pull requests

3 participants