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

Do not use RhGetCodeTarget in delegate equality #88611

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Jul 10, 2023

dotnet/corert@08d78ae

The original motivation for this was handling import stubs:

Function pointer equality comparison was not handling cross-module pointers correctly when optimizations were enabled
(causes target pointers to be wrapped in jump stubs sometimes). The delegate equality comparison was hitting this bug.

We do not have import stubs anymore and unwrapping unboxing stubs serves no purpose here.

Microbenchmarks of delegate equality show ~3x improvement with this change:

Bench_DelegateEquality_Positive_OpenStatic<10000000>() took: 355 ms
Bench_DelegateEquality_Positive_ClosedStatic<10000000>() took: 367 ms
Bench_DelegateEquality_Positive_ClosedInstance<10000000>() took: 371 ms

Bench_DelegateEquality_Positive_OpenStatic<10000000>() took: 121 ms
Bench_DelegateEquality_Positive_ClosedStatic<10000000>() took: 120 ms
Bench_DelegateEquality_Positive_ClosedInstance<10000000>() took: 122 ms

Additionally, there is some desire to upstream changes for a portable RhGetCodeTarget implementation. Not having to deal with it at this relatively low-level layer will make things more robust.

Ref: dotnet/runtimelab#2333.

dotnet/corert@08d78ae

The original motivation for this was handling import stubs:
```
Function pointer equality comparison was not handling cross-module pointers correctly when optimizations were enabled
(causes target pointers to be wrapped in jump stubs sometimes). The delegate equality comparison was hitting this bug.
```
We do not have import stubs anymore and unwrapping unboxing stubs serves no purpose here.

Microbenchmarks of delegate equality show ~3x improvement with this change:
```
Bench_DelegateEquality_Positive_OpenStatic<10000000>() took: 355 ms
Bench_DelegateEquality_Positive_ClosedStatic<10000000>() took: 367 ms
Bench_DelegateEquality_Positive_ClosedInstance<10000000>() took: 371 ms

Bench_DelegateEquality_Positive_OpenStatic<10000000>() took: 121 ms
Bench_DelegateEquality_Positive_ClosedStatic<10000000>() took: 120 ms
Bench_DelegateEquality_Positive_ClosedInstance<10000000>() took: 122 ms
```

Additionally, there is some desire to upstream changes for a portable RhGetCodeTarget implementation. Not having to
deal with it at this relatively low-level layer will make things more robust.
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jul 10, 2023
@ghost
Copy link

ghost commented Jul 10, 2023

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

Issue Details

dotnet/corert@08d78ae

The original motivation for this was handling import stubs:

Function pointer equality comparison was not handling cross-module pointers correctly when optimizations were enabled
(causes target pointers to be wrapped in jump stubs sometimes). The delegate equality comparison was hitting this bug.

We do not have import stubs anymore and unwrapping unboxing stubs serves no purpose here.

Microbenchmarks of delegate equality show ~3x improvement with this change:

Bench_DelegateEquality_Positive_OpenStatic<10000000>() took: 355 ms
Bench_DelegateEquality_Positive_ClosedStatic<10000000>() took: 367 ms
Bench_DelegateEquality_Positive_ClosedInstance<10000000>() took: 371 ms

Bench_DelegateEquality_Positive_OpenStatic<10000000>() took: 121 ms
Bench_DelegateEquality_Positive_ClosedStatic<10000000>() took: 120 ms
Bench_DelegateEquality_Positive_ClosedInstance<10000000>() took: 122 ms

Additionally, there is some desire to upstream changes for a portable RhGetCodeTarget implementation. Not having to deal with it at this relatively low-level layer will make things more robust.

Author: SingleAccretion
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@jkotas
Copy link
Member

jkotas commented Jul 11, 2023

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@SingleAccretion
Copy link
Contributor Author

Extra platform NAOT failures are all #88628, except for one System.Private.Xml.Tests failure:

Console log: 'System.Private.Xml.Tests' from job 35ef4761-e9bb-4401-9efe-8cc3f8ab5491 workitem 069930dd-fa36-4f12-a23f-3a80ebbaf30f (windows.amd64.server2022.open.rt) executed on machine a00DJC5 running Windows-10-10.0.20348-SP0

C:\h\w\B10309B3\w\AB6D09C6\e>taskkill.exe /f /im corerun.exe 
ERROR: The process "corerun.exe" not found.

C:\h\w\B10309B3\w\AB6D09C6\e>call RunTests.cmd --runtime-path C:\h\w\B10309B3\p 
----- start Tue 07/11/2023  8:14:20.54 ===============  To repro directly: =====================================================
pushd C:\h\w\B10309B3\w\AB6D09C6\e\
System.Private.Xml.Tests.exe -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing -xml testResults.xml 
popd
===========================================================================================================

C:\h\w\B10309B3\w\AB6D09C6\e>System.Private.Xml.Tests.exe -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing -xml testResults.xml  
Running assembly:System.Private.Xml.Tests, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
----- end Tue 07/11/2023  8:14:43.33 ----- exit code 3 ----------------------------------------------------------
2023-07-11T08:14:44.090Z	INFO   	run.py	run(48)	main	Beginning reading of test results.
2023-07-11T08:14:44.091Z	INFO   	run.py	__init__(42)	read_results	Searching 'C:\h\w\B10309B3\w\AB6D09C6\e' for test results files
2023-07-11T08:14:44.100Z	INFO   	run.py	__init__(42)	read_results	Searching 'C:\h\w\B10309B3\w\AB6D09C6\uploads' for test results files
2023-07-11T08:14:44.101Z	WARNING	run.py	__init__(55)	read_results	No results file found in any of the following formats: xunit, junit, trx
2023-07-11T08:14:44.101Z	INFO   	run.py	packing_test_reporter(30)	report_results	Packing 0 test reports to 'C:\h\w\B10309B3\w\AB6D09C6\e\__test_report.json'
2023-07-11T08:14:44.103Z	INFO   	run.py	packing_test_reporter(33)	report_results	Packed 1551 bytes
ERROR: The process "corerun.exe" not found.
Did not find dumps, skipping dump docs generation.
['System.Private.Xml.Tests' END OF WORK ITEM LOG: Command exited with 3]

@SingleAccretion
Copy link
Contributor Author

except for one System.Private.Xml.Tests failure

Which did not reproduce locally. Not clear what to do about it.

@MichalStrehovsky
Copy link
Member

except for one System.Private.Xml.Tests failure

Which did not reproduce locally. Not clear what to do about it.

I re-triggered the leg. I can't explain exit code 3.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@jkotas jkotas merged commit 6969e7e into dotnet:main Jul 12, 2023
125 of 159 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2023
@SingleAccretion SingleAccretion deleted the RhGetCodeTarget-DelEq branch September 28, 2023 18:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants