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

Implement correct handling of new constraint in ilc #82818

Merged
merged 6 commits into from
Mar 8, 2023

Conversation

vitek-karas
Copy link
Member

This is done by treating the new constraint as a data flow annotation PublicParameterlessConstructor (which are supposed to be identical). The rest falls out from this change since all of the validation and marking will automatically kick in.

This change causes more methods to go through data flow (since that's what will actually perform the constraint validation/marking). I tested this on the ASP.NET API AOT template. Before this change it ran ~620 methods through data flow. With this change that number goes up to ~2100. The problem is tracked by #82603.

I measured compiler perf but didn't see any noticeable changes. That said, the compiler perf is extremely noisy on my local machine (variations of almost 10%), so it's hard to say for sure what the perf impact is. Current thinking is that ~2100 is still not that much and most of those methods are pretty small and thus cheap to run data flow on.

Fixes #81720 - note that the repro still fails on AOT with this fix, but the failure is different (System.InvalidOperationException: Sequence contains no matching element). I verified that the missing .ctor is present in the app with the fix.

This is done by treating it as a data flow annotation PublicParameterlessConstructor (which are supposed to be identical). The rest falls out from this change since all of the validation and marking will automatically kick in.
Also fixes the rest of the Generic tests which were brought along with the test unification with ILLink. Disabled some of the tests which need more investigation.
Adds a comment about potential optimizations to reduce number of data flow processing done.
@vitek-karas vitek-karas added this to the 8.0.0 milestone Mar 1, 2023
@vitek-karas vitek-karas self-assigned this Mar 1, 2023
@vitek-karas vitek-karas requested a review from marek-safar as a code owner March 1, 2023 08:34
@ghost
Copy link

ghost commented Mar 1, 2023

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

Issue Details

This is done by treating the new constraint as a data flow annotation PublicParameterlessConstructor (which are supposed to be identical). The rest falls out from this change since all of the validation and marking will automatically kick in.

This change causes more methods to go through data flow (since that's what will actually perform the constraint validation/marking). I tested this on the ASP.NET API AOT template. Before this change it ran ~620 methods through data flow. With this change that number goes up to ~2100. The problem is tracked by #82603.

I measured compiler perf but didn't see any noticeable changes. That said, the compiler perf is extremely noisy on my local machine (variations of almost 10%), so it's hard to say for sure what the perf impact is. Current thinking is that ~2100 is still not that much and most of those methods are pretty small and thus cheap to run data flow on.

Fixes #81720 - note that the repro still fails on AOT with this fix, but the failure is different (System.InvalidOperationException: Sequence contains no matching element). I verified that the missing .ctor is present in the app with the fix.

Author: vitek-karas
Assignees: vitek-karas
Labels:

area-NativeAOT-coreclr

Milestone: 8.0.0

@MichalStrehovsky
Copy link
Member

That said, the compiler perf is extremely noisy on my local machine (variations of almost 10%), so it's hard to say for sure what the perf impact is

Could you try to apply #81205 and use the ILC from ilc-published directory to do the measurement? I saw similar amounts of noise when doing perf measurements in the past. I don't know how to measure perf on top of the JIT-based CoreCLR anymore. The results with NativeAOT were a lot more stable, plus it is what we intend to ship anyway.

@vitek-karas
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

The details are in the comments in the code, in short:
If there's a array with itself as an array element the dataflow would stack overflow.
@vitek-karas vitek-karas requested a review from sbomer as a code owner March 2, 2023 23:35
@vitek-karas
Copy link
Member Author

@sbomer could you please take a quick look at the last commit which fixes a bug in array value dataflow - also in illink and analyzer.

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I only looked at the last commit). Thanks!

@vitek-karas
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@vitek-karas
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vitek-karas vitek-karas merged commit fbb3a12 into dotnet:main Mar 8, 2023
@vitek-karas vitek-karas deleted the NewConstraint branch March 8, 2023 13:11
@ghost ghost locked as resolved and limited conversation to collaborators Apr 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default constructor trimmed for generic argument
3 participants