-
Notifications
You must be signed in to change notification settings - Fork 273
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
Move performance testing YAML from dotnet/runtime to dotnet/performance #4639
base: main
Are you sure you want to change the base?
Move performance testing YAML from dotnet/runtime to dotnet/performance #4639
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this file dead code? I don't see us doing the work that was done by this file anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this code hasn't been in use for a long time, the pipeline that used to reference this got deleted but this yaml file was not cleaned up with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we follow the naming convention we seem to have setup for other pipeline yaml files, and have performance- at the beginning of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is following a convention, although we could change them all to a new convention if needed. There are 5 fives in this directory:
- runtime-ios-scenarios-perf-jobs.yml
- runtime-perf-jobs.yml
- runtime-perf-slow-jobs.yml
- runtime-wasm-perf-jobs.yml
- sdk-perf-jobs.yml
I realised the slow one should be runtime-slow-perf-jobs
to be consistent which I can fix. Essentially they all end in perf-jobs
and the first section is either runtime
or sdk
depending on if it runs against a build of the runtime or against the sdk. Did you have any preference for how we should name these yaml files?
parameters: | ||
hybridGlobalization: ${{ parameters.hybridGlobalization }} | ||
|
||
# run mono iOS scenarios scenarios HybridGlobalization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: double "scenarios"
- android_arm64 | ||
|
||
jobs: | ||
- template: /eng/pipelines/coreclr/templates/perf-build-jobs.yml@${{ parameters.runtimeRepoAlias }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether it would make sense to convert those jobs to job strategy with matrix of parameters https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/jobs-job-strategy?view=azure-pipelines
as majority of the "code" seems to be duplicated and only the params seems to vary
I'd hope this might result in much shorter code with easy to compare parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of room to reduce duplication in these jobs using either matrix strategy or potentially using YAML loops. For now I'm keeping it the same as before, but would be open to such a change down the line.
- template: ${{ parameters.jobTemplate }} | ||
parameters: | ||
enableTelemetry: ${{ parameters.enableTelemetry }} | ||
name: run_performance_test_${{ replace(format('{0}_{1}_{2}_{3}_{4}{5}_{6}_{7}_{8}', parameters.runKind, coalesce(parameters.runtimeType, 'NULL'), coalesce(parameters.codeGenType, 'NULL'), coalesce(replace(parameters.additionalJobIdentifier, ' ', '_'), 'NULL'), parameters.osGroup, parameters.osSubGroup, coalesce(parameters.osVersion, 'NULL'), parameters.archType, coalesce(parameters.machinePool, parameters.logicalMachine)), '_NULL', '') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make a sense to extract this logic into some dedicated piece of code? I suspect this might evolve into even more complicated code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spent a lot of time trying to do this, but Azure Pipelines YAML does not have any way to really extract this logic out except by maybe more and more nested templates which I don't think is a scalable approach. If we can find any way to extract it into a reusable bit of code I would be open for it.
- ${{ if eq(parameters.osGroup, 'windows') }}: | ||
- name: Python | ||
value: 'py -3' | ||
- ${{ if ne(parameters.osGroup, 'windows') }}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: using if-else pattern would make reading the code easier
- ${{ step }} | ||
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.downloadPdn, true)) }}: | ||
- task: AzureCLI@2 | ||
displayName: 'Download PDN' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious: what do we need Paint.NET for???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and why do we have a personal "mirror" for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We maintain an internal mirror as we are not wanting to provide a way for people to download PDN without going through their official website/downloads. And we have some scenarios that do some performance testing against Paint.NET (startup time, size on disk etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General high level functionality check seems to look good to me, will take a closer look at changes individually soon.
This PR implements the dotnet/performance portion of the work to move the performance testing YAML to do the dotnet/performance repository. You can find the corresponding change for the dotnet/runtime repository here: dotnet/runtime#111454.
Summary
The goal of this work is to move as much of the CI logic as possible out of the dotnet/runtime repository and into the dotnet/performance repository. The reason we want to make this change is to decouple what is being tested from the code that does the testing.
We have had many occurrences over the last few years where there would be a bug in the performance testing logic that caused invalid/skipped data or we have had to make a breaking change. Having this logic live in the dotnet/runtime repository meant we were unable to re-run performance tests when the bug was present or before a breaking change was made. With the changes from this PR, it means that if we ever have a bug that causes invalid/skipped data, we can make the change in the dotnet/performance repo and then re-run the performance tests with those fixes and correct any data issues.
Implementation
It is not practical to move everything out of the dotnet/runtime repository as there are some steps of our performance tests that may be strongly coupled to the version of the runtime. In particular, these would be any jobs that involve building the runtime or building test applications. To handle this, we have made extensive use of cross-repository template references.
If you look at the dotnet/runtime portion of this PR, you will see that
eng/pipelines/coreclr/perf.yml
will include the following lines:There is a repository resource named
performance
which describes where the performance repository is located. For more information about repository resources, see the documentation here. Then we are able to reference a template from the performance repository by putting@performance
at the end. When manually running the pipeline in Azure DevOps, under "Advanced options" there is a section called Resources which allows you to customise a branch/commit of the performance repository you want to run against, which is useful when testing changes that need to be made against both the runtime and performance repositories.If you look at
/eng/pipelines/runtime-perf-jobs.yml
in this PR, you can see the following line:This line is how the performance repository is able to reference back into the runtime repository and call the perf-build-jobs.yml template inside it. In the dotnet/runtime repository PR, it sets
runtimeRepoAlias
toself
which means that it will reference the exact version of the runtime repository that called it. In a future PR, we will be able to add an additional pipeline to the dotnet/performance repository which will has aruntime
repository resource defined so that we can verify that a PR isn't going to cause the runtime performance tests to break.YAML Convergence
Before this PR, there was a lot of duplicated but slightly differing YAML files that did similar things. As part of this PR we are able to unify all this duplicate logic so that everything is only defined once and doesn't require making changes in lots of files. In particular I want to point out the following two files which are worth paying close attention to (both in the
/eng/pipelines/templates/
directory):run-performance-job.yml
: Defines a job that clones the runtime and performance repositories, runs the performance job python script, and sends the helix job. Every performance test will go through this YAML file including those that run against the SDK or a build of the runtime.runtime-perf-job.yml
: A wrapper aroundrun-performance-job.yml
which sets up all the necessary parameters and additional steps for running performance tests against a build of the runtime. Most of this is just downloading the build artifacts and arranging them into the correct directories so that they can be used by the python scripts.Other Changes
Performance osx x64 release iOSMono JIT ios_scenarios perfiphone12mini NoJS True False True net10.0
Performance ios_scenarios iOSMono JIT iOSLlvmBuild osx x64 perfiphone12mini net10.0
additionalJobIdentifier
parameter can be specified as extra information to include in the job name if needed to disambiguate two jobs.eng/pipelines/coreclr/perf.yml
you will see I added a parameter calledonlySanityCheck
which uses the newjobParameters
parameter to set theonlySanityCheck
parameter on every job that gets run.Validation
Since this change is large, it is likely to introduce bugs. To validate that things have been ported correctly, I looked at the
Run performance job script
step of the job to see the command line arguments that were passed to the python script to ensure that they are identical. There are still potentially other classes of bugs due to variables being different which are harder to detect, but from my testing I expect any bugs to be minimal.We should also address in a future PR ensuring that
onlySanityCheck
is properly implemented for all scenarios and test cases as it is only be active for our microbenchmarks. This should be fine for now though as our microbenchmarks are the ones that take the longest.