Skip to content

Porting CoreClr benchmarks into the repo.#31

Merged
jorive merged 2 commits into
dotnet:masterfrom
jorive:dev/CoreClr-CQ
May 18, 2018
Merged

Porting CoreClr benchmarks into the repo.#31
jorive merged 2 commits into
dotnet:masterfrom
jorive:dev/CoreClr-CQ

Conversation

@jorive
Copy link
Copy Markdown

@jorive jorive commented May 16, 2018

Background

The idea is to have a single repository with .NET benchmarks that can be built and tested against different stages of the .NET pipeline/repositories/branches/releases.

What's in this PR?

This is the initial work to bring the benchmarks from CoreClr into this repo.

Additionally, I have converted the benchmarks old MSBuild/C# csproj into the .NET Core C# csproj, configured the projects with a common.props import, set treat warnings as errors, fixed the errors, and made the harness reference all the benchmarks (a single project needs to be built).

Finally, the benchmarks support netcoreapp1.1, netcoreapp2.0, and netcoreapp2.1 target frameworks (next, I might add desktop, thoughts?).

What's missing?

  • I'm currently finishing the build.py script for this folder.
  • Enable a CI validation for all projects.

@jorive jorive requested review from a team and AndyAyersMS May 16, 2018 22:35
Copy link
Copy Markdown
Contributor

@michellemcdaniel michellemcdaniel left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Does the global solution get messed up because the projects don't have unique GUIDs?

How are you handling package references for span in netcoreapp 1.1 and 2.0? Is referring to the portable span?

@jorive
Copy link
Copy Markdown
Author

jorive commented May 17, 2018

@AndyAyersMS I will remove the solution file. It's not needed anymore. It was my initial attempt. The whole GUID stuff was a mess.
Instead, I'm handling the whole netcoreapp[1.1|2.0] on the ./src/coreclr/harness/harness.csproj using the Condition attribute on the ItemGroup element (it is a cleaner solution to the *.sln file).
Now, you can run:

dotnet restore ./src/coreclr/harness/harness.csproj
dotnet publish ./src/coreclr/harness/harness.csproj -c release -f netcoreapp1.1
dotnet publish ./src/coreclr/harness/harness.csproj -c release -f netcoreapp2.0
dotnet publish ./src/coreclr/harness/harness.csproj -c release -f netcoreapp2.1
``` #Resolved

Comment thread src/coreclr/Harness/Harness.csproj Outdated
<ProjectReference Include="..\V8\Richards\Richards.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'!='netcoreapp1.1'">
Copy link
Copy Markdown
Author

@jorive jorive May 17, 2018

Choose a reason for hiding this comment

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

@AndyAyersMS This is how I handle different releases. #Resolved

Copy link
Copy Markdown
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread src/coreclr/README.md

```log
Xunit-Performance-Api
Copyright (c) Microsoft Corporation 2015
Copy link
Copy Markdown
Member

@adamsitnik adamsitnik May 17, 2018

Choose a reason for hiding this comment

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

nit: 2015 -> 2018? #Resolved

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is the current output of the Api.


In reply to: 188951690 [](ancestors = 188951690)

Comment thread src/coreclr/README.md
```cmd
dotnet restore Harness/Harness.csproj
dotnet publish Harness/Harness.csproj -c <Configuration> -f <Framework>
```
Copy link
Copy Markdown
Member

@adamsitnik adamsitnik May 17, 2018

Choose a reason for hiding this comment

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

is publish required? why not just dotnet run -c Release -f <Framework> ? #Resolved

Copy link
Copy Markdown
Author

@jorive jorive May 17, 2018

Choose a reason for hiding this comment

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

This is to publish (build) a self contained folder. I do not like dotnet run when running benchmarks. It's slower because it implies: build -> run. dotnet <path to dll> should be the way to run benchmarks.
Below is the step to run benchmarks.


In reply to: 188951947 [](ancestors = 188951947)

Comment thread src/coreclr/common.props

<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Copy link
Copy Markdown
Member

@adamsitnik adamsitnik May 17, 2018

Choose a reason for hiding this comment

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

👍 #Resolved

@adamsitnik
Copy link
Copy Markdown
Member

adamsitnik commented May 17, 2018

btw should we keep the coreclr in the folder structure? #Resolved

@jorive
Copy link
Copy Markdown
Author

jorive commented May 17, 2018

We do not need to keep it. I was trying to keep the same structure Drew has on his port of CoreFx. We could come up with something better.


In reply to: 389869235 [](ancestors = 389869235)

@adamsitnik
Copy link
Copy Markdown
Member

:shipit:


<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp1.1;netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
Copy link
Copy Markdown
Member

@brianrob brianrob May 17, 2018

Choose a reason for hiding this comment

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

Do we still need to build for netcoreapp1.1? Also, should we add net461 here? #Resolved

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There is no draw back at the moment on supporting netcoreapp1.1. Once we stop providing support we could remove it.


In reply to: 188997692 [](ancestors = 188997692)

Copy link
Copy Markdown
Author

@jorive jorive May 17, 2018

Choose a reason for hiding this comment

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

I will add desktop after some testing... Mono is missing too


In reply to: 189015906 [](ancestors = 189015906,188997692)

@brianrob
Copy link
Copy Markdown
Member

brianrob commented May 17, 2018

@jorive, how do these benchmarks stay in sync with CoreCLR? I'm thinking we should work with the corefx folks that own the mirror to set it up to sync these files. This will require that the directory structures remain largely the same (it does not have to be the same from the root directory, but could be the same within the coreclr directory), but will give us the benefit of not having to manually port changes. What do you think? #Resolved

@jorive
Copy link
Copy Markdown
Author

jorive commented May 17, 2018

The directory is very closed to CoreClr, so you could potentially script a copy *.cs between benchmarks. The idea is that eventually we make CoreClr use these benchmarks :)


In reply to: 389905514 [](ancestors = 389905514)

@jorive
Copy link
Copy Markdown
Author

jorive commented May 17, 2018

I just found out that some benchmarks depend on CORE_ROOT being defined... I'll fix it :(

@AndyAyersMS
Copy link
Copy Markdown
Member

The reliance on CORE_ROOT is usually a workaround for not being able to locate an assembly's directory, either to reference it (for the roslyn tests) or to find co-located input files. IIRC there were some missing APIs back when we first set up the benchmarks. See for instance dotnet/coreclr#9281.

It would be nice to fix the underlying problem, but I think that's only possible in netstandard1.5 and up.

@jorive
Copy link
Copy Markdown
Author

jorive commented May 17, 2018

@AndyAyersMS It seems a problem with the build in coreclr instead. With the current build, the resources/input-data are side-by-side with the assemblies, so they will not need to search for them in the source tree :)

@AndyAyersMS
Copy link
Copy Markdown
Member

CoreCLR is actually the same way.

The input files are copied into the same directory as the test assembly during build via project file directives. But on older netstandards the app cannot easily figure out where that assembly is located in the file system.

@jorive
Copy link
Copy Markdown
Author

jorive commented May 17, 2018

OK, finally, all benchmarks build and run/pass.

@michellemcdaniel
Copy link
Copy Markdown
Contributor

Latest change looks good to me.

@adamsitnik
Copy link
Copy Markdown
Member

  • NOTE: CscBench code could be improved/cleaned

We also have two Csc benchmarks in Scenarios (compile hello world and compile roslyn), so maybe this one could be just deleted?

the code looks good to me! great job @jorive 🍻 !

- Updated to .NET Core tooling (Cli).
- Reorganized the folders.
- Renamed PerfHarness to PerformanceHarness and placed it side-by-side to the benchmarks.
- Added a reference of the benchmarks to the harness.
- Enabled treat warnings as error.
- Fixed warning/errors.
- Adams needed to define XUNIT_PERF.
- Added logs folder to .gitignore.
- Added ms-python.python vscode extension suggestion.
- Added initial README.md for the CoreClr benchmarks.
- Moved common package reference to common.props
- Added a prefix to the benchmark assembly names so it is easy to find/iterate on automation/ad-hoc runs
- Removed CORE_ROOT dependency!!!
  - NOTE: CscBench code could be improved/cleaned (for example, it does not run on .NET Framework)
- Bonus: Enable Desktop: net461
@jorive jorive merged commit 6253bdf into dotnet:master May 18, 2018
@jorive jorive deleted the dev/CoreClr-CQ branch May 18, 2018 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants