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..55bc83e4d74a96 --- /dev/null +++ b/eng/pipelines/coreclr/jitstress-isas-avx512.yml @@ -0,0 +1,62 @@ +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: + # 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 + 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: + # Current Linux and OSX x64 pipelines do not have machines which support AVX-512. + # - 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..347492cd630c0e 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 -// otherwise use VEX encoding but can be EVEX encoded to use EVEX encoding -// This requires AVX512VL support. -#ifdef DEBUG +#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. + + 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..707c0cf7d09fb9 100644 --- a/src/coreclr/jit/jitconfigvalues.h +++ b/src/coreclr/jit/jitconfigvalues.h @@ -300,8 +300,10 @@ 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 @@ +