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

Poor loop optimization in BilinearInterpol benchmark #31831

Open
CarolEidt opened this issue Feb 6, 2020 · 1 comment
Open

Poor loop optimization in BilinearInterpol benchmark #31831

CarolEidt opened this issue Feb 6, 2020 · 1 comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI optimization tenet-performance Performance related issue
Milestone

Comments

@CarolEidt
Copy link
Contributor

CarolEidt commented Feb 6, 2020

The Vector<T> version of this benchmark (BilinearInterpol_Vector) has a number of weaknesses:

First, although the temporary array doubleTemp is allocated with a constant length:

STMT00015 (IL 0x0AD...  ???)
               [000113] -ACXG-------              *  ASG       ref   
               [000112] D------N----              +--*  LCL_VAR   ref    V24 loc15        
               [000111] --CXG-------              \--*  CALL help ref    HELPER.CORINFO_HELP_NEWARR_1_VC
               [000110] ------------ arg0            +--*  CNS_INT(h) long   0x7ffafe875b00 class
               [000109] ------------ arg1            \--*  CNS_INT   long   4 vector element count

The loop cloning code is unable to determine V24.length:

Considering condition 0: (4 LE V24.Length), could not be evaluated

So it decides to clone the loop, AFAICT so that it can eliminate the range check on doubleTemp, but then it eliminates it from both clones so we have identical loops. Furthermore, although the exact loop count is available, none of the 4 original loops, nor their identical clones, are unrolled.

category:cq
theme:loop-opt
skill-level:expert
cost:large

@CarolEidt CarolEidt added tenet-performance Performance related issue area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Feb 6, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Feb 6, 2020
@BruceForstall BruceForstall added optimization and removed untriaged New issue has not been triaged by the area owner labels Feb 6, 2020
@AndyAyersMS
Copy link
Member

@CarolEidt we have other cases where cloning ends up being unnecessary as we're able to prove in bounds access without it.

I'm going to mark this as future, let me know if you think otherwise.

@AndyAyersMS AndyAyersMS added this to the Future milestone May 6, 2020
@BruceForstall BruceForstall added the JitUntriaged CLR JIT issues needing additional triage label Oct 28, 2020
@BruceForstall BruceForstall removed the JitUntriaged CLR JIT issues needing additional triage label Jan 15, 2021
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 optimization tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

4 participants