From efc24d4b25b50bc563c0bd9b278351004ba1b85f Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Mon, 8 Nov 2021 16:04:28 -0800 Subject: [PATCH 01/17] SPMI no ASMDiff between Checked and Release Created the first file that builds release and checked builds --- .../superpmi-asmdiff-checked-release.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml diff --git a/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml b/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml new file mode 100644 index 00000000000000..53154dffe85163 --- /dev/null +++ b/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml @@ -0,0 +1,41 @@ +trigger: + batch: false + branches: + include: + - main + paths: + include: + - src/coreclr/jit/* + - src/coreclr/inc/jiteeversionguid.h + +jobs: + +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/coreclr/templates/build-jit-job.yml + buildConfig: checked + platforms: + - windows_x64 + - windows_x86 + jobParameters: + uploadAs: 'pipelineArtifacts' + +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/coreclr/templates/build-jit-job.yml + buildConfig: release + platforms: + - windows_x64 + - windows_x86 + jobParameters: + uploadAs: 'pipelineArtifacts' + +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/coreclr/templates/superpmi-replay-job.yml + buildConfig: checked + platforms: + - windows_x64 + - windows_x86 + helixQueueGroup: ci + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml From 3a78a698dd88fba6c8645fa34156f20b352405a6 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:41:23 -0800 Subject: [PATCH 02/17] SuperPMI asmdiff checked and release * Added downloading JIT release builds in superpmi-asmdiff-job * Added dummy 'run-superpmi-asmdiff-job' --- eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml b/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml index 53154dffe85163..03c52523155276 100644 --- a/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml +++ b/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml @@ -32,7 +32,7 @@ jobs: - template: /eng/pipelines/common/platform-matrix.yml parameters: - jobTemplate: /eng/pipelines/coreclr/templates/superpmi-replay-job.yml + jobTemplate: /eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml buildConfig: checked platforms: - windows_x64 From 1959d1d746644f03450137e2801e7d826845bc15 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:47:11 -0800 Subject: [PATCH 03/17] SuperPmi asmdiff checked release * Added JIT release download * Added dummy run job that just runs superpmi replay --- ...n-superpmi-asmdiff-checked-release-job.yml | 110 ++++++++++++++++++ .../superpmi-asmdiff-checked-release-job.yml | 61 ++++++++++ 2 files changed, 171 insertions(+) create mode 100644 eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml create mode 100644 eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml diff --git a/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml new file mode 100644 index 00000000000000..4038d0e81a88ac --- /dev/null +++ b/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml @@ -0,0 +1,110 @@ +parameters: + steps: [] # optional -- any additional steps that need to happen before pulling down the jitutils repo and sending the jitutils to helix (ie building your repo) + variables: [] # optional -- list of additional variables to send to the template + jobName: '' # required -- job name + displayName: '' # optional -- display name for the job. Will use jobName if not passed + pool: '' # required -- name of the Build pool + container: '' # required -- name of the container + buildConfig: '' # required -- build configuration + archType: '' # required -- targeting CPU architecture + osGroup: '' # required -- operating system for the job + osSubgroup: '' # optional -- operating system subgroup + continueOnError: 'false' # optional -- determines whether to continue the build if the step errors + dependsOn: '' # optional -- dependencies of the job + timeoutInMinutes: 320 # optional -- timeout for the job + enableTelemetry: false # optional -- enable for telemetry + liveLibrariesBuildConfig: '' # optional -- live-live libraries configuration to use for the run + helixQueues: '' # required -- Helix queues + dependOnEvaluatePaths: false + +jobs: +- template: xplat-pipeline-job.yml + parameters: + dependsOn: ${{ parameters.dependsOn }} + buildConfig: ${{ parameters.buildConfig }} + archType: ${{ parameters.archType }} + osGroup: ${{ parameters.osGroup }} + osSubgroup: ${{ parameters.osSubgroup }} + liveLibrariesBuildConfig: ${{ parameters.liveLibrariesBuildConfig }} + enableTelemetry: ${{ parameters.enableTelemetry }} + enablePublishBuildArtifacts: true + continueOnError: ${{ parameters.continueOnError }} + dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }} + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: '${{ parameters.displayName }}' + ${{ if eq(parameters.displayName, '') }}: + displayName: '${{ parameters.jobName }}' + + variables: + + - name: PythonScript + value: 'py -3' + - name: PipScript + value: 'py -3 -m pip' + - name: SpmiCollectionLocation + value: '$(Build.SourcesDirectory)\artifacts\spmi\' + - name: SpmiLogsLocation + value: '$(Build.SourcesDirectory)\artifacts\spmi_logs\' + - name: HelixResultLocation + value: '$(Build.SourcesDirectory)\artifacts\helixresults\' + + - ${{ each variable in parameters.variables }}: + - ${{insert}}: ${{ variable }} + + workspace: + clean: all + pool: + ${{ parameters.pool }} + container: ${{ parameters.container }} + steps: + - ${{ parameters.steps }} + + - script: | + mkdir -p $(SpmiCollectionLocation) + displayName: Create directory for SPMI collection + + - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_replay_setup.py -source_directory $(Build.SourcesDirectory) -product_directory $(buildProductRootFolderPath) -arch $(archType) + displayName: ${{ format('SuperPMI replay setup ({0} {1})', parameters.osGroup, parameters.archType) }} + + # Run superpmi replay in helix + - template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml + parameters: + displayName: 'Send job to Helix' + helixBuild: $(Build.BuildNumber) + helixSource: $(_HelixSource) + helixType: 'build/tests/' + helixQueues: ${{ join(',', parameters.helixQueues) }} + creator: dotnet-bot + WorkItemTimeout: 4:00 # 4 hours + WorkItemDirectory: '$(WorkItemDirectory)' + CorrelationPayloadDirectory: '$(CorrelationPayloadDirectory)' + helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-replay.proj' + BuildConfig: ${{ parameters.buildConfig }} + osGroup: ${{ parameters.osGroup }} + archType: ${{ parameters.archType }} + shouldContinueOnError: true # Run the future step i.e. upload superpmi logs + + # Always upload the available logs for diagnostics + - task: CopyFiles@2 + displayName: Copying superpmi.log of all partitions + inputs: + sourceFolder: '$(HelixResultLocation)' + contents: '**/superpmi_*.log' + targetFolder: '$(SpmiLogsLocation)' + condition: always() + + - task: PublishPipelineArtifact@1 + displayName: Publish SuperPMI logs + inputs: + targetPath: $(SpmiLogsLocation) + artifactName: 'SuperPMI_Logs_$(archType)_$(buildConfig)' + condition: always() + + - task: PublishPipelineArtifact@1 + displayName: Publish SuperPMI build logs + inputs: + targetPath: $(Build.SourcesDirectory)/artifacts/log + artifactName: 'SuperPMI_BuildLogs_$(archType)_$(buildConfig)' + condition: always() diff --git a/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml b/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml new file mode 100644 index 00000000000000..fe556ec2a2077e --- /dev/null +++ b/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml @@ -0,0 +1,61 @@ +parameters: + buildConfig: '' # required -- build configuration + archType: '' # required -- targeting CPU architecture + osGroup: '' # required -- operating system for the job + osSubgroup: '' # optional -- operating system subgroup + pool: '' + timeoutInMinutes: 320 # build timeout + variables: {} + helixQueues: '' + dependOnEvaluatePaths: false + runJobTemplate: '/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml' + +jobs: +- template: ${{ parameters.runJobTemplate }} + parameters: + jobName: ${{ format('superpmi_asmdiff_checked_release_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} + displayName: ${{ format('SuperPMI asmdiff checked release {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} + pool: ${{ parameters.pool }} + buildConfig: ${{ parameters.buildConfig }} + archType: ${{ parameters.archType }} + osGroup: ${{ parameters.osGroup }} + osSubgroup: ${{ parameters.osSubgroup }} + dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }} + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + helixQueues: ${{ parameters.helixQueues }} + dependsOn: + - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} + # - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, 'release') }} + + variables: + + - ${{ each variable in parameters.variables }}: + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + - name: releaseProductRootFolderPath + value: '$(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).$(archType).Release' + - name: releaseProductArtifactName + value: 'CoreCLRProduct_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_release' + + + steps: + + # Download jit builds + - template: /eng/pipelines/common/download-artifact-step.yml + parameters: + unpackFolder: $(buildProductRootFolderPath) + artifactFileName: '$(buildProductArtifactName)$(archiveExtension)' + artifactName: '$(buildProductArtifactName)' + displayName: 'JIT product build' + + #Download jit release builds + - template: /eng/pipelines/common/download-artifact-step.yml + parameters: + unpackFolder: $(releaseProductRootFolderPath) + artifactFileName: '$(releaseProductArtifactName)$(archiveExtension)' + artifactName: '$(releaseProductArtifactName)' + displayName: 'JIT release build' \ No newline at end of file From a9bad615699b653c792194a9f4c57d348f7802f8 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:57:25 -0800 Subject: [PATCH 04/17] SuperPMI asmdiff checked release * Remove the 4th argument for jobName and displayName --- .../templates/superpmi-asmdiff-checked-release-job.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml b/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml index fe556ec2a2077e..5b64b238aae0c9 100644 --- a/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml @@ -13,8 +13,8 @@ parameters: jobs: - template: ${{ parameters.runJobTemplate }} parameters: - jobName: ${{ format('superpmi_asmdiff_checked_release_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} - displayName: ${{ format('SuperPMI asmdiff checked release {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} + jobName: ${{ format('superpmi_asmdiff_checked_release_{0}{1}_{2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} + displayName: ${{ format('SuperPMI asmdiff checked release {0}{1} {2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} pool: ${{ parameters.pool }} buildConfig: ${{ parameters.buildConfig }} archType: ${{ parameters.archType }} @@ -58,4 +58,4 @@ jobs: unpackFolder: $(releaseProductRootFolderPath) artifactFileName: '$(releaseProductArtifactName)$(archiveExtension)' artifactName: '$(releaseProductArtifactName)' - displayName: 'JIT release build' \ No newline at end of file + displayName: 'JIT release build' From d1a6cb64c8db8cb1ab2fa7fcb5117a188181750a Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Wed, 10 Nov 2021 16:12:24 -0800 Subject: [PATCH 05/17] SuperPMI asmdiff checked release * In run-superpmi-asmdiff-checked-release-job.yml, * Added release_directory and release artifact to the script arguments * Added ReleaseCorrelationPayloadDirectory and ReleaseArtifactName to parameters to send-to-helix-step.yml * In superpmi_asmdiff_checked_release_setup.py * Added release_directory and release_artifactname arguments * Copied release binaries to source_directory/payload_release --- ...n-superpmi-asmdiff-checked-release-job.yml | 6 +- .../superpmi_asmdiff_checked_release_setup.py | 130 ++++++++++++++++++ 2 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py diff --git a/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml index 4038d0e81a88ac..3c40eca57f1909 100644 --- a/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml @@ -65,8 +65,8 @@ jobs: mkdir -p $(SpmiCollectionLocation) displayName: Create directory for SPMI collection - - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_replay_setup.py -source_directory $(Build.SourcesDirectory) -product_directory $(buildProductRootFolderPath) -arch $(archType) - displayName: ${{ format('SuperPMI replay setup ({0} {1})', parameters.osGroup, parameters.archType) }} + - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py -source_directory $(Build.SourcesDirectory) -product_directory $(buildProductRootFolderPath) -release_directory $(releaseProductRootFolderPath) -release_artifactname $(releaseProductArtifactName) -arch $(archType) + displayName: ${{ format('SuperPMI asmdiff checked release setup ({0} {1})', parameters.osGroup, parameters.archType) }} # Run superpmi replay in helix - template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml @@ -80,6 +80,8 @@ jobs: WorkItemTimeout: 4:00 # 4 hours WorkItemDirectory: '$(WorkItemDirectory)' CorrelationPayloadDirectory: '$(CorrelationPayloadDirectory)' + ReleaseCorrelationPayloadDirectory: '$(ReleaseCorrelationPayloadDirectory)' + ReleaseArtifactName: '$(ReleaseArtifactName)' helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-replay.proj' BuildConfig: ${{ parameters.buildConfig }} osGroup: ${{ parameters.osGroup }} diff --git a/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py b/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py new file mode 100644 index 00000000000000..9362fb8b5bb417 --- /dev/null +++ b/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python3 +# +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# +# Title : superpmi_asmdiff_checked_release_setup.py +# +# Notes: +# +# Script to setup directory structure required to perform SuperPMI asmdiff in CI. +# It creates `correlation_payload_directory` that contains clrjit*_x64.dll and clrjit*_x86.dll +# +################################################################################ +################################################################################ + +import argparse +import os + +from coreclr_arguments import * +from azdo_pipelines_util import copy_directory, copy_files, set_pipeline_variable + +parser = argparse.ArgumentParser(description="description") + +parser.add_argument("-arch", help="Architecture") +parser.add_argument("-source_directory", help="path to the directory containing binaries") +parser.add_argument("-product_directory", help="path to the directory containing checked binaries") +parser.add_argument("-release_directory", help="path to the directory containing release binaries") +parser.add_argument("-release_artifactname", help="release artifact name") + +def setup_args(args): + """ Setup the args for SuperPMI to use. + + Args: + args (ArgParse): args parsed by arg parser + + Returns: + args (CoreclrArguments) + + """ + coreclr_args = CoreclrArguments(args, require_built_core_root=False, require_built_product_dir=False, + require_built_test_dir=False, default_build_type="Checked") + + coreclr_args.verify(args, + "arch", + lambda unused: True, + "Unable to set arch") + + coreclr_args.verify(args, + "source_directory", + lambda source_directory: os.path.isdir(source_directory), + "source_directory doesn't exist") + + coreclr_args.verify(args, + "product_directory", + lambda product_directory: os.path.isdir(product_directory), + "product_directory doesn't exist") + + coreclr_args.verify(args, + "release_directory", + lambda release_directory: os.path.isdir(release_directory), + "release_directory doesn't exist") + + coreclr_args.verify(args, + "release_artifactname", + lambda unused: True, + "Unable to set release_artifactname") + + return coreclr_args + + +def match_correlation_files(full_path): + file_name = os.path.basename(full_path) + + if file_name.startswith("clrjit_") and file_name.endswith(".dll") and file_name.find("osx") == -1: + return True + + if file_name == "superpmi.exe" or file_name == "mcs.exe": + return True + + return False + + +def main(main_args): + """Main entrypoint + + Args: + main_args ([type]): Arguments to the script + """ + coreclr_args = setup_args(main_args) + + arch = coreclr_args.arch + source_directory = coreclr_args.source_directory + product_directory = coreclr_args.product_directory + release_directory = coreclr_args.release_directory + release_artifactname = coreclr_args.release_artifactname + + # CorrelationPayload directories + correlation_payload_directory = os.path.join(source_directory, "payload") + superpmi_src_directory = os.path.join(source_directory, 'src', 'coreclr', 'scripts') + release_correlation_payload_directory = os.path.join(source_directory, "payload_release") + + helix_source_prefix = "official" + creator = "" + + # Copy *.py to CorrelationPayload + print('Copying {} -> {}'.format(superpmi_src_directory, correlation_payload_directory)) + copy_directory(superpmi_src_directory, correlation_payload_directory, + match_func=lambda path: any(path.endswith(extension) for extension in [".py"])) + + # Copy clrjit*_arch.dll binaries from Checked to CorrelationPayload + print('Copying Checked binaries {} -> {}'.format(product_directory, correlation_payload_directory)) + copy_directory(product_directory, correlation_payload_directory, match_func=match_correlation_files) + + # Copy clrjit*_arch.dll binaries from Release to ReleaseCorrelationPayload + print('Copying Release binaries {} -> {}'.format(release_directory, release_correlation_payload_directory)) + copy_directory(release_directory, release_correlation_payload_directory, match_func=match_correlation_files) + + # Set variables + print('Setting pipeline variables:') + set_pipeline_variable("CorrelationPayloadDirectory", correlation_payload_directory) + set_pipeline_variable("ReleaseCorrelationPayloadDirectory", release_correlation_payload_directory) + set_pipeline_variable("ReleaseArtifactName", release_artifactname) + set_pipeline_variable("Architecture", arch) + set_pipeline_variable("Creator", creator) + set_pipeline_variable("HelixSourcePrefix", helix_source_prefix) + + +if __name__ == "__main__": + args = parser.parse_args() + sys.exit(main(args)) From 5c6dddf0421f915178fb4b8d9b612dd2dba93dd6 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Fri, 12 Nov 2021 19:06:24 -0800 Subject: [PATCH 06/17] SuperPMI asmdiffs checked release * Added superpmi_asmdiffs_checked_release_setup.py to set up Helix directories for checked in base and release in diff directories. * Use superpmi_asmdiffs.py and superpmi-asmdiffs.proj. * Renamed files from asmdiff to asmdiffs. --- ... => superpmi-asmdiffs-checked-release.yml} | 2 +- ...superpmi-asmdiffs-checked-release-job.yml} | 10 +- ...superpmi-asmdiffs-checked-release-job.yml} | 7 +- .../superpmi_asmdiff_checked_release_setup.py | 130 --------- ...superpmi_asmdiffs_checked_release_setup.py | 247 ++++++++++++++++++ 5 files changed, 255 insertions(+), 141 deletions(-) rename eng/pipelines/coreclr/{superpmi-asmdiff-checked-release.yml => superpmi-asmdiffs-checked-release.yml} (97%) rename eng/pipelines/coreclr/templates/{run-superpmi-asmdiff-checked-release-job.yml => run-superpmi-asmdiffs-checked-release-job.yml} (88%) rename eng/pipelines/coreclr/templates/{superpmi-asmdiff-checked-release-job.yml => superpmi-asmdiffs-checked-release-job.yml} (88%) delete mode 100644 src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py create mode 100644 src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py diff --git a/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml b/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml similarity index 97% rename from eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml rename to eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml index 03c52523155276..8d61908595f200 100644 --- a/eng/pipelines/coreclr/superpmi-asmdiff-checked-release.yml +++ b/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml @@ -32,7 +32,7 @@ jobs: - template: /eng/pipelines/common/platform-matrix.yml parameters: - jobTemplate: /eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml + jobTemplate: /eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml buildConfig: checked platforms: - windows_x64 diff --git a/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml similarity index 88% rename from eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml rename to eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml index 3c40eca57f1909..064569216ca1ee 100644 --- a/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml @@ -65,10 +65,10 @@ jobs: mkdir -p $(SpmiCollectionLocation) displayName: Create directory for SPMI collection - - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py -source_directory $(Build.SourcesDirectory) -product_directory $(buildProductRootFolderPath) -release_directory $(releaseProductRootFolderPath) -release_artifactname $(releaseProductArtifactName) -arch $(archType) - displayName: ${{ format('SuperPMI asmdiff checked release setup ({0} {1})', parameters.osGroup, parameters.archType) }} + - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py -source_directory $(Build.SourcesDirectory) -product_directory $(buildProductRootFolderPath) -release_directory $(releaseProductRootFolderPath) -arch $(archType) + displayName: ${{ format('SuperPMI asmdiffs checked release setup ({0} {1})', parameters.osGroup, parameters.archType) }} - # Run superpmi replay in helix + # Run superpmi asmdiffs between checked build and release build in helix - template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml parameters: displayName: 'Send job to Helix' @@ -80,9 +80,7 @@ jobs: WorkItemTimeout: 4:00 # 4 hours WorkItemDirectory: '$(WorkItemDirectory)' CorrelationPayloadDirectory: '$(CorrelationPayloadDirectory)' - ReleaseCorrelationPayloadDirectory: '$(ReleaseCorrelationPayloadDirectory)' - ReleaseArtifactName: '$(ReleaseArtifactName)' - helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-replay.proj' + helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-asmdiffs.proj' BuildConfig: ${{ parameters.buildConfig }} osGroup: ${{ parameters.osGroup }} archType: ${{ parameters.archType }} diff --git a/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml b/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml similarity index 88% rename from eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml rename to eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml index 5b64b238aae0c9..784c428307ce24 100644 --- a/eng/pipelines/coreclr/templates/superpmi-asmdiff-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml @@ -8,13 +8,13 @@ parameters: variables: {} helixQueues: '' dependOnEvaluatePaths: false - runJobTemplate: '/eng/pipelines/coreclr/templates/run-superpmi-asmdiff-checked-release-job.yml' + runJobTemplate: '/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml' jobs: - template: ${{ parameters.runJobTemplate }} parameters: - jobName: ${{ format('superpmi_asmdiff_checked_release_{0}{1}_{2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} - displayName: ${{ format('SuperPMI asmdiff checked release {0}{1} {2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} + jobName: ${{ format('superpmi_asmdiffs_checked_release_{0}{1}_{2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} + displayName: ${{ format('SuperPMI asmdiffs checked release {0}{1} {2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} pool: ${{ parameters.pool }} buildConfig: ${{ parameters.buildConfig }} archType: ${{ parameters.archType }} @@ -41,7 +41,6 @@ jobs: - name: releaseProductArtifactName value: 'CoreCLRProduct_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_$(osGroup)$(osSubgroup)_$(archType)_release' - steps: # Download jit builds diff --git a/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py b/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py deleted file mode 100644 index 9362fb8b5bb417..00000000000000 --- a/src/coreclr/scripts/superpmi_asmdiff_checked_release_setup.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python3 -# -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# -# Title : superpmi_asmdiff_checked_release_setup.py -# -# Notes: -# -# Script to setup directory structure required to perform SuperPMI asmdiff in CI. -# It creates `correlation_payload_directory` that contains clrjit*_x64.dll and clrjit*_x86.dll -# -################################################################################ -################################################################################ - -import argparse -import os - -from coreclr_arguments import * -from azdo_pipelines_util import copy_directory, copy_files, set_pipeline_variable - -parser = argparse.ArgumentParser(description="description") - -parser.add_argument("-arch", help="Architecture") -parser.add_argument("-source_directory", help="path to the directory containing binaries") -parser.add_argument("-product_directory", help="path to the directory containing checked binaries") -parser.add_argument("-release_directory", help="path to the directory containing release binaries") -parser.add_argument("-release_artifactname", help="release artifact name") - -def setup_args(args): - """ Setup the args for SuperPMI to use. - - Args: - args (ArgParse): args parsed by arg parser - - Returns: - args (CoreclrArguments) - - """ - coreclr_args = CoreclrArguments(args, require_built_core_root=False, require_built_product_dir=False, - require_built_test_dir=False, default_build_type="Checked") - - coreclr_args.verify(args, - "arch", - lambda unused: True, - "Unable to set arch") - - coreclr_args.verify(args, - "source_directory", - lambda source_directory: os.path.isdir(source_directory), - "source_directory doesn't exist") - - coreclr_args.verify(args, - "product_directory", - lambda product_directory: os.path.isdir(product_directory), - "product_directory doesn't exist") - - coreclr_args.verify(args, - "release_directory", - lambda release_directory: os.path.isdir(release_directory), - "release_directory doesn't exist") - - coreclr_args.verify(args, - "release_artifactname", - lambda unused: True, - "Unable to set release_artifactname") - - return coreclr_args - - -def match_correlation_files(full_path): - file_name = os.path.basename(full_path) - - if file_name.startswith("clrjit_") and file_name.endswith(".dll") and file_name.find("osx") == -1: - return True - - if file_name == "superpmi.exe" or file_name == "mcs.exe": - return True - - return False - - -def main(main_args): - """Main entrypoint - - Args: - main_args ([type]): Arguments to the script - """ - coreclr_args = setup_args(main_args) - - arch = coreclr_args.arch - source_directory = coreclr_args.source_directory - product_directory = coreclr_args.product_directory - release_directory = coreclr_args.release_directory - release_artifactname = coreclr_args.release_artifactname - - # CorrelationPayload directories - correlation_payload_directory = os.path.join(source_directory, "payload") - superpmi_src_directory = os.path.join(source_directory, 'src', 'coreclr', 'scripts') - release_correlation_payload_directory = os.path.join(source_directory, "payload_release") - - helix_source_prefix = "official" - creator = "" - - # Copy *.py to CorrelationPayload - print('Copying {} -> {}'.format(superpmi_src_directory, correlation_payload_directory)) - copy_directory(superpmi_src_directory, correlation_payload_directory, - match_func=lambda path: any(path.endswith(extension) for extension in [".py"])) - - # Copy clrjit*_arch.dll binaries from Checked to CorrelationPayload - print('Copying Checked binaries {} -> {}'.format(product_directory, correlation_payload_directory)) - copy_directory(product_directory, correlation_payload_directory, match_func=match_correlation_files) - - # Copy clrjit*_arch.dll binaries from Release to ReleaseCorrelationPayload - print('Copying Release binaries {} -> {}'.format(release_directory, release_correlation_payload_directory)) - copy_directory(release_directory, release_correlation_payload_directory, match_func=match_correlation_files) - - # Set variables - print('Setting pipeline variables:') - set_pipeline_variable("CorrelationPayloadDirectory", correlation_payload_directory) - set_pipeline_variable("ReleaseCorrelationPayloadDirectory", release_correlation_payload_directory) - set_pipeline_variable("ReleaseArtifactName", release_artifactname) - set_pipeline_variable("Architecture", arch) - set_pipeline_variable("Creator", creator) - set_pipeline_variable("HelixSourcePrefix", helix_source_prefix) - - -if __name__ == "__main__": - args = parser.parse_args() - sys.exit(main(args)) diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py new file mode 100644 index 00000000000000..8a7c1dc3f4c732 --- /dev/null +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python3 +# +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# +# Title : superpmi_asmdiffs_checked_release_setup.py +# +# Notes: +# +# Script to setup directory structure required to perform SuperPMI asmdiffs checked release in CI. +# It creates `correlation_payload_directory` with `base` and `diff` directories +# that contains clrjit*.dll. +# +################################################################################ +################################################################################ + +import argparse +import logging +import os + +from coreclr_arguments import * +from jitutil import copy_directory, set_pipeline_variable, run_command, TempDir, download_files + +parser = argparse.ArgumentParser(description="description") + +parser.add_argument("-arch", help="Architecture") +parser.add_argument("-source_directory", help="path to the directory of the dotnet/runtime source tree") +parser.add_argument("-product_directory", help="path to the directory containing built binaries (e.g., /artifacts/bin/coreclr/windows.x64.Checked)") +parser.add_argument("-release_directory", help="path to the directory containing release binaries (e.g., /artifacts/bin/coreclr/windows.x64.Release)") + +is_windows = platform.system() == "Windows" + + +def setup_args(args): + """ Setup the args for SuperPMI to use. + + Args: + args (ArgParse): args parsed by arg parser + + Returns: + args (CoreclrArguments) + + """ + coreclr_args = CoreclrArguments(args, require_built_core_root=False, require_built_product_dir=False, + require_built_test_dir=False, default_build_type="Checked") + + coreclr_args.verify(args, + "arch", + lambda unused: True, + "Unable to set arch") + + coreclr_args.verify(args, + "source_directory", + lambda source_directory: os.path.isdir(source_directory), + "source_directory doesn't exist") + + coreclr_args.verify(args, + "product_directory", + lambda product_directory: os.path.isdir(product_directory), + "product_directory doesn't exist") + + coreclr_args.verify(args, + "release_directory", + lambda release_directory: os.path.isdir(release_directory), + "release_directory doesn't exist") + + return coreclr_args + + +def match_jit_files(full_path): + """ Match all the JIT files that we want to copy and use. + Note that we currently only match Windows files, and not osx cross-compile files. + We also don't copy the "default" clrjit.dll, since we always use the fully specified + JITs, e.g., clrjit_win_x64_x64.dll. + """ + file_name = os.path.basename(full_path) + + if file_name.startswith("clrjit_") and file_name.endswith(".dll") and file_name.find("osx") == -1: + return True + + return False + + +def match_superpmi_tool_files(full_path): + """ Match all the SuperPMI tool files that we want to copy and use. + Note that we currently only match Windows files. + """ + file_name = os.path.basename(full_path) + + if file_name == "superpmi.exe" or file_name == "mcs.exe": + return True + + return False + + +def main(main_args): + """Main entrypoint: Prepare the Helix data for SuperPMI asmdiffs checked release Azure DevOps pipeline. + + The Helix correlation payload directory is created and populated as follows: + + \payload -- the correlation payload directory + -- contains the *.py scripts from \src\coreclr\scripts + -- contains superpmi.exe, mcs.exe from the target-specific build + \payload\base + -- contains the Checked JITs + \payload\diff + -- contains the Release JITs + \payload\jit-analyze + -- contains the self-contained jit-analyze build (from dotnet/jitutils) + \payload\git + -- contains a Portable ("xcopy installable") `git` tool, downloaded from: + https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/git/Git-2.32.0-64-bit.zip + This is needed by jit-analyze to do `git diff` on the generated asm. The `\payload\git\cmd` + directory is added to the PATH. + NOTE: this only runs on Windows. + + Then, AzDO pipeline variables are set. + + Args: + main_args ([type]): Arguments to the script + """ + + # Set up logging. + logger = logging.getLogger() + logger.setLevel(logging.INFO) + stream_handler = logging.StreamHandler(sys.stdout) + stream_handler.setLevel(logging.INFO) + logger.addHandler(stream_handler) + + coreclr_args = setup_args(main_args) + + arch = coreclr_args.arch + source_directory = coreclr_args.source_directory + product_directory = coreclr_args.product_directory + release_directory = coreclr_args.release_directory + + python_path = sys.executable + + # CorrelationPayload directories + correlation_payload_directory = os.path.join(source_directory, "payload") + superpmi_scripts_directory = os.path.join(source_directory, 'src', 'coreclr', 'scripts') + base_jit_directory = os.path.join(correlation_payload_directory, "base") + diff_jit_directory = os.path.join(correlation_payload_directory, "diff") + jit_analyze_build_directory = os.path.join(correlation_payload_directory, "jit-analyze") + git_directory = os.path.join(correlation_payload_directory, "git") + + ######## Get the portable `git` package + + git_url = "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/git/Git-2.32.0-64-bit.zip" + + print('Downloading {} -> {}'.format(git_url, git_directory)) + + urls = [ git_url ] + # There are too many files to be verbose in the download and copy. + download_files(urls, git_directory, verbose=False, display_progress=False) + git_exe_tool = os.path.join(git_directory, "cmd", "git.exe") + if not os.path.isfile(git_exe_tool): + print('Error: `git` not found at {}'.format(git_exe_tool)) + + ######## Copy SuperPMI python scripts + + # Copy *.py to CorrelationPayload + print('Copying {} -> {}'.format(superpmi_scripts_directory, correlation_payload_directory)) + copy_directory(superpmi_scripts_directory, correlation_payload_directory, verbose_copy=True, + match_func=lambda path: any(path.endswith(extension) for extension in [".py"])) + + ######## Copy baseline Checked JIT + + # Copy clrjit*_arch.dll binaries from Checked product_directory to base_jit_directory + print('Copying base Checked binaries {} -> {}'.format(product_directory, base_jit_directory)) + copy_directory(product_directory, base_jit_directory, verbose_copy=True, match_func=match_jit_files) + + ######## Copy diff Release JIT + + # Copy clrjit*_arch.dll binaries from release_directory to diff_jit_directory + print('Copying diff Release binaries {} -> {}'.format(release_directory, diff_jit_directory)) + copy_directory(release_directory, diff_jit_directory, verbose_copy=True, match_func=match_jit_files) + + ######## Get SuperPMI tools + + # Put the SuperPMI tools directly in the root of the correlation payload directory. + print('Copying SuperPMI tools {} -> {}'.format(product_directory, correlation_payload_directory)) + copy_directory(product_directory, correlation_payload_directory, verbose_copy=True, match_func=match_superpmi_tool_files) + + ######## Clone and build jitutils: we only need jit-analyze + + try: + with TempDir() as jitutils_directory: + run_command( + ["git", "clone", "--quiet", "--depth", "1", "https://github.com/dotnet/jitutils", jitutils_directory]) + + # Make sure ".dotnet" directory exists, by running the script at least once + dotnet_script_name = "dotnet.cmd" if is_windows else "dotnet.sh" + dotnet_script_path = os.path.join(source_directory, dotnet_script_name) + run_command([dotnet_script_path, "--info"], jitutils_directory) + + # Build jit-analyze only, and build it as a self-contained app (not framework-dependent). + # What target RID are we building? It depends on where we're going to run this code. + # The RID catalog is here: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog. + # Windows x64 => win-x64 + # Windows x86 => win-x86 + # Windows arm32 => win-arm + # Windows arm64 => win-arm64 + # Linux x64 => linux-x64 + # Linux arm32 => linux-arm + # Linux arm64 => linux-arm64 + # macOS x64 => osx-x64 + + # NOTE: we currently only support running on Windows x86/x64 (we don't pass the target OS) + RID = None + if arch == "x86": + RID = "win-x86" + if arch == "x64": + RID = "win-x64" + + # Set dotnet path to run build + os.environ["PATH"] = os.path.join(source_directory, ".dotnet") + os.pathsep + os.environ["PATH"] + + run_command([ + "dotnet", + "publish", + "-c", "Release", + "--runtime", RID, + "--self-contained", + "--output", jit_analyze_build_directory, + os.path.join(jitutils_directory, "src", "jit-analyze", "jit-analyze.csproj")], + jitutils_directory) + except PermissionError as pe_error: + # Details: https://bugs.python.org/issue26660 + print('Ignoring PermissionError: {0}'.format(pe_error)) + + + # Set variables + + helix_source_prefix = "official" + creator = "" + + print('Setting pipeline variables:') + set_pipeline_variable("CorrelationPayloadDirectory", correlation_payload_directory) + set_pipeline_variable("Architecture", arch) + set_pipeline_variable("Creator", creator) + set_pipeline_variable("HelixSourcePrefix", helix_source_prefix) + + +if __name__ == "__main__": + args = parser.parse_args() + sys.exit(main(args)) From 16fdb6e4de8a22dff09e91880dfe6c7e380dea12 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Wed, 24 Nov 2021 19:37:20 -0800 Subject: [PATCH 07/17] SuperPMI asmdiffs checked release: resolve merge conflict --- .../superpmi-asmdiffs-checked-release.proj | 73 +++++++ src/coreclr/scripts/superpmi.py | 54 ++--- .../superpmi_asmdiffs_checked_release.py | 203 ++++++++++++++++++ 3 files changed, 306 insertions(+), 24 deletions(-) create mode 100644 src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj create mode 100644 src/coreclr/scripts/superpmi_asmdiffs_checked_release.py diff --git a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj new file mode 100644 index 00000000000000..def19bbd57060b --- /dev/null +++ b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj @@ -0,0 +1,73 @@ + + + + + + + %HELIX_PYTHONPATH% + %HELIX_CORRELATION_PAYLOAD% + %HELIX_WORKITEM_UPLOAD_ROOT% + + $(BUILD_SOURCESDIRECTORY)\artifacts\helixresults + $(Python) $(ProductDirectory)\superpmi_asmdiffs.py -diff_with_release True -base_jit_directory $(ProductDirectory)\base -diff_jit_directory $(ProductDirectory)\diff -log_directory $(SuperpmiLogsLocation) + 1:00 + + + + false + false + $(_Creator) + $(_HelixAccessToken) + $(_HelixBuild) + $(_HelixSource) + $(_HelixTargetQueues) + $(_HelixType) + + + + + %(Identity) + + + + + + + + + + + + + + + + + + $(WorkItemCommand) -arch %(HelixWorkItem.Architecture) -platform %(HelixWorkItem.Platform) + $(WorkItemTimeout) + superpmi_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).log;superpmi_download_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).log;superpmi_diff_summary_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).md + + + diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index 3c9d417f81cc02..e1c5937b47a044 100755 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -324,7 +324,11 @@ asm_diff_parser.add_argument("-diff_jit_option", action="append", help="Option to pass to the diff JIT. Format is key=value, where key is the option name without leading COMPlus_...") asm_diff_parser.add_argument("-tag", help="Specify a word to add to the directory name where the asm diffs will be placed") asm_diff_parser.add_argument("-metrics", action="append", help="Metrics option to pass to jit-analyze. Can be specified multiple times, or pass comma-separated values.") +<<<<<<< HEAD asm_diff_parser.add_argument("-retainOnlyTopFiles", action="store_true", help="Retain only top .dasm files with largest improvements or regressions and delete remaining files.") +======= +asm_diff_parser.add_argument("-diff_with_release", help="Specify if this is asmdiff between checked binaries and release binaries.") +>>>>>>> 8f34248d2ff (SuperPMI asmdiff: added -diff_with_release flag to asmdiffs) # subparser for upload upload_parser = subparsers.add_parser("upload", description=upload_description, parents=[core_root_parser, target_parser]) @@ -1519,7 +1523,7 @@ def replay_with_asm_diffs(self): # There were diffs. Go through each method that created diffs and # create a base/diff asm file with diffable asm. In addition, create # a standalone .mc for easy iteration. - if is_nonzero_length_file(diff_mcl_file): + if self.coreclr_args.diff_with_release is not True and is_nonzero_length_file(diff_mcl_file): # AsmDiffs. Save the contents of the fail.mcl file to dig into failures. if return_code == 0: @@ -1711,23 +1715,24 @@ async def create_one_artifact(jit_path: str, location: str, flags) -> str: # Construct an overall Markdown summary file. - if len(all_md_summary_files) > 0: - overall_md_summary_file = create_unique_file_name(self.coreclr_args.spmi_location, "diff_summary", "md") - if not os.path.isdir(self.coreclr_args.spmi_location): - os.makedirs(self.coreclr_args.spmi_location) - if os.path.isfile(overall_md_summary_file): - os.remove(overall_md_summary_file) - - with open(overall_md_summary_file, "w") as write_fh: - for summary_file_info in all_md_summary_files: - summary_mch = summary_file_info[0] - summary_mch_filename = os.path.basename(summary_mch) # Display just the MCH filename, not the full path - summary_file = summary_file_info[1] - with open(summary_file, "r") as read_fh: - write_fh.write("## " + summary_mch_filename + ":\n\n") - shutil.copyfileobj(read_fh, write_fh) - - logging.info(" Summary Markdown file: %s", overall_md_summary_file) + if self.coreclr_args.diff_with_release is not True: + if len(all_md_summary_files) > 0: + overall_md_summary_file = create_unique_file_name(self.coreclr_args.spmi_location, "diff_summary", "md") + if not os.path.isdir(self.coreclr_args.spmi_location): + os.makedirs(self.coreclr_args.spmi_location) + if os.path.isfile(overall_md_summary_file): + os.remove(overall_md_summary_file) + + with open(overall_md_summary_file, "w") as write_fh: + for summary_file_info in all_md_summary_files: + summary_mch = summary_file_info[0] + summary_mch_filename = os.path.basename(summary_mch) # Display just the MCH filename, not the full path + summary_file = summary_file_info[1] + with open(summary_file, "r") as read_fh: + write_fh.write("## " + summary_mch_filename + ":\n\n") + shutil.copyfileobj(read_fh, write_fh) + + logging.info(" Summary Markdown file: %s", overall_md_summary_file) # Report the set of MCH files with asm diffs and replay failures. @@ -1736,12 +1741,13 @@ async def create_one_artifact(jit_path: str, location: str, flags) -> str: for file in files_with_replay_failures: logging.info(" %s", file) - if len(files_with_asm_diffs) == 0: - logging.info(" No asm diffs") - else: - logging.info(" Asm diffs in %s MCH files:", len(files_with_asm_diffs)) - for file in files_with_asm_diffs: - logging.info(" %s", file) + if self.coreclr_args.diff_with_release is not True: + if len(files_with_asm_diffs) == 0: + logging.info(" No asm diffs") + else: + logging.info(" Asm diffs in %s MCH files:", len(files_with_asm_diffs)) + for file in files_with_asm_diffs: + logging.info(" %s", file) return result ################################################################################################ end of replay_with_asm_diffs() diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py new file mode 100644 index 00000000000000..f4fa28249170e1 --- /dev/null +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +# +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# +# Title : superpmi_asmdiffs.py +# +# Notes: +# +# Script to run "superpmi asmdiffs" for various collections on the Helix machines. +# +################################################################################ +################################################################################ + +import argparse +import os +import shutil +from coreclr_arguments import * +from jitutil import run_command + +parser = argparse.ArgumentParser(description="description") + +parser.add_argument("-arch", help="Architecture") +parser.add_argument("-platform", help="OS platform") +parser.add_argument("-diff_with_release", help="asmdiffs between JIT Checked binaries and Release binaries") +parser.add_argument("-base_jit_directory", help="path to the directory containing base clrjit binaries") +parser.add_argument("-diff_jit_directory", help="path to the directory containing diff clrjit binaries") +parser.add_argument("-log_directory", help="path to the directory containing superpmi log files") + +def setup_args(args): + """ Setup the args for SuperPMI to use. + + Args: + args (ArgParse): args parsed by arg parser + + Returns: + args (CoreclrArguments) + + """ + coreclr_args = CoreclrArguments(args, require_built_core_root=False, require_built_product_dir=False, + require_built_test_dir=False, default_build_type="Checked") + + coreclr_args.verify(args, + "arch", + lambda unused: True, + "Unable to set arch") + + coreclr_args.verify(args, + "platform", + lambda unused: True, + "Unable to set platform") + + coreclr_args.verify(args, + "diff_with_release", + lambda unused: True, + "Unable to set diff_with_release") + + coreclr_args.verify(args, + "base_jit_directory", + lambda jit_directory: os.path.isdir(jit_directory), + "base_jit_directory doesn't exist") + + coreclr_args.verify(args, + "diff_jit_directory", + lambda jit_directory: os.path.isdir(jit_directory), + "diff_jit_directory doesn't exist") + + coreclr_args.verify(args, + "log_directory", + lambda log_directory: True, + "log_directory doesn't exist") + + return coreclr_args + + +def main(main_args): + """ Run superpmi asmdiffs process on the Helix machines. + + See superpmi_asmdiffs_setup.py for how the directory structure is set up in the + correlation payload. This script lives in the root of that directory tree. + + Args: + main_args ([type]): Arguments to the script + """ + + python_path = sys.executable + script_dir = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) + coreclr_args = setup_args(main_args) + + # It doesn't really matter where we put the downloaded SPMI artifacts. + # Here, they are put in /artifacts/spmi. + spmi_location = os.path.join(script_dir, "artifacts", "spmi") + + log_directory = coreclr_args.log_directory + platform_name = coreclr_args.platform + + # Find the built jit-analyze and put its directory on the PATH + jit_analyze_dir = os.path.join(script_dir, "jit-analyze") + if not os.path.isdir(jit_analyze_dir): + print("Error: jit-analyze not found in {} (continuing)".format(jit_analyze_dir)) + else: + # Put the jit-analyze directory on the PATH so superpmi.py can find it. + print("Adding {} to PATH".format(jit_analyze_dir)) + os.environ["PATH"] = jit_analyze_dir + os.pathsep + os.environ["PATH"] + + # Find the portable `git` installation, and put `git.exe` on the PATH, for use by `jit-analyze`. + git_directory = os.path.join(script_dir, "git", "cmd") + git_exe_tool = os.path.join(git_directory, "git.exe") + if not os.path.isfile(git_exe_tool): + print("Error: `git` not found at {} (continuing)".format(git_exe_tool)) + else: + # Put the git/cmd directory on the PATH so jit-analyze can find it. + print("Adding {} to PATH".format(git_directory)) + os.environ["PATH"] = git_directory + os.pathsep + os.environ["PATH"] + + # Figure out which JITs to use + os_name = "win" if platform_name.lower() == "windows" else "unix" + arch_name = coreclr_args.arch + host_arch_name = "x64" if arch_name.endswith("64") else "x86" + os_name = "universal" if arch_name.startswith("arm") else os_name + base_jit_path = os.path.join(coreclr_args.base_jit_directory, 'clrjit_{}_{}_{}.dll'.format(os_name, arch_name, host_arch_name)) + diff_jit_path = os.path.join(coreclr_args.diff_jit_directory, 'clrjit_{}_{}_{}.dll'.format(os_name, arch_name, host_arch_name)) + + # Find out if it is asmdiffs between Checked binaries and Release binaries + diff_with_release = coreclr_args.diff_with_release + + # Core_Root is where the superpmi tools (superpmi.exe, mcs.exe) are expected to be found. + # We pass the full path of the JITs to use as arguments. + core_root_dir = script_dir + + print("Running superpmi.py download to get MCH files") + + log_file = os.path.join(log_directory, "superpmi_download_{}_{}.log".format(platform_name, arch_name)) + run_command([ + python_path, + os.path.join(script_dir, "superpmi.py"), + "download", + "--no_progress", + "-core_root", core_root_dir, + "-target_os", platform_name, + "-target_arch", arch_name, + "-spmi_location", spmi_location, + "-log_level", "debug", + "-log_file", log_file + ], _exit_on_fail=True) + + print("Running superpmi.py asmdiffs between checked and release binaries") + log_file = os.path.join(log_directory, "superpmi_{}_{}.log".format(platform_name, arch_name)) + + overall_md_summary_file = os.path.join(spmi_location, "diff_summary.md") + if os.path.isfile(overall_md_summary_file): + os.remove(overall_md_summary_file) + + _, _, return_code = run_command([ + python_path, + os.path.join(script_dir, "superpmi.py"), + "asmdiffs", + "-diff_with_release", diff_with_release, + "--no_progress", + "-core_root", core_root_dir, + "-target_os", platform_name, + "-target_arch", arch_name, + "-arch", host_arch_name, + "-base_jit_path", base_jit_path, + "-diff_jit_path", diff_jit_path, + "-spmi_location", spmi_location, + "-error_limit", "100", + "-log_level", "debug", + "-log_file", log_file]) + + # If there are asm diffs, and jit-analyze ran, we'll get a diff_summary.md file in the spmi_location directory. + # We make sure the file doesn't exist before we run diffs, so we don't need to worry about superpmi.py creating + # a unique, numbered file. If there are no diffs, we still want to create this file and indicate there were no diffs. + + overall_md_summary_file_target = os.path.join(log_directory, "superpmi_diff_summary_{}_{}.md".format(platform_name, arch_name)) + if os.path.isfile(overall_md_summary_file): + try: + print("Copying summary file {} -> {}".format(overall_md_summary_file, overall_md_summary_file_target)) + shutil.copy2(overall_md_summary_file, overall_md_summary_file_target) + except PermissionError as pe_error: + print('Ignoring PermissionError: {0}'.format(pe_error)) + else: + # Write a basic summary file. Ideally, we should not generate a summary.md file. However, currently I'm seeing + # errors where the Helix work item fails to upload this specified file if it doesn't exist. We should change the + # upload to be conditional, or otherwise not error. + with open(overall_md_summary_file_target, "a") as f: + f.write("""\ +No diffs found +""") + + # TODO: the superpmi.py asmdiffs command returns a failure code if there are MISSING data even if there are + # no asm diffs. We should probably only fail if there are actual failures (not MISSING or asm diffs). + + if return_code != 0: + print("Failure in {}".format(log_file)) + return 1 + + return 0 + + +if __name__ == "__main__": + args = parser.parse_args() + sys.exit(main(args)) From 3f8073832539009870b7f6c8913dc54029177343 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:23:53 -0800 Subject: [PATCH 08/17] SuperPMI asmdiffs checked release: Fixed to use a proj and a script file that compare with Release --- .../templates/run-superpmi-asmdiffs-checked-release-job.yml | 2 +- src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml index 064569216ca1ee..6c83e3d19526be 100644 --- a/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml @@ -80,7 +80,7 @@ jobs: WorkItemTimeout: 4:00 # 4 hours WorkItemDirectory: '$(WorkItemDirectory)' CorrelationPayloadDirectory: '$(CorrelationPayloadDirectory)' - helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-asmdiffs.proj' + helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj' BuildConfig: ${{ parameters.buildConfig }} osGroup: ${{ parameters.osGroup }} archType: ${{ parameters.archType }} diff --git a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj index def19bbd57060b..a6d1ab2a842c2f 100644 --- a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj +++ b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj @@ -30,7 +30,7 @@ %HELIX_WORKITEM_UPLOAD_ROOT% $(BUILD_SOURCESDIRECTORY)\artifacts\helixresults - $(Python) $(ProductDirectory)\superpmi_asmdiffs.py -diff_with_release True -base_jit_directory $(ProductDirectory)\base -diff_jit_directory $(ProductDirectory)\diff -log_directory $(SuperpmiLogsLocation) + $(Python) $(ProductDirectory)\superpmi_asmdiffs_checked_release.py -diff_with_release True -base_jit_directory $(ProductDirectory)\base -diff_jit_directory $(ProductDirectory)\diff -log_directory $(SuperpmiLogsLocation) 1:00 From 84a456e005e36207d3bfd9fb9032e8c7935448dc Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:41:41 -0800 Subject: [PATCH 09/17] Superpmi asmdiffs checked release: changed to --diff_with_release as a boolean arg --- src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj | 2 +- src/coreclr/scripts/superpmi.py | 5 +---- src/coreclr/scripts/superpmi_asmdiffs_checked_release.py | 6 ++++-- 3 files changed, 6 insertions(+), 7 deletions(-) mode change 100755 => 100644 src/coreclr/scripts/superpmi.py diff --git a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj index a6d1ab2a842c2f..e1ec18906eb8d1 100644 --- a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj +++ b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj @@ -30,7 +30,7 @@ %HELIX_WORKITEM_UPLOAD_ROOT% $(BUILD_SOURCESDIRECTORY)\artifacts\helixresults - $(Python) $(ProductDirectory)\superpmi_asmdiffs_checked_release.py -diff_with_release True -base_jit_directory $(ProductDirectory)\base -diff_jit_directory $(ProductDirectory)\diff -log_directory $(SuperpmiLogsLocation) + $(Python) $(ProductDirectory)\superpmi_asmdiffs_checked_release.py --diff_with_release -base_jit_directory $(ProductDirectory)\base -diff_jit_directory $(ProductDirectory)\diff -log_directory $(SuperpmiLogsLocation) 1:00 diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py old mode 100755 new mode 100644 index e1c5937b47a044..da86a1cb6e6751 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -324,11 +324,8 @@ asm_diff_parser.add_argument("-diff_jit_option", action="append", help="Option to pass to the diff JIT. Format is key=value, where key is the option name without leading COMPlus_...") asm_diff_parser.add_argument("-tag", help="Specify a word to add to the directory name where the asm diffs will be placed") asm_diff_parser.add_argument("-metrics", action="append", help="Metrics option to pass to jit-analyze. Can be specified multiple times, or pass comma-separated values.") -<<<<<<< HEAD asm_diff_parser.add_argument("-retainOnlyTopFiles", action="store_true", help="Retain only top .dasm files with largest improvements or regressions and delete remaining files.") -======= -asm_diff_parser.add_argument("-diff_with_release", help="Specify if this is asmdiff between checked binaries and release binaries.") ->>>>>>> 8f34248d2ff (SuperPMI asmdiff: added -diff_with_release flag to asmdiffs) +asm_diff_parser.add_argument("--diff_with_release", action="store_true", help="Specify if this is asmdiff between checked binaries and release binaries.") # subparser for upload upload_parser = subparsers.add_parser("upload", description=upload_description, parents=[core_root_parser, target_parser]) diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py index f4fa28249170e1..2c49e206720f07 100644 --- a/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py @@ -22,7 +22,7 @@ parser.add_argument("-arch", help="Architecture") parser.add_argument("-platform", help="OS platform") -parser.add_argument("-diff_with_release", help="asmdiffs between JIT Checked binaries and Release binaries") +parser.add_argument("--diff_with_release", action="store_true", help="asmdiffs between JIT Checked binaries and Release binaries") parser.add_argument("-base_jit_directory", help="path to the directory containing base clrjit binaries") parser.add_argument("-diff_jit_directory", help="path to the directory containing diff clrjit binaries") parser.add_argument("-log_directory", help="path to the directory containing superpmi log files") @@ -123,6 +123,8 @@ def main(main_args): # Find out if it is asmdiffs between Checked binaries and Release binaries diff_with_release = coreclr_args.diff_with_release + if diff_with_release is not True: + return 1 # Core_Root is where the superpmi tools (superpmi.exe, mcs.exe) are expected to be found. # We pass the full path of the JITs to use as arguments. @@ -155,7 +157,7 @@ def main(main_args): python_path, os.path.join(script_dir, "superpmi.py"), "asmdiffs", - "-diff_with_release", diff_with_release, + "--diff_with_release", "--no_progress", "-core_root", core_root_dir, "-target_os", platform_name, From 30e8de191df45fac7a041262df7fc63f4cbedb07 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Wed, 1 Dec 2021 12:58:11 -0800 Subject: [PATCH 10/17] SuperPMI asmdiffs checked release: Add dependency to completed Release build --- .../templates/superpmi-asmdiffs-checked-release-job.yml | 2 +- src/coreclr/scripts/superpmi.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml b/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml index 784c428307ce24..5a73e1a5bfd81d 100644 --- a/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml @@ -25,7 +25,7 @@ jobs: helixQueues: ${{ parameters.helixQueues }} dependsOn: - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} - # - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, 'release') }} + - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, 'release') }} variables: diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index da86a1cb6e6751..b60c3992b2bad7 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -3557,7 +3557,10 @@ def main(args): base_jit_path = coreclr_args.base_jit_path diff_jit_path = coreclr_args.diff_jit_path + diff_with_release = coreclr_args.diff_with_release + if diff_with_release is True: + logging.info("Diff between Checked and Release.") logging.info("Base JIT Path: %s", base_jit_path) logging.info("Diff JIT Path: %s", diff_jit_path) From 75b1d607d2023acf84f3af9ac11088d1955f5d1f Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Thu, 2 Dec 2021 12:04:37 -0800 Subject: [PATCH 11/17] Superpmi asmdiffs checked release: add diff_with_release back that got removed from merge --- src/coreclr/scripts/superpmi.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index b60c3992b2bad7..ad5807ce8cad5d 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -1520,7 +1520,7 @@ def replay_with_asm_diffs(self): # There were diffs. Go through each method that created diffs and # create a base/diff asm file with diffable asm. In addition, create # a standalone .mc for easy iteration. - if self.coreclr_args.diff_with_release is not True and is_nonzero_length_file(diff_mcl_file): + if is_nonzero_length_file(diff_mcl_file): # AsmDiffs. Save the contents of the fail.mcl file to dig into failures. if return_code == 0: @@ -1738,13 +1738,12 @@ async def create_one_artifact(jit_path: str, location: str, flags) -> str: for file in files_with_replay_failures: logging.info(" %s", file) - if self.coreclr_args.diff_with_release is not True: - if len(files_with_asm_diffs) == 0: - logging.info(" No asm diffs") - else: - logging.info(" Asm diffs in %s MCH files:", len(files_with_asm_diffs)) - for file in files_with_asm_diffs: - logging.info(" %s", file) + if len(files_with_asm_diffs) == 0: + logging.info(" No asm diffs") + else: + logging.info(" Asm diffs in %s MCH files:", len(files_with_asm_diffs)) + for file in files_with_asm_diffs: + logging.info(" %s", file) return result ################################################################################################ end of replay_with_asm_diffs() @@ -3313,6 +3312,11 @@ def verify_replay_common_args(): lambda unused: True, "Unable to set retainOnlyTopFiles.") + coreclr_args.verify(args, + "diff_with_release", + lambda unused: True, + "Unable to set diff_with_release.") + process_base_jit_path_arg(coreclr_args) jit_in_product_location = False From 1fc1380df217c141466a260a3e2d553101e21243 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Thu, 27 Jan 2022 17:27:33 -0800 Subject: [PATCH 12/17] SuperPMI asmdiffs checked release: Do not create asm file for asmdiff check with release --- src/coreclr/scripts/superpmi.py | 45 +++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index ad5807ce8cad5d..43710c9ac6b973 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -1493,6 +1493,7 @@ def replay_with_asm_diffs(self): with ChangeDir(self.coreclr_args.core_root): command = [self.superpmi_path] + flags + [self.base_jit_path, self.diff_jit_path, mch_file] return_code = run_and_log(command) + logging.info("return_code: %s", return_code) base_metrics = read_csv_metrics(base_metrics_summary_file) diff_metrics = read_csv_metrics(diff_metrics_summary_file) @@ -1517,18 +1518,19 @@ def replay_with_asm_diffs(self): repro_base_command_line = "{} {} {}".format(self.superpmi_path, " ".join(altjit_asm_diffs_flags), self.diff_jit_path) save_repro_mc_files(temp_location, self.coreclr_args, artifacts_base_name, repro_base_command_line) + # This file had asm diffs; keep track of that. + if is_nonzero_length_file(diff_mcl_file): + files_with_asm_diffs.append(mch_file) + # There were diffs. Go through each method that created diffs and # create a base/diff asm file with diffable asm. In addition, create # a standalone .mc for easy iteration. - if is_nonzero_length_file(diff_mcl_file): + if is_nonzero_length_file(diff_mcl_file) and self.coreclr_args.diff_with_release is not True: # AsmDiffs. Save the contents of the fail.mcl file to dig into failures. if return_code == 0: logging.warning("Warning: SuperPMI returned a zero exit code, but generated a non-zero-sized mcl file") - # This file had asm diffs; keep track of that. - files_with_asm_diffs.append(mch_file) - self.diff_mcl_contents = None with open(diff_mcl_file) as file_handle: mcl_lines = file_handle.readlines() @@ -1712,24 +1714,23 @@ async def create_one_artifact(jit_path: str, location: str, flags) -> str: # Construct an overall Markdown summary file. - if self.coreclr_args.diff_with_release is not True: - if len(all_md_summary_files) > 0: - overall_md_summary_file = create_unique_file_name(self.coreclr_args.spmi_location, "diff_summary", "md") - if not os.path.isdir(self.coreclr_args.spmi_location): - os.makedirs(self.coreclr_args.spmi_location) - if os.path.isfile(overall_md_summary_file): - os.remove(overall_md_summary_file) - - with open(overall_md_summary_file, "w") as write_fh: - for summary_file_info in all_md_summary_files: - summary_mch = summary_file_info[0] - summary_mch_filename = os.path.basename(summary_mch) # Display just the MCH filename, not the full path - summary_file = summary_file_info[1] - with open(summary_file, "r") as read_fh: - write_fh.write("## " + summary_mch_filename + ":\n\n") - shutil.copyfileobj(read_fh, write_fh) - - logging.info(" Summary Markdown file: %s", overall_md_summary_file) + if len(all_md_summary_files) > 0 and self.coreclr_args.diff_with_release is not True: + overall_md_summary_file = create_unique_file_name(self.coreclr_args.spmi_location, "diff_summary", "md") + if not os.path.isdir(self.coreclr_args.spmi_location): + os.makedirs(self.coreclr_args.spmi_location) + if os.path.isfile(overall_md_summary_file): + os.remove(overall_md_summary_file) + + with open(overall_md_summary_file, "w") as write_fh: + for summary_file_info in all_md_summary_files: + summary_mch = summary_file_info[0] + summary_mch_filename = os.path.basename(summary_mch) # Display just the MCH filename, not the full path + summary_file = summary_file_info[1] + with open(summary_file, "r") as read_fh: + write_fh.write("## " + summary_mch_filename + ":\n\n") + shutil.copyfileobj(read_fh, write_fh) + + logging.info(" Summary Markdown file: %s", overall_md_summary_file) # Report the set of MCH files with asm diffs and replay failures. From 21af7b7713bb7d302abbaf24403cca78faf9f79b Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Fri, 28 Jan 2022 15:45:57 -0800 Subject: [PATCH 13/17] SuperPMI asmdiffs checked release: Report failure asm diffs (return code 2) if --diff_with_release --- src/coreclr/scripts/superpmi.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index 43710c9ac6b973..80c84a1be8c18d 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -1503,17 +1503,15 @@ def replay_with_asm_diffs(self): if return_code != 0: - # Don't report as replay failure asm diffs (return code 2) or missing data (return code 3). + # Don't report as replay failure asm diffs (return code 2) if not checking diffs with Release build or missing data (return code 3). # Anything else, such as compilation failure (return code 1, typically a JIT assert) will be # reported as a replay failure. - if return_code != 2 and return_code != 3: + if (return_code != 2 || self.coreclr_args.diff_with_release is True) and return_code != 3: result = False files_with_replay_failures.append(mch_file) if is_nonzero_length_file(fail_mcl_file): # Unclean replay. Examine the contents of the fail.mcl file to dig into failures. - if return_code == 0: - logging.warning("Warning: SuperPMI returned a zero exit code, but generated a non-zero-sized mcl file") print_fail_mcl_file_method_numbers(fail_mcl_file) repro_base_command_line = "{} {} {}".format(self.superpmi_path, " ".join(altjit_asm_diffs_flags), self.diff_jit_path) save_repro_mc_files(temp_location, self.coreclr_args, artifacts_base_name, repro_base_command_line) From 77328b6b72276cf835ead032f492b6988b0e427b Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 1 Feb 2022 11:11:12 -0800 Subject: [PATCH 14/17] SuperPMI asmdiffs checked release: Handled code review feedback to remove jit-analyze and diff_summary.md --- .../superpmi-asmdiffs-checked-release.yml | 1 - .../superpmi-asmdiffs-checked-release-job.yml | 6 +- .../superpmi-asmdiffs-checked-release.proj | 2 +- src/coreclr/scripts/superpmi.py | 10 +-- .../superpmi_asmdiffs_checked_release.py | 56 ++------------ ...superpmi_asmdiffs_checked_release_setup.py | 73 +------------------ 6 files changed, 16 insertions(+), 132 deletions(-) diff --git a/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml b/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml index 8d61908595f200..334aec6c71d4ad 100644 --- a/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml +++ b/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml @@ -6,7 +6,6 @@ trigger: paths: include: - src/coreclr/jit/* - - src/coreclr/inc/jiteeversionguid.h jobs: diff --git a/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml b/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml index 5a73e1a5bfd81d..c19ed54a2508d8 100644 --- a/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/superpmi-asmdiffs-checked-release-job.yml @@ -24,7 +24,7 @@ jobs: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} helixQueues: ${{ parameters.helixQueues }} dependsOn: - - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }} + - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, 'checked') }} - ${{ format('coreclr_jit_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, 'release') }} variables: @@ -43,13 +43,13 @@ jobs: steps: - # Download jit builds + # Download jit checked builds - template: /eng/pipelines/common/download-artifact-step.yml parameters: unpackFolder: $(buildProductRootFolderPath) artifactFileName: '$(buildProductArtifactName)$(archiveExtension)' artifactName: '$(buildProductArtifactName)' - displayName: 'JIT product build' + displayName: 'JIT checked build' #Download jit release builds - template: /eng/pipelines/common/download-artifact-step.yml diff --git a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj index e1ec18906eb8d1..4600858f22e980 100644 --- a/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj +++ b/src/coreclr/scripts/superpmi-asmdiffs-checked-release.proj @@ -67,7 +67,7 @@ $(WorkItemCommand) -arch %(HelixWorkItem.Architecture) -platform %(HelixWorkItem.Platform) $(WorkItemTimeout) - superpmi_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).log;superpmi_download_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).log;superpmi_diff_summary_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).md + superpmi_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).log;superpmi_download_%(HelixWorkItem.Platform)_%(HelixWorkItem.Architecture).log diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index 80c84a1be8c18d..08745710bb19f2 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -325,7 +325,7 @@ asm_diff_parser.add_argument("-tag", help="Specify a word to add to the directory name where the asm diffs will be placed") asm_diff_parser.add_argument("-metrics", action="append", help="Metrics option to pass to jit-analyze. Can be specified multiple times, or pass comma-separated values.") asm_diff_parser.add_argument("-retainOnlyTopFiles", action="store_true", help="Retain only top .dasm files with largest improvements or regressions and delete remaining files.") -asm_diff_parser.add_argument("--diff_with_release", action="store_true", help="Specify if this is asmdiff between checked binaries and release binaries.") +asm_diff_parser.add_argument("--diff_with_release", action="store_true", help="Specify if this is asmdiff using release binaries.") # subparser for upload upload_parser = subparsers.add_parser("upload", description=upload_description, parents=[core_root_parser, target_parser]) @@ -1493,7 +1493,7 @@ def replay_with_asm_diffs(self): with ChangeDir(self.coreclr_args.core_root): command = [self.superpmi_path] + flags + [self.base_jit_path, self.diff_jit_path, mch_file] return_code = run_and_log(command) - logging.info("return_code: %s", return_code) + logging.debug("return_code: %s", return_code) base_metrics = read_csv_metrics(base_metrics_summary_file) diff_metrics = read_csv_metrics(diff_metrics_summary_file) @@ -1506,7 +1506,7 @@ def replay_with_asm_diffs(self): # Don't report as replay failure asm diffs (return code 2) if not checking diffs with Release build or missing data (return code 3). # Anything else, such as compilation failure (return code 1, typically a JIT assert) will be # reported as a replay failure. - if (return_code != 2 || self.coreclr_args.diff_with_release is True) and return_code != 3: + if (return_code != 2 or self.coreclr_args.diff_with_release) and return_code != 3: result = False files_with_replay_failures.append(mch_file) @@ -1523,7 +1523,7 @@ def replay_with_asm_diffs(self): # There were diffs. Go through each method that created diffs and # create a base/diff asm file with diffable asm. In addition, create # a standalone .mc for easy iteration. - if is_nonzero_length_file(diff_mcl_file) and self.coreclr_args.diff_with_release is not True: + if is_nonzero_length_file(diff_mcl_file) and not self.coreclr_args.diff_with_release: # AsmDiffs. Save the contents of the fail.mcl file to dig into failures. if return_code == 0: @@ -1712,7 +1712,7 @@ async def create_one_artifact(jit_path: str, location: str, flags) -> str: # Construct an overall Markdown summary file. - if len(all_md_summary_files) > 0 and self.coreclr_args.diff_with_release is not True: + if len(all_md_summary_files) > 0 and not self.coreclr_args.diff_with_release: overall_md_summary_file = create_unique_file_name(self.coreclr_args.spmi_location, "diff_summary", "md") if not os.path.isdir(self.coreclr_args.spmi_location): os.makedirs(self.coreclr_args.spmi_location) diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py index 2c49e206720f07..72d4784a1f3068 100644 --- a/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release.py @@ -3,11 +3,12 @@ # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. # -# Title : superpmi_asmdiffs.py +# Title : superpmi_asmdiffs_checked_release.py # # Notes: # -# Script to run "superpmi asmdiffs" for various collections on the Helix machines. +# Script to run "superpmi asmdiffs" using release binaries +# for various collections on the Helix machines. # ################################################################################ ################################################################################ @@ -76,8 +77,8 @@ def setup_args(args): def main(main_args): """ Run superpmi asmdiffs process on the Helix machines. - See superpmi_asmdiffs_setup.py for how the directory structure is set up in the - correlation payload. This script lives in the root of that directory tree. + See superpmi_asmdiffs_checked_release_setup.py for how the directory structure is set up + in the correlation payload. This script lives in the root of that directory tree. Args: main_args ([type]): Arguments to the script @@ -94,25 +95,6 @@ def main(main_args): log_directory = coreclr_args.log_directory platform_name = coreclr_args.platform - # Find the built jit-analyze and put its directory on the PATH - jit_analyze_dir = os.path.join(script_dir, "jit-analyze") - if not os.path.isdir(jit_analyze_dir): - print("Error: jit-analyze not found in {} (continuing)".format(jit_analyze_dir)) - else: - # Put the jit-analyze directory on the PATH so superpmi.py can find it. - print("Adding {} to PATH".format(jit_analyze_dir)) - os.environ["PATH"] = jit_analyze_dir + os.pathsep + os.environ["PATH"] - - # Find the portable `git` installation, and put `git.exe` on the PATH, for use by `jit-analyze`. - git_directory = os.path.join(script_dir, "git", "cmd") - git_exe_tool = os.path.join(git_directory, "git.exe") - if not os.path.isfile(git_exe_tool): - print("Error: `git` not found at {} (continuing)".format(git_exe_tool)) - else: - # Put the git/cmd directory on the PATH so jit-analyze can find it. - print("Adding {} to PATH".format(git_directory)) - os.environ["PATH"] = git_directory + os.pathsep + os.environ["PATH"] - # Figure out which JITs to use os_name = "win" if platform_name.lower() == "windows" else "unix" arch_name = coreclr_args.arch @@ -121,11 +103,6 @@ def main(main_args): base_jit_path = os.path.join(coreclr_args.base_jit_directory, 'clrjit_{}_{}_{}.dll'.format(os_name, arch_name, host_arch_name)) diff_jit_path = os.path.join(coreclr_args.diff_jit_directory, 'clrjit_{}_{}_{}.dll'.format(os_name, arch_name, host_arch_name)) - # Find out if it is asmdiffs between Checked binaries and Release binaries - diff_with_release = coreclr_args.diff_with_release - if diff_with_release is not True: - return 1 - # Core_Root is where the superpmi tools (superpmi.exe, mcs.exe) are expected to be found. # We pass the full path of the JITs to use as arguments. core_root_dir = script_dir @@ -149,10 +126,6 @@ def main(main_args): print("Running superpmi.py asmdiffs between checked and release binaries") log_file = os.path.join(log_directory, "superpmi_{}_{}.log".format(platform_name, arch_name)) - overall_md_summary_file = os.path.join(spmi_location, "diff_summary.md") - if os.path.isfile(overall_md_summary_file): - os.remove(overall_md_summary_file) - _, _, return_code = run_command([ python_path, os.path.join(script_dir, "superpmi.py"), @@ -170,25 +143,6 @@ def main(main_args): "-log_level", "debug", "-log_file", log_file]) - # If there are asm diffs, and jit-analyze ran, we'll get a diff_summary.md file in the spmi_location directory. - # We make sure the file doesn't exist before we run diffs, so we don't need to worry about superpmi.py creating - # a unique, numbered file. If there are no diffs, we still want to create this file and indicate there were no diffs. - - overall_md_summary_file_target = os.path.join(log_directory, "superpmi_diff_summary_{}_{}.md".format(platform_name, arch_name)) - if os.path.isfile(overall_md_summary_file): - try: - print("Copying summary file {} -> {}".format(overall_md_summary_file, overall_md_summary_file_target)) - shutil.copy2(overall_md_summary_file, overall_md_summary_file_target) - except PermissionError as pe_error: - print('Ignoring PermissionError: {0}'.format(pe_error)) - else: - # Write a basic summary file. Ideally, we should not generate a summary.md file. However, currently I'm seeing - # errors where the Helix work item fails to upload this specified file if it doesn't exist. We should change the - # upload to be conditional, or otherwise not error. - with open(overall_md_summary_file_target, "a") as f: - f.write("""\ -No diffs found -""") # TODO: the superpmi.py asmdiffs command returns a failure code if there are MISSING data even if there are # no asm diffs. We should probably only fail if there are actual failures (not MISSING or asm diffs). diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py index 8a7c1dc3f4c732..d8441f7df629a7 100644 --- a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py @@ -25,8 +25,8 @@ parser.add_argument("-arch", help="Architecture") parser.add_argument("-source_directory", help="path to the directory of the dotnet/runtime source tree") -parser.add_argument("-product_directory", help="path to the directory containing built binaries (e.g., /artifacts/bin/coreclr/windows.x64.Checked)") -parser.add_argument("-release_directory", help="path to the directory containing release binaries (e.g., /artifacts/bin/coreclr/windows.x64.Release)") +parser.add_argument("-base_directory", help="path to the directory containing base binaries (e.g., /artifacts/bin/coreclr/windows.x64.Checked)") +parser.add_argument("-diff_directory", help="path to the directory containing diff binaries (e.g., /artifacts/bin/coreclr/windows.x64.Release)") is_windows = platform.system() == "Windows" @@ -105,14 +105,6 @@ def main(main_args): -- contains the Checked JITs \payload\diff -- contains the Release JITs - \payload\jit-analyze - -- contains the self-contained jit-analyze build (from dotnet/jitutils) - \payload\git - -- contains a Portable ("xcopy installable") `git` tool, downloaded from: - https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/git/Git-2.32.0-64-bit.zip - This is needed by jit-analyze to do `git diff` on the generated asm. The `\payload\git\cmd` - directory is added to the PATH. - NOTE: this only runs on Windows. Then, AzDO pipeline variables are set. @@ -142,20 +134,6 @@ def main(main_args): base_jit_directory = os.path.join(correlation_payload_directory, "base") diff_jit_directory = os.path.join(correlation_payload_directory, "diff") jit_analyze_build_directory = os.path.join(correlation_payload_directory, "jit-analyze") - git_directory = os.path.join(correlation_payload_directory, "git") - - ######## Get the portable `git` package - - git_url = "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/git/Git-2.32.0-64-bit.zip" - - print('Downloading {} -> {}'.format(git_url, git_directory)) - - urls = [ git_url ] - # There are too many files to be verbose in the download and copy. - download_files(urls, git_directory, verbose=False, display_progress=False) - git_exe_tool = os.path.join(git_directory, "cmd", "git.exe") - if not os.path.isfile(git_exe_tool): - print('Error: `git` not found at {}'.format(git_exe_tool)) ######## Copy SuperPMI python scripts @@ -182,53 +160,6 @@ def main(main_args): print('Copying SuperPMI tools {} -> {}'.format(product_directory, correlation_payload_directory)) copy_directory(product_directory, correlation_payload_directory, verbose_copy=True, match_func=match_superpmi_tool_files) - ######## Clone and build jitutils: we only need jit-analyze - - try: - with TempDir() as jitutils_directory: - run_command( - ["git", "clone", "--quiet", "--depth", "1", "https://github.com/dotnet/jitutils", jitutils_directory]) - - # Make sure ".dotnet" directory exists, by running the script at least once - dotnet_script_name = "dotnet.cmd" if is_windows else "dotnet.sh" - dotnet_script_path = os.path.join(source_directory, dotnet_script_name) - run_command([dotnet_script_path, "--info"], jitutils_directory) - - # Build jit-analyze only, and build it as a self-contained app (not framework-dependent). - # What target RID are we building? It depends on where we're going to run this code. - # The RID catalog is here: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog. - # Windows x64 => win-x64 - # Windows x86 => win-x86 - # Windows arm32 => win-arm - # Windows arm64 => win-arm64 - # Linux x64 => linux-x64 - # Linux arm32 => linux-arm - # Linux arm64 => linux-arm64 - # macOS x64 => osx-x64 - - # NOTE: we currently only support running on Windows x86/x64 (we don't pass the target OS) - RID = None - if arch == "x86": - RID = "win-x86" - if arch == "x64": - RID = "win-x64" - - # Set dotnet path to run build - os.environ["PATH"] = os.path.join(source_directory, ".dotnet") + os.pathsep + os.environ["PATH"] - - run_command([ - "dotnet", - "publish", - "-c", "Release", - "--runtime", RID, - "--self-contained", - "--output", jit_analyze_build_directory, - os.path.join(jitutils_directory, "src", "jit-analyze", "jit-analyze.csproj")], - jitutils_directory) - except PermissionError as pe_error: - # Details: https://bugs.python.org/issue26660 - print('Ignoring PermissionError: {0}'.format(pe_error)) - # Set variables From cf3ecf7cb4c89a8babae50974dbf3c6f21935b67 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 1 Feb 2022 15:47:42 -0800 Subject: [PATCH 15/17] SuperPMI asmdiffs checked release: Changed to checked_directory instead of base_directory --- ...superpmi_asmdiffs_checked_release_setup.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py index d8441f7df629a7..902bd8660a658d 100644 --- a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py @@ -25,8 +25,8 @@ parser.add_argument("-arch", help="Architecture") parser.add_argument("-source_directory", help="path to the directory of the dotnet/runtime source tree") -parser.add_argument("-base_directory", help="path to the directory containing base binaries (e.g., /artifacts/bin/coreclr/windows.x64.Checked)") -parser.add_argument("-diff_directory", help="path to the directory containing diff binaries (e.g., /artifacts/bin/coreclr/windows.x64.Release)") +parser.add_argument("-checked_directory", help="path to the directory containing checked binaries (e.g., /artifacts/bin/coreclr/windows.x64.Checked)") +parser.add_argument("-release_directory", help="path to the directory containing release binaries (e.g., /artifacts/bin/coreclr/windows.x64.Release)") is_windows = platform.system() == "Windows" @@ -55,9 +55,9 @@ def setup_args(args): "source_directory doesn't exist") coreclr_args.verify(args, - "product_directory", - lambda product_directory: os.path.isdir(product_directory), - "product_directory doesn't exist") + "checked_directory", + lambda checked_directory: os.path.isdir(checked_directory), + "checked_directory doesn't exist") coreclr_args.verify(args, "release_directory", @@ -123,7 +123,7 @@ def main(main_args): arch = coreclr_args.arch source_directory = coreclr_args.source_directory - product_directory = coreclr_args.product_directory + checked_directory = coreclr_args.checked_directory release_directory = coreclr_args.release_directory python_path = sys.executable @@ -144,9 +144,9 @@ def main(main_args): ######## Copy baseline Checked JIT - # Copy clrjit*_arch.dll binaries from Checked product_directory to base_jit_directory - print('Copying base Checked binaries {} -> {}'.format(product_directory, base_jit_directory)) - copy_directory(product_directory, base_jit_directory, verbose_copy=True, match_func=match_jit_files) + # Copy clrjit*_arch.dll binaries from Checked checked_directory to base_jit_directory + print('Copying base Checked binaries {} -> {}'.format(checked_directory, base_jit_directory)) + copy_directory(checked_directory, base_jit_directory, verbose_copy=True, match_func=match_jit_files) ######## Copy diff Release JIT @@ -157,8 +157,8 @@ def main(main_args): ######## Get SuperPMI tools # Put the SuperPMI tools directly in the root of the correlation payload directory. - print('Copying SuperPMI tools {} -> {}'.format(product_directory, correlation_payload_directory)) - copy_directory(product_directory, correlation_payload_directory, verbose_copy=True, match_func=match_superpmi_tool_files) + print('Copying SuperPMI tools {} -> {}'.format(checked_directory, correlation_payload_directory)) + copy_directory(checked_directory, correlation_payload_directory, verbose_copy=True, match_func=match_superpmi_tool_files) # Set variables From fd9ad6ce1a8d0ac8c6a167530186b37cfc56f6c6 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 1 Feb 2022 20:15:44 -0800 Subject: [PATCH 16/17] SuperPMI asmdiffs checked release: explictly say checked_directory --- .../templates/run-superpmi-asmdiffs-checked-release-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml index 6c83e3d19526be..56975233885a77 100644 --- a/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml +++ b/eng/pipelines/coreclr/templates/run-superpmi-asmdiffs-checked-release-job.yml @@ -65,7 +65,7 @@ jobs: mkdir -p $(SpmiCollectionLocation) displayName: Create directory for SPMI collection - - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py -source_directory $(Build.SourcesDirectory) -product_directory $(buildProductRootFolderPath) -release_directory $(releaseProductRootFolderPath) -arch $(archType) + - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py -source_directory $(Build.SourcesDirectory) -checked_directory $(buildProductRootFolderPath) -release_directory $(releaseProductRootFolderPath) -arch $(archType) displayName: ${{ format('SuperPMI asmdiffs checked release setup ({0} {1})', parameters.osGroup, parameters.archType) }} # Run superpmi asmdiffs between checked build and release build in helix From 853700846f5b194aa2d2d654ef2fe520d97ca107 Mon Sep 17 00:00:00 2001 From: Julie Lee <63486087+JulieLeeMSFT@users.noreply.github.com> Date: Tue, 15 Feb 2022 17:58:23 -0800 Subject: [PATCH 17/17] SuperPMI asmdiffs checked release: schedule to run on Saturdays and Sundays only. --- .../coreclr/superpmi-asmdiffs-checked-release.yml | 11 ++++++----- src/coreclr/scripts/superpmi.py | 3 +-- .../superpmi_asmdiffs_checked_release_setup.py | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml b/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml index 334aec6c71d4ad..b1b4bea9d20928 100644 --- a/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml +++ b/eng/pipelines/coreclr/superpmi-asmdiffs-checked-release.yml @@ -1,11 +1,12 @@ -trigger: - batch: false +trigger: none + +schedules: +- cron: "0 10 * * 6,0" + displayName: Sat and Sun at 2:00 AM (UTC-8:00) branches: include: - main - paths: - include: - - src/coreclr/jit/* + always: true jobs: diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py index 08745710bb19f2..1034a7aacf9dda 100644 --- a/src/coreclr/scripts/superpmi.py +++ b/src/coreclr/scripts/superpmi.py @@ -3560,9 +3560,8 @@ def main(args): base_jit_path = coreclr_args.base_jit_path diff_jit_path = coreclr_args.diff_jit_path - diff_with_release = coreclr_args.diff_with_release - if diff_with_release is True: + if coreclr_args.diff_with_release: logging.info("Diff between Checked and Release.") logging.info("Base JIT Path: %s", base_jit_path) logging.info("Diff JIT Path: %s", diff_jit_path) diff --git a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py index 902bd8660a658d..c98e83c87a843c 100644 --- a/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py +++ b/src/coreclr/scripts/superpmi_asmdiffs_checked_release_setup.py @@ -133,7 +133,6 @@ def main(main_args): superpmi_scripts_directory = os.path.join(source_directory, 'src', 'coreclr', 'scripts') base_jit_directory = os.path.join(correlation_payload_directory, "base") diff_jit_directory = os.path.join(correlation_payload_directory, "diff") - jit_analyze_build_directory = os.path.join(correlation_payload_directory, "jit-analyze") ######## Copy SuperPMI python scripts