From dfaa356813d4b97abefe59c982c7ad4e21f34cf7 Mon Sep 17 00:00:00 2001 From: cpplearner Date: Sat, 10 May 2025 20:56:55 +0800 Subject: [PATCH 01/11] Restore `targetPlatform` --- azure-devops/asan-pipeline.yml | 2 ++ azure-devops/build-and-test.yml | 6 +++++- azure-devops/cmake-configure-build.yml | 2 ++ azure-devops/run-tests.yml | 6 ++++-- azure-pipelines.yml | 8 ++++++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/azure-devops/asan-pipeline.yml b/azure-devops/asan-pipeline.yml index f98953de548..bf3a2148c57 100644 --- a/azure-devops/asan-pipeline.yml +++ b/azure-devops/asan-pipeline.yml @@ -26,6 +26,7 @@ stages: parameters: hostArch: x64 targetArch: x64 + targetPlatform: x64 asanBuild: true testTargets: STL-ASan-CI @@ -40,6 +41,7 @@ stages: parameters: hostArch: x86 targetArch: x86 + targetPlatform: x86 asanBuild: true testTargets: STL-ASan-CI diff --git a/azure-devops/build-and-test.yml b/azure-devops/build-and-test.yml index edc9134cd93..a90c7c2f382 100644 --- a/azure-devops/build-and-test.yml +++ b/azure-devops/build-and-test.yml @@ -6,6 +6,8 @@ parameters: type: string - name: targetArch type: string +- name: targetPlatform + type: string - name: analyzeBuild type: boolean default: false @@ -28,7 +30,7 @@ parameters: type: boolean default: false jobs: -- job: '${{ parameters.targetArch }}' +- job: '${{ parameters.targetPlatform }}' strategy: parallel: ${{ parameters.numShards }} timeoutInMinutes: 30 @@ -53,6 +55,7 @@ jobs: parameters: hostArch: ${{ parameters.hostArch }} targetArch: ${{ parameters.targetArch }} + targetPlatform: ${{ parameters.targetPlatform }} analyzeBuild: ${{ parameters.analyzeBuild }} asanBuild: ${{ parameters.asanBuild }} buildBenchmarks: ${{ parameters.buildBenchmarks }} @@ -61,5 +64,6 @@ jobs: parameters: hostArch: ${{ parameters.hostArch }} targetArch: ${{ parameters.targetArch }} + targetPlatform: ${{ parameters.targetPlatform }} testTargets: ${{ parameters.testTargets }} skipTesting: ${{ parameters.skipTesting }} diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index dec0d987f71..897f2968f3f 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -6,6 +6,8 @@ parameters: type: string - name: targetArch type: string +- name: targetPlatform + type: string - name: analyzeBuild type: boolean - name: asanBuild diff --git a/azure-devops/run-tests.yml b/azure-devops/run-tests.yml index a6e2c1363d3..aba67bc3e87 100644 --- a/azure-devops/run-tests.yml +++ b/azure-devops/run-tests.yml @@ -6,6 +6,8 @@ parameters: type: string - name: targetArch type: string +- name: targetPlatform + type: string - name: testTargets type: string - name: skipTesting @@ -28,8 +30,8 @@ steps: searchFolder: $(buildOutputLocation) testResultsFormat: JUnit testResultsFiles: '**/test-results.xml' - testRunTitle: 'test-${{ parameters.targetArch }}-$(System.JobPositionInPhase)' + testRunTitle: 'test-${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)' - publish: $(buildOutputLocation)/test-results.xml - artifact: '${{ parameters.targetArch }}-$(System.JobPositionInPhase)-xml-$(System.JobId)' + artifact: '${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)-xml-$(System.JobId)' condition: and(failed(), not(${{ parameters.skipTesting }})) displayName: 'Publish XML Artifact' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3941274d57a..b888e9b090f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,6 +29,7 @@ stages: parameters: hostArch: x64 targetArch: x64 + targetPlatform: x64 analyzeBuild: true buildBenchmarks: true numShards: 1 @@ -45,6 +46,7 @@ stages: parameters: hostArch: x86 targetArch: x86 + targetPlatform: x86 analyzeBuild: true buildBenchmarks: true numShards: 1 @@ -61,6 +63,7 @@ stages: parameters: hostArch: x64 targetArch: arm + targetPlatform: armv7 analyzeBuild: true numShards: 1 skipTesting: true @@ -76,6 +79,7 @@ stages: parameters: hostArch: x64 targetArch: arm64 + targetPlatform: arm64 analyzeBuild: true buildBenchmarks: true numShards: 1 @@ -97,6 +101,7 @@ stages: parameters: hostArch: x64 targetArch: x64 + targetPlatform: x64 - stage: Build_And_Test_x86 dependsOn: Build_And_Test_x64 @@ -109,6 +114,7 @@ stages: parameters: hostArch: x86 targetArch: x86 + targetPlatform: x86 - stage: Build_And_Test_ARM dependsOn: Build_And_Test_x64 @@ -121,6 +127,7 @@ stages: parameters: hostArch: x64 targetArch: arm + targetPlatform: armv7 testsBuildOnly: true - stage: Build_And_Test_ARM64 @@ -134,4 +141,5 @@ stages: parameters: hostArch: x64 targetArch: arm64 + targetPlatform: arm64 testsBuildOnly: true From dfe69bf3c6edf9b53f91b358a7567e5698fbfedb Mon Sep 17 00:00:00 2001 From: cpplearner Date: Sat, 10 May 2025 21:27:55 +0800 Subject: [PATCH 02/11] Pass `VCLIBS_TARGET_ARCHITECTURE` to CMake --- azure-devops/cmake-configure-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index 897f2968f3f..39d27169841 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -38,6 +38,7 @@ steps: -DSTL_USE_ANALYZE=${{ parameters.analyzeBuild }} ^ -DSTL_ASAN_BUILD=${{ parameters.asanBuild }} ^ -DTESTS_BUILD_ONLY=${{ parameters.testsBuildOnly }} ^ + -DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^ -S $(Build.SourcesDirectory) -B "$(buildOutputLocation)" displayName: 'Configure the STL' timeoutInMinutes: 2 @@ -59,6 +60,7 @@ steps: -DCMAKE_CXX_COMPILER=cl ^ -DCMAKE_BUILD_TYPE=Release ^ -DSTL_BINARY_DIR="$(buildOutputLocation)" ^ + -DVCLIBS_TARGET_ARCHITECTURE=${{ parameters.targetPlatform }} ^ -S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)" displayName: 'Configure the benchmarks' timeoutInMinutes: 2 From 7f0e07960d0ab7151352c7c50b21ecb40dcbc853 Mon Sep 17 00:00:00 2001 From: cpplearner Date: Sat, 10 May 2025 22:33:15 +0800 Subject: [PATCH 03/11] Add "Early Build ARM64EC" --- azure-pipelines.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b888e9b090f..d70b2180e66 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# Build STL targeting x86, x64, arm, arm64 +# Build STL targeting x86, x64, arm, arm64, arm64ec variables: - template: azure-devops/config.yml @@ -85,6 +85,22 @@ stages: numShards: 1 skipTesting: true + - stage: Early_Build_ARM64EC + dependsOn: [] + displayName: 'Early Build ARM64EC' + pool: + name: ${{ variables.poolName }} + demands: ${{ variables.poolDemands }} + jobs: + - template: azure-devops/build-and-test.yml + parameters: + hostArch: x64 + targetArch: arm64 + targetPlatform: arm64ec + analyzeBuild: true + numShards: 1 + skipTesting: true + - stage: Build_And_Test_x64 dependsOn: - Code_Format From 43f73ae223e74e504a52c111e28986db899f90d9 Mon Sep 17 00:00:00 2001 From: "S. B. Tam" Date: Sun, 11 May 2025 18:40:15 +0800 Subject: [PATCH 04/11] Do not pass `analyzeBuild` for ARM64EC --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d70b2180e66..0d810b1ba8d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -97,7 +97,6 @@ stages: hostArch: x64 targetArch: arm64 targetPlatform: arm64ec - analyzeBuild: true numShards: 1 skipTesting: true From fbebe8d2eb927d8c898aaa6ed599b3778fc1fdad Mon Sep 17 00:00:00 2001 From: "S. B. Tam" Date: Sun, 11 May 2025 19:43:15 +0800 Subject: [PATCH 05/11] Link against `softintrin.lib` when targeting ARM64/ARM64EC --- stl/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index 10d21b3173c..73830b2d022 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -507,6 +507,9 @@ function(add_stl_dlls D_SUFFIX REL_OR_DBG) add_library(msvcp${D_SUFFIX} SHARED) target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib") + if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64(ec)?$") + target_link_libraries(msvcp${D_SUFFIX} PRIVATE "softintrin.lib") + endif() set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_base${D_SUFFIX}${VCLIBS_SUFFIX}") set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") set_target_properties(msvcp${D_SUFFIX} PROPERTIES OUTPUT_NAME "msvcp140${D_SUFFIX}${VCLIBS_SUFFIX}") From 8cc6a921d0a95df2d170376d0ca3a908b867bb6a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 May 2025 00:05:41 -0700 Subject: [PATCH 06/11] Suppress warning C28301 when building for ARM64EC with /analyze. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f66dc08858f..1f22c808d63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,12 @@ if(STL_USE_ANALYZE) # LPARAM is a LONG_PTR (intptr_t), and it's invalid to apply _In_opt_ to a non-pointer. # As of the Windows 11 SDK (10.0.22621.0), there are 5 total occurrences of warning C6553 affecting the STL's build. add_compile_options("$<$:/analyze:autolog-;/wd6553>") + + if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec") + # TRANSITION, the Windows SDK emits "warning C28301: No annotations for first declaration of 'meow'" + # for various intrinsics when building for ARM64EC. + add_compile_options("$<$:/wd28301>") + endif() endif() set(VCLIBS_DEBUG_OPTIONS "$<$:/Od>") From 1e5ef50738871e1e512569fdee0ce434ea1997c0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 May 2025 00:07:24 -0700 Subject: [PATCH 07/11] Revert "Do not pass `analyzeBuild` for ARM64EC" This reverts commit 43f73ae223e74e504a52c111e28986db899f90d9. --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0d810b1ba8d..d70b2180e66 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -97,6 +97,7 @@ stages: hostArch: x64 targetArch: arm64 targetPlatform: arm64ec + analyzeBuild: true numShards: 1 skipTesting: true From fd47152ec2b33dc70000520d6752d06ff3475ba1 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 May 2025 00:32:00 -0700 Subject: [PATCH 08/11] Treat "arm" and "armv7" as synonyms. --- CMakeLists.txt | 2 +- azure-pipelines.yml | 4 ++-- benchmarks/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f22c808d63..4ec139869f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64") set(VCLIBS_I386_OR_AMD64 "amd64") set(VCLIBS_X86_OR_X64 "x64") add_compile_definitions(_AMD64_ _VCRT_WIN32_WINNT=0x0501 _STL_WIN32_WINNT=0x0501) -elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "armv7") +elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(arm|armv7)$") set(VCLIBS_TARGET_ARCHITECTURE "arm") set(VCLIBS_I386_OR_AMD64 "arm") set(VCLIBS_X86_OR_X64 "arm") diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d70b2180e66..a695b5b1325 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,7 +63,7 @@ stages: parameters: hostArch: x64 targetArch: arm - targetPlatform: armv7 + targetPlatform: arm analyzeBuild: true numShards: 1 skipTesting: true @@ -143,7 +143,7 @@ stages: parameters: hostArch: x64 targetArch: arm - targetPlatform: armv7 + targetPlatform: arm testsBuildOnly: true - stage: Build_And_Test_ARM64 diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 04e47486df5..daba9e97649 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -23,7 +23,7 @@ if(DEFINED STL_BINARY_DIR) set(VCLIBS_I386_OR_AMD64 "i386") elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64") set(VCLIBS_I386_OR_AMD64 "amd64") - elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "armv7") + elseif(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(arm|armv7)$") set(VCLIBS_I386_OR_AMD64 "arm") elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64") set(VCLIBS_I386_OR_AMD64 "arm64") From dfc054c8fb238863c050b97ff5ca8ba3828d5d65 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 May 2025 00:34:55 -0700 Subject: [PATCH 09/11] Rephrase regex to be search-friendly. --- stl/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index 73830b2d022..e58bb2defbd 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -507,7 +507,7 @@ function(add_stl_dlls D_SUFFIX REL_OR_DBG) add_library(msvcp${D_SUFFIX} SHARED) target_link_libraries(msvcp${D_SUFFIX} PRIVATE msvcp${D_SUFFIX}_eha_objects msvcp${D_SUFFIX}_objects msvcp${D_SUFFIX}_init_objects "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib") - if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^arm64(ec)?$") + if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(arm64|arm64ec)$") target_link_libraries(msvcp${D_SUFFIX} PRIVATE "softintrin.lib") endif() set_target_properties(msvcp${D_SUFFIX} PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_base${D_SUFFIX}${VCLIBS_SUFFIX}") From 09429c4639a17c5b56bfe83144b53ff2bb4ecff8 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 May 2025 00:36:34 -0700 Subject: [PATCH 10/11] Unrelated cleanup: Consistently match x86 or x64. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ec139869f6..f798eb7d059 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ endif() string(TOLOWER "${VCLIBS_TARGET_ARCHITECTURE}" VCLIBS_TARGET_ARCHITECTURE) -if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^x64$|^x86$") +if(VCLIBS_TARGET_ARCHITECTURE MATCHES "^(x86|x64)$") enable_language(ASM_MASM) endif() From 83b7f2b828990f976c84e66d226ce1fb861c8858 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 14 May 2025 00:53:01 -0700 Subject: [PATCH 11/11] Early_Build_ARM64EC should be a dependency of Build_And_Test_x64. --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a695b5b1325..1f8c6505343 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -108,6 +108,7 @@ stages: - Early_Build_x86 - Early_Build_ARM - Early_Build_ARM64 + - Early_Build_ARM64EC displayName: 'Build and Test x64' pool: name: ${{ variables.poolName }}