Skip to content

Commit

Permalink
SPMI: Switch back to unpinned 9.0 SDK for micro benchmarks (#109992)
Browse files Browse the repository at this point in the history
Also set PERFLAB_TARGET_FRAMEWORKS and fix superpmi.py when it replays during a collection.
  • Loading branch information
jakobbotsch authored Nov 26, 2024
1 parent 0170d78 commit b4923b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
7 changes: 7 additions & 0 deletions src/coreclr/scripts/superpmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ def add_core_root_arguments(parser, build_type_default, build_type_help):

replay_common_parser = argparse.ArgumentParser(add_help=False)

# NOTE: When adding arguments here, also make sure that they are set when collect does its replay:
# see the "collect" case in setup_args.
replay_common_parser.add_argument("-mch_files", metavar="MCH_FILE", nargs='+', help=replay_mch_files_help)
replay_common_parser.add_argument("-filter", nargs='+', help=filter_help)
replay_common_parser.add_argument("-product_location", help=product_location_help)
Expand Down Expand Up @@ -4759,6 +4761,11 @@ def verify_base_diff_args():
lambda unused: True,
"Unable to set produce_repro")

coreclr_args.verify(args,
"details", # The replay code checks this, so make sure it's set
lambda unused: True,
"Unable to set details")

coreclr_args.verify(args,
"collection_command",
lambda unused: True,
Expand Down
12 changes: 8 additions & 4 deletions src/coreclr/scripts/superpmi_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,17 @@ def build_and_run(coreclr_args, output_mch_name):
# Start with a "dotnet --info" to see what we've got.
run_command([dotnet_exe, "--info"])

env_copy = os.environ.copy()
tfm = "net9.0"
os.environ["PERFLAB_TARGET_FRAMEWORKS"] = tfm

env_for_restore = os.environ.copy()

if is_windows:
# Try to work around problem with random NuGet failures in "dotnet restore":
# error NU3037: Package 'System.Runtime 4.1.0' from source 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json':
# The repository primary signature validity period has expired. [C:\h\w\A3B008C0\w\B581097F\u\performance\src\benchmarks\micro\MicroBenchmarks.csproj]
# Using environment variable specified in https://github.com/NuGet/NuGet.Client/pull/4259.
env_copy["NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY"] = "9,2000"
env_for_restore["NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY"] = "9,2000"

# If `dotnet restore` fails, retry.
num_tries = 3
Expand All @@ -193,7 +197,7 @@ def build_and_run(coreclr_args, output_mch_name):
exit_on_fail = try_num + 1 == num_tries
(_, _, return_code) = run_command(
[dotnet_exe, "restore", project_file, "--packages", artifacts_packages_directory],
_exit_on_fail=exit_on_fail, _env=env_copy)
_exit_on_fail=exit_on_fail, _env=env_for_restore)
if return_code == 0:
# It succeeded!
break
Expand All @@ -203,7 +207,7 @@ def build_and_run(coreclr_args, output_mch_name):

run_command(
[dotnet_exe, "build", project_file, "--configuration", "Release",
"--framework", "net9.0", "--no-restore", "/p:NuGetPackageRoot=" + artifacts_packages_directory,
"--framework", tfm, "--no-restore", "/p:NuGetPackageRoot=" + artifacts_packages_directory,
"-o", artifacts_directory], _exit_on_fail=True)

# This is specifically for PowerShell.Benchmarks.
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/scripts/superpmi_collect_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,8 @@ def setup_benchmark(workitem_directory, arch):
print("Missing " + dotnet_install_script)
return

# Sometimes the dotnet version installed by the script is latest and expect certain versions of SDK that
# have not published yet. As a result, we hit errors of "dotnet restore". As a workaround, hard code the
# working version until we move to ".NET 9" in the script.
run_command(
get_python_name() + [dotnet_install_script, "install", "--dotnet-versions", "9.0.100-rc.2.24474.11", "--architecture", arch, "--install-dir",
get_python_name() + [dotnet_install_script, "install", "--channels", "9.0", "--architecture", arch, "--install-dir",
dotnet_directory, "--verbose"])


Expand Down

0 comments on commit b4923b3

Please sign in to comment.