From c8a38e0687d09c4be729d29871e1a368aa9099a8 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Fri, 4 Nov 2022 16:13:58 -0700 Subject: [PATCH 1/3] Add AVX-512 testing pipeline Introduce DOTNET_JitForceEVEXEncoding to force EVEX encoding when possible. This will fail when not an an AVX-512 capable machine, by design (to know we are properly testing on capable machines). Current pipeline definition only runs coreclr tests with JitForceEVEXEncoding set. Currently defined to automatically trigger when one of the JIT files instrsxarch.h, emitxarch.cpp, or emitxarch.h are changed, as it is expected these will be changed frequently as the AVX-512 feature is implemented. It is also expected this will be manually triggered as appropriate. Eventually, this pipeline will be removed and tests folded into the existing jitstress-isas-x86 pipeline. --- .../templates/runtimes/run-test-job.yml | 7 ++- .../coreclr/jitstress-isas-avx512.yml | 60 +++++++++++++++++++ src/coreclr/jit/compiler.h | 25 ++++++-- src/coreclr/jit/jitconfigvalues.h | 5 +- src/tests/Common/testenvironment.proj | 2 + 5 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 eng/pipelines/coreclr/jitstress-isas-avx512.yml diff --git a/eng/pipelines/common/templates/runtimes/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml index da6d2bf83874c2..c8e3b9e90b59a0 100644 --- a/eng/pipelines/common/templates/runtimes/run-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml @@ -212,7 +212,7 @@ jobs: # gc reliability may take up to 2 hours to shutdown. Some scenarios have very long iteration times. - name: timeoutPerTestInMinutes value: 240 - - ${{ if in(parameters.testGroup, 'jitstress', 'jitstress-random', 'jitstress-isas-arm', 'jitstress-isas-x86', 'jitstressregs-x86', 'jitstressregs', 'jitstress2-jitstressregs', 'jitelthookenabled' ) }}: + - ${{ if in(parameters.testGroup, 'jitstress', 'jitstress-random', 'jitstress-isas-arm', 'jitstress-isas-x86', 'jitstress-isas-avx512', 'jitstressregs-x86', 'jitstressregs', 'jitstress2-jitstressregs', 'jitelthookenabled' ) }}: - name: timeoutPerTestCollectionInMinutes value: 120 - name: timeoutPerTestInMinutes @@ -268,7 +268,7 @@ jobs: timeoutInMinutes: 390 ${{ if in(parameters.testGroup, 'gcstress-extra', 'r2r-extra', 'clrinterpreter', 'pgo', 'pgostress', 'jit-experimental') }}: timeoutInMinutes: 510 - ${{ if eq(parameters.testGroup, 'jitstress-isas-x86') }}: + ${{ if in(parameters.testGroup, 'jitstress-isas-x86', 'jitstress-isas-avx512') }}: timeoutInMinutes: 960 steps: @@ -525,6 +525,9 @@ jobs: - jitstress_isas_2_x86_nosse41 - jitstress_isas_2_x86_nosse42 - jitstress_isas_2_x86_nossse3 + ${{ if in(parameters.testGroup, 'jitstress-isas-avx512') }}: + scenarios: + - jitstress_isas_avx512_forceevex ${{ if in(parameters.testGroup, 'jitstressregs-x86') }}: scenarios: - jitstressregs1_x86_noavx diff --git a/eng/pipelines/coreclr/jitstress-isas-avx512.yml b/eng/pipelines/coreclr/jitstress-isas-avx512.yml new file mode 100644 index 00000000000000..2716acf49f6472 --- /dev/null +++ b/eng/pipelines/coreclr/jitstress-isas-avx512.yml @@ -0,0 +1,60 @@ +trigger: + batch: false + branches: + include: + - main + paths: + include: + - src/coreclr/jit/instrsxarch.h + - src/coreclr/jit/emitxarch.cpp + - src/coreclr/jit/emitxarch.h + +schedules: +- cron: "30 19 * * 6" + displayName: Sat at 11:30 AM (UTC-8:00) + branches: + include: + - main + always: true + +extends: + template: /eng/pipelines/common/templates/single-stage-pipeline-with-resources.yml + parameters: + jobs: + + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/build-coreclr-and-libraries-job.yml + buildConfig: checked + platforms: + - Linux_x64 + - OSX_x64 + - windows_x64 + - windows_x86 + - CoreClrTestBuildHost # Either OSX_x64 or Linux_x64 + jobParameters: + testGroup: jitstress-isas-avx512 + + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml + buildConfig: checked + platforms: + - CoreClrTestBuildHost # Either OSX_x64 or Linux_x64 + jobParameters: + testGroup: jitstress-isas-avx512 + + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml + buildConfig: checked + platforms: + - Linux_x64 + - OSX_x64 + - windows_x64 + - windows_x86 + helixQueueGroup: ci + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + jobParameters: + testGroup: jitstress-isas-avx512 + liveLibrariesBuildConfig: Release diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 193399040296a3..6516bb4cb76a09 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -8999,6 +8999,14 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX bool canUseEvexEncoding() const { #ifdef TARGET_XARCH + +#ifdef DEBUG + if (JitConfig.JitForceEVEXEncoding()) + { + return true; + } +#endif // DEBUG + return compOpportunisticallyDependsOn(InstructionSet_AVX512F); #else return false; @@ -9013,17 +9021,22 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // bool DoJitStressEvexEncoding() const { -#ifdef TARGET_XARCH -// Using JitStressEvexEncoding flag will force instructions which would +#if defined(TARGET_XARCH) && defined(DEBUG) +// Using JitStressEVEXEncoding flag will force instructions which would // otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding -// This requires AVX512VL support. -#ifdef DEBUG +// This requires AVX512VL support. JitForceEVEXEncoding forces this encoding, thus +// causing failure if not running on compatible hardware. + + if (JitConfig.JitForceEVEXEncoding()) + { + return true; + } if (JitConfig.JitStressEvexEncoding() && compOpportunisticallyDependsOn(InstructionSet_AVX512F_VL)) { return true; } -#endif // DEBUG -#endif // TARGET_XARCH +#endif // TARGET_XARCH && DEBUG + return false; } diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index 2f337078a71de7..61bdd4ae33aa7e 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -300,8 +300,9 @@ CONFIG_INTEGER(EnableEHWriteThru, W("EnableEHWriteThru"), 1) // Enable the regis CONFIG_INTEGER(EnableMultiRegLocals, W("EnableMultiRegLocals"), 1) // Enable the enregistration of locals that are // defined or used in a multireg context. #if defined(DEBUG) -CONFIG_INTEGER(JitStressEvexEncoding, W("JitStressEvexEncoding"), 0) // Enable EVEX encoding for SIMD instructions. -#endif // DEBUG // DEBUG +CONFIG_INTEGER(JitStressEvexEncoding, W("JitStressEvexEncoding"), 0) // Enable EVEX encoding for SIMD instructions when AVX-512VL is available. +CONFIG_INTEGER(JitForceEVEXEncoding, W("JitForceEVEXEncoding"), 0) // Force EVEX encoding for SIMD instructions. +#endif // clang-format off diff --git a/src/tests/Common/testenvironment.proj b/src/tests/Common/testenvironment.proj index 27e14c6c3194c9..b80b236966cf88 100644 --- a/src/tests/Common/testenvironment.proj +++ b/src/tests/Common/testenvironment.proj @@ -35,6 +35,7 @@ DOTNET_EnableSSE41; DOTNET_EnableSSE42; DOTNET_EnableSSSE3; + DOTNET_JitForceEVEXEncoding; DOTNET_ForceRelocs; DOTNET_GCStress; DOTNET_GCName; @@ -151,6 +152,7 @@ + From 13adcab17eb348d1335f8b01fea050c5c8acea54 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Fri, 4 Nov 2022 17:43:14 -0700 Subject: [PATCH 2/3] Formatting --- src/coreclr/jit/compiler.h | 8 ++++---- src/coreclr/jit/jitconfigvalues.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 6516bb4cb76a09..347492cd630c0e 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -9022,10 +9022,10 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX bool DoJitStressEvexEncoding() const { #if defined(TARGET_XARCH) && defined(DEBUG) -// Using JitStressEVEXEncoding flag will force instructions which would -// otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding -// This requires AVX512VL support. JitForceEVEXEncoding forces this encoding, thus -// causing failure if not running on compatible hardware. + // Using JitStressEVEXEncoding flag will force instructions which would + // otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding + // This requires AVX512VL support. JitForceEVEXEncoding forces this encoding, thus + // causing failure if not running on compatible hardware. if (JitConfig.JitForceEVEXEncoding()) { diff --git a/src/coreclr/jit/jitconfigvalues.h b/src/coreclr/jit/jitconfigvalues.h index 61bdd4ae33aa7e..707c0cf7d09fb9 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -300,8 +300,9 @@ CONFIG_INTEGER(EnableEHWriteThru, W("EnableEHWriteThru"), 1) // Enable the regis CONFIG_INTEGER(EnableMultiRegLocals, W("EnableMultiRegLocals"), 1) // Enable the enregistration of locals that are // defined or used in a multireg context. #if defined(DEBUG) -CONFIG_INTEGER(JitStressEvexEncoding, W("JitStressEvexEncoding"), 0) // Enable EVEX encoding for SIMD instructions when AVX-512VL is available. -CONFIG_INTEGER(JitForceEVEXEncoding, W("JitForceEVEXEncoding"), 0) // Force EVEX encoding for SIMD instructions. +CONFIG_INTEGER(JitStressEvexEncoding, W("JitStressEvexEncoding"), 0) // Enable EVEX encoding for SIMD instructions when + // AVX-512VL is available. +CONFIG_INTEGER(JitForceEVEXEncoding, W("JitForceEVEXEncoding"), 0) // Force EVEX encoding for SIMD instructions. #endif // clang-format off From c1d76291ec56d5940281770fa1a04e9f61647939 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Mon, 7 Nov 2022 15:11:37 -0800 Subject: [PATCH 3/3] Disable Linux and OSX testing Those OSes currently do not have AVX-512 capable machines in our test lab. --- eng/pipelines/coreclr/jitstress-isas-avx512.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/coreclr/jitstress-isas-avx512.yml b/eng/pipelines/coreclr/jitstress-isas-avx512.yml index 2716acf49f6472..55bc83e4d74a96 100644 --- a/eng/pipelines/coreclr/jitstress-isas-avx512.yml +++ b/eng/pipelines/coreclr/jitstress-isas-avx512.yml @@ -27,8 +27,9 @@ extends: jobTemplate: /eng/pipelines/common/build-coreclr-and-libraries-job.yml buildConfig: checked platforms: - - Linux_x64 - - OSX_x64 + # Current Linux and OSX x64 pipelines do not have machines which support AVX-512. + # - Linux_x64 + # - OSX_x64 - windows_x64 - windows_x86 - CoreClrTestBuildHost # Either OSX_x64 or Linux_x64 @@ -49,8 +50,9 @@ extends: jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml buildConfig: checked platforms: - - Linux_x64 - - OSX_x64 + # Current Linux and OSX x64 pipelines do not have machines which support AVX-512. + # - Linux_x64 + # - OSX_x64 - windows_x64 - windows_x86 helixQueueGroup: ci