Skip to content

Commit 4b93e52

Browse files
authored
Use wasm-tools workload to run benchmarks for wasm (#66493)
* [wasm] perf jobs: Use workloads to build benchmark projects This uses the new `--wasmDataDir` parameter. And `--cli` to use the dotnet from `dotnet-workload` which has the `wasm-tools` workload installed from artifacts. * perf pipeline: Use a dotnet with workload installed from artifacts .. for running the benchmarks. * [wasm] perf pipeline: Keep only the needed bits in the BrowserWasm .. download, instead of copying the whole `artifacts` folder. * Skip downloading unncessary liveLibraries build * [wasm] Skip unncessary core_root, and corelcr download
1 parent 3fd6148 commit 4b93e52

5 files changed

Lines changed: 54 additions & 39 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
parameters:
2+
configForBuild: 'Release'
3+
4+
steps:
5+
- script: >-
6+
./dotnet.sh build -p:TargetOS=Browser -p:TargetArchitecture=wasm /nr:false /p:TreatWarningsAsErrors=true
7+
/p:Configuration=${{ parameters.configForBuild }}
8+
/p:ContinuousIntegrationBuild=true
9+
/t:InstallWorkloadUsingArtifacts
10+
$(Build.SourcesDirectory)/src/tests/BuildWasmApps/Wasm.Build.Tests/Wasm.Build.Tests.csproj
11+
displayName: "Install workload using artifacts"
12+
13+
- script: >-
14+
mkdir -p $(Build.SourcesDirectory)/artifacts/staging &&
15+
cp -r $(Build.SourcesDirectory)/artifacts/bin/dotnet-workload $(Build.SourcesDirectory)/artifacts/staging &&
16+
cp -r $(Build.SourcesDirectory)/artifacts/bin/microsoft.netcore.app.runtime.browser-wasm $(Build.SourcesDirectory)/artifacts/staging &&
17+
cp -r $(Build.SourcesDirectory)/artifacts/bin/microsoft.netcore.app.ref $(Build.SourcesDirectory)/artifacts/staging
18+
displayName: "Prepare artifacts staging directory"
19+
20+
- template: /eng/pipelines/common/upload-artifact-step.yml
21+
parameters:
22+
rootFolder: '$(Build.SourcesDirectory)/artifacts/staging'
23+
includeRootFolder: true
24+
displayName: Browser Wasm Artifacts
25+
artifactName: BrowserWasm
26+
archiveType: zip
27+
archiveExtension: .zip

eng/pipelines/coreclr/perf.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,23 @@ jobs:
5757
- template: /eng/pipelines/common/platform-matrix.yml
5858
parameters:
5959
jobTemplate: /eng/pipelines/common/global-build-job.yml
60-
buildConfig: release
60+
buildConfig: Release
6161
runtimeFlavor: mono
6262
platforms:
6363
- Browser_wasm
6464
jobParameters:
6565
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig)
6666
nameSuffix: wasm
6767
isOfficialBuild: false
68-
extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml
68+
extraStepsTemplate: /eng/pipelines/coreclr/perf-wasm-prepare-artifacts-steps.yml
6969
extraStepsParameters:
70-
rootFolder: '$(Build.SourcesDirectory)/artifacts/'
71-
includeRootFolder: true
72-
displayName: Browser Wasm Artifacts
73-
artifactName: BrowserWasm
74-
archiveType: zip
75-
archiveExtension: .zip
70+
configForBuild: Release
7671

7772
#run mono wasm microbenchmarks perf job
7873
- template: /eng/pipelines/common/platform-matrix.yml
7974
parameters:
8075
jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml # NOTE: should we move this file out of coreclr tempelates because it contains mono jobs?
81-
buildConfig: release
76+
buildConfig: Release
8277
runtimeFlavor: wasm
8378
platforms:
8479
- Linux_x64
@@ -97,13 +92,14 @@ jobs:
9792
- template: /eng/pipelines/common/platform-matrix.yml
9893
parameters:
9994
jobtemplate: /eng/pipelines/coreclr/templates/perf-job.yml # note: should we move this file out of coreclr tempelates because it contains mono jobs?
100-
buildconfig: release
95+
buildconfig: Release
10196
runtimeflavor: wasm
10297
platforms:
10398
- linux_x64
10499
jobparameters:
105100
testgroup: perf
106101
livelibrariesbuildconfig: Release
102+
skipLiveLibrariesDownload: true
107103
runtimetype: wasm
108104
codegentype: 'aot'
109105
projectfile: microbenchmarks.proj
@@ -131,22 +127,17 @@ jobs:
131127
- template: /eng/pipelines/common/platform-matrix.yml
132128
parameters:
133129
jobTemplate: /eng/pipelines/common/global-build-job.yml
134-
buildConfig: release
130+
buildConfig: Release
135131
runtimeFlavor: mono
136132
platforms:
137133
- Browser_wasm
138134
jobParameters:
139135
buildArgs: -s mono+libs+host+packs -c $(_BuildConfig)
140136
nameSuffix: wasm
141137
isOfficialBuild: false
142-
extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml
138+
extraStepsTemplate: /eng/pipelines/coreclr/perf-wasm-prepare-artifacts-steps.yml
143139
extraStepsParameters:
144-
rootFolder: '$(Build.SourcesDirectory)/artifacts/'
145-
includeRootFolder: true
146-
displayName: Browser Wasm Artifacts
147-
artifactName: BrowserWasm
148-
archiveType: zip
149-
archiveExtension: .zip
140+
configForBuild: Release
150141

151142
# build mono for AOT
152143
- template: /eng/pipelines/common/platform-matrix.yml
@@ -326,6 +317,7 @@ jobs:
326317
jobParameters:
327318
testGroup: perf
328319
liveLibrariesBuildConfig: Release
320+
skipLiveLibrariesDownload: true
329321
runtimeType: wasm
330322
codeGenType: 'wasm'
331323
projectFile: microbenchmarks.proj
@@ -345,6 +337,7 @@ jobs:
345337
jobparameters:
346338
testgroup: perf
347339
livelibrariesbuildconfig: Release
340+
skipLiveLibrariesDownload: true
348341
runtimetype: wasm
349342
codegentype: 'aot'
350343
projectfile: microbenchmarks.proj
@@ -485,6 +478,7 @@ jobs:
485478
jobParameters:
486479
testGroup: perf
487480
liveLibrariesBuildConfig: Release
481+
skipLiveLibrariesDownload: true
488482
runtimeType: wasm
489483
projectFile: blazor_perf.proj
490484
runKind: blazor_scenarios

eng/pipelines/coreclr/templates/perf-job.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ parameters:
1919
pgoRunType: ''
2020
javascriptEngine: 'NoJS'
2121
iOSLlvmBuild: 'False'
22+
skipLiveLibrariesDownload: false
2223

2324
### Perf job
2425

@@ -50,9 +51,9 @@ jobs:
5051
iosLlvmBuild: ${{ parameters.iosLlvmBuild }}
5152
# Test job depends on the corresponding build job
5253
dependsOn:
53-
- ${{ if not(in(parameters.runtimeType, 'AndroidMono', 'iOSMono')) }}:
54+
- ${{ if not(in(parameters.runtimeType, 'AndroidMono', 'iOSMono', 'wasm')) }}:
5455
- ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
55-
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
56+
- ${{ if and(ne(parameters.liveLibrariesBuildConfig, ''), eq(parameters.skipLiveLibrariesDownload, 'false')) }}:
5657
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
5758
- ${{ if and(eq(parameters.runtimeType, 'mono'), ne(parameters.codeGenType, 'AOT')) }}:
5859
- ${{ format('mono_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
@@ -98,7 +99,7 @@ jobs:
9899
# Extra steps that will be passed to the performance template and run before sending the job to helix (all of which is done in the template)
99100

100101
# Optionally download live-built libraries
101-
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
102+
- ${{ if and(ne(parameters.liveLibrariesBuildConfig, ''), eq(parameters.skipLiveLibrariesDownload, 'false')) }}:
102103
- template: /eng/pipelines/common/download-artifact-step.yml
103104
parameters:
104105
unpackFolder: $(librariesDownloadDir)
@@ -108,15 +109,15 @@ jobs:
108109
displayName: 'live-built libraries'
109110

110111
# Download coreclr
111-
- ${{ if not(in(parameters.runtimeType, 'AndroidMono', 'iOSMono')) }}:
112+
- ${{ if not(in(parameters.runtimeType, 'AndroidMono', 'iOSMono', 'wasm')) }}:
112113
- template: /eng/pipelines/common/download-artifact-step.yml
113114
parameters:
114115
unpackFolder: $(buildProductRootFolderPath)
115116
artifactFileName: '$(buildProductArtifactName)$(archiveExtension)'
116117
artifactName: '$(buildProductArtifactName)'
117118
displayName: 'Coreclr product build'
118119

119-
# Download mono
120+
# Download mono
120121
- ${{ if and(eq(parameters.runtimeType, 'mono'), ne(parameters.codeGenType, 'AOT')) }}:
121122
- template: /eng/pipelines/common/download-artifact-step.yml
122123
parameters:
@@ -135,7 +136,11 @@ jobs:
135136
artifactName: BrowserWasm
136137
displayName: BrowserWasm
137138

138-
- script: "mkdir $(librariesDownloadDir)/bin/wasm;unzip -o $(librariesDownloadDir)/BrowserWasm/artifacts/packages/Release/Shipping/Microsoft.NETCore.App.Runtime.Mono.browser-wasm.7.0.0-ci.nupkg data/* runtimes/* -d $(librariesDownloadDir)/bin/wasm;cp src/mono/wasm/test-main.js $(librariesDownloadDir)/bin/wasm/test-main.js;find $(librariesDownloadDir)/bin/wasm -type f -exec chmod 664 {} \\;"
139+
- script: >-
140+
mkdir -p $(librariesDownloadDir)/bin/wasm/data &&
141+
cp -r $(librariesDownloadDir)/BrowserWasm/staging/dotnet-workload $(librariesDownloadDir)/bin/wasm &&
142+
cp src/mono/wasm/test-main.js $(librariesDownloadDir)/bin/wasm/data/test-main.js &&
143+
find $(librariesDownloadDir)/bin/wasm -type f -exec chmod 664 {} \;
139144
displayName: "Create wasm directory (Linux)"
140145
141146
# Download mono AOT
@@ -201,7 +206,7 @@ jobs:
201206
# Create Core_Root
202207
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg)
203208
displayName: Create Core_Root
204-
condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono'))
209+
condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono'), ne('${{ parameters.runtimeType }}', 'wasm'))
205210

206211
# Copy the runtime directory into the testhost folder to include OOBs.
207212
- script: "build.cmd -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)\\bin\\mono\\$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\runtime\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\shared\\Microsoft.NETCore.App\\7.0.0 /E /I /Y;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\$(_Framework)-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\.dotnet-mono /E /I /Y;copy $(Build.SourcesDirectory)\\artifacts\\bin\\coreclr\\$(osGroup).$(archType).$(buildConfigUpper)\\corerun.exe $(Build.SourcesDirectory)\\.dotnet-mono\\shared\\Microsoft.NETCore.App\\7.0.0\\corerun.exe"

eng/pipelines/coreclr/templates/run-scenarios-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
displayName: Run ci setup script (Linux)
108108
condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
109109
# copy wasm packs if running on wasm
110-
- script: cp -r $(librariesDownloadDir)/BrowserWasm/artifacts/bin/microsoft.netcore.app.runtime.browser-wasm $(PayloadDirectory);cp -r $(librariesDownloadDir)/BrowserWasm/artifacts/bin/microsoft.netcore.app.ref $(PayloadDirectory)
110+
- script: cp -r $(librariesDownloadDir)/BrowserWasm/staging/microsoft.netcore.app.runtime.browser-wasm $(PayloadDirectory) && cp -r $(librariesDownloadDir)/BrowserWasm/staging/microsoft.netcore.app.ref $(PayloadDirectory)
111111
displayName: Copy browserwasm and runtime ref packs
112112
condition: and(succeeded(), eq('${{ parameters.runtimeType }}', 'wasm'))
113113
# copy scenario support files

eng/testing/performance/performance-setup.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,9 @@ if [[ -n "$wasm_runtime_loc" ]]; then
280280
using_wasm=true
281281
wasm_dotnet_path=$payload_directory/dotnet-wasm
282282
mv $wasm_runtime_loc $wasm_dotnet_path
283-
# install emsdk, $source_directory/src/mono/wasm/ has the nuget.config with require feed. EMSDK may be available in the payload in a different directory, should visit this install to avoid deplicated payload.
284-
pushd $source_directory/src/mono/wasm/
285-
make provision-wasm
286-
EMSDK_PATH = $source_directory/src/mono/wasm/emsdk
287-
popd
288-
# wasm aot and interpreter need some source code from dotnet\runtime repo
289-
rsync -aq --progress $source_directory/* $wasm_dotnet_path --exclude Payload --exclude docs --exclude src/coreclr --exclude src/tests --exclude artifacts/obj --exclude artifacts/log --exclude artifacts/tests --exclude __download__
290-
# copy wasm build drop to the location that aot and interpreter build expects
291-
rsync -a --progress $wasm_dotnet_path/artifacts/BrowserWasm/artifacts/* $wasm_dotnet_path/artifacts
292-
rm -r $wasm_dotnet_path/artifacts/BrowserWasm/artifacts
283+
extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmEngine /home/helixbot/.jsvu/$javascript_engine --cli \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm/dotnet-workload/dotnet --wasmDataDir \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm/data"
293284
if [[ "$wasmaot" == "true" ]]; then
294-
extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmEngine /home/helixbot/.jsvu/$javascript_engine --runtimeSrcDir \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm --aotcompilermode wasm --buildTimeout 3600"
295-
else
296-
extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmEngine /home/helixbot/.jsvu/$javascript_engine --runtimeSrcDir \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm"
285+
extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --aotcompilermode wasm --buildTimeout 3600"
297286
fi
298287
fi
299288

0 commit comments

Comments
 (0)