name: Build Windows Artifacts on: workflow_dispatch: inputs: amdgpu_families: type: string default: gfx1151 artifact_group: type: string default: gfx1151 build_variant_label: type: string description: "A label for the build variant (ex: 'release', 'asan')" default: "release" build_variant_suffix: type: string description: "The build variant suffix (ex: 'asan' suffix -> 'gfx94X-dcgpu-asan')" default: "" build_variant_cmake_preset: type: string description: "The name of the cmake preset to use for this build variant, matching an entry in CMakePresets.json (ex: 'linux-release-asan')" default: "" package_version: type: string default: ADHOCBUILD expect_failure: type: boolean extra_cmake_options: type: string workflow_call: inputs: package_version: type: string default: ADHOCBUILD amdgpu_families: type: string artifact_group: type: string build_variant_label: type: string build_variant_suffix: type: string build_variant_cmake_preset: type: string expect_failure: type: boolean extra_cmake_options: type: string test_type: type: string permissions: contents: read jobs: build_windows_artifacts: name: Build ${{ inputs.build_variant_label }} (xfail ${{ inputs.expect_failure }}) runs-on: azure-windows-scale-rocm continue-on-error: ${{ inputs.expect_failure }} timeout-minutes: 720 # 12 hour timeout permissions: id-token: write defaults: run: shell: bash strategy: fail-fast: true env: BUILD_DIR: B:\build CACHE_DIR: "${{github.workspace}}/.cache" CCACHE_DIR: "${{github.workspace}}/.cache/ccache" CCACHE_MAXSIZE: "4000M" TEATIME_FORCE_INTERACTIVE: 0 AMDGPU_FAMILIES: ${{ inputs.amdgpu_families }} IS_PR_FROM_FORK: ${{ github.event.pull_request.head.repo.fork }} steps: - name: Checkout TheRock repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: repository: "ROCm/TheRock" ref: 'compiler/amd-staging' - name: Update Submodule Pointer to the PR if: ${{ github.event_name == 'pull_request' }} run: | git config --global --add safe.directory $PWD # Fetch the latest commit SHA from the PR branch PR_SHA=${{ github.event.pull_request.head.sha }} # Update the submodule pointer using cacheinfo git update-index --cacheinfo 160000,$PR_SHA,compiler/hipify git config --global user.email "z1-cciauto@amd.com" git config --global user.name "Z1 cciauto" git commit -m "Update submodule reference for compiler/hipify" # Verify the pointer update git submodule status git submodule - name: "Map Current Directory to a Drive" id: subst shell: cmd run: | setlocal EnableDelayedExpansion set "currentDir=%cd%" set "driveLetter=" REM Default: try L: first #L: is default to check if not exist L:\ ( set "driveLetter=L:" goto :found ) REM L: in use — find another available drive letter for %%L in (Z Y X W V U T S R Q P O N M K) do ( if not exist %%L:\ ( set "driveLetter=%%L:" goto :found ) ) echo "No available drive letter found. So exiting" >&2 exit /b 1 :found subst !driveLetter! "!currentDir!" cd /d !driveLetter! dir !driveLetter! wmic logicaldisk get name echo drive=!driveLetter!>>"%GITHUB_OUTPUT%" endlocal - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: 3.12 - name: Install python deps run: | pip install -r requirements.txt - name: Install requirements # The first two lines removes the default commmunity feed and uses the internal proxy feed run: | choco source disable -n=chocolatey choco source add -n=internal -s http://10.0.167.96:8081/repository/choco-group/ --priority=1 choco install --no-progress -y ccache # ninja pinned due to a bug in the 1.13.0 release: # https://github.com/ninja-build/ninja/issues/2616 choco install --no-progress -y ninja --version 1.12.1 choco install --no-progress -y strawberryperl echo "$PATH;C:\Strawberry\c\bin" >> $GITHUB_PATH choco install --no-progress -y awscli choco install --no-progress -y pkgconfiglite echo "$PATH;C:\Program Files\Amazon\AWSCLIV2" >> $GITHUB_PATH - uses: iterative/setup-dvc@4bdfd2b0f6f1ad7e08afadb03b1a895c352a5239 # v2.0.0 with: version: '3.62.0' # After other installs, so MSVC get priority in the PATH. - name: Configure MSVC uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - name: Runner health status run: | ccache --zero-stats python ./build_tools/health_status.py - name: Remove ununsed existing patchces run: | rm -fv patches/amd-mainline/llvm-project/0003-HACK-Handle-ROCM-installation-layout-of-lib-llvm-bin.patch rm -fv patches/amd-mainline/llvm-project/0009-Add-gcc-toolset-13-prefix-detection.patch rm -fv patches/amd-mainline/llvm-project/0001-Ensure-to-use-libamdhip64-with-major-version.patch - name: Fetch sources timeout-minutes: 30 run: | cd "${{ steps.subst.outputs.drive }}/" git config fetch.parallel 10 git config --global core.symlinks true git config --global core.longpaths true python ./build_tools/fetch_sources.py --jobs 12 - name: TheRock and llvm SHA if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} run: | git config --global --add safe.directory $PWD git log --oneline -1 ls -l compiler/amd-llvm cd compiler/amd-llvm/llvm ls -l git log --oneline -3 cd - - name: Configure PR Projects if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.test_type != 'full') }} env: cmake_preset: ${{ inputs.build_variant_cmake_preset }} amdgpu_families: ${{ inputs.amdgpu_families }} package_version: ${{ inputs.package_version }} #extra_cmake_options: ${{ inputs.extra_cmake_options }} extra_cmake_options: "-DTHEROCK_ENABLE_ALL=OFF -DTHEROCK_ENABLE_COMPILER=ON -DTHEROCK_ENABLE_HIP_RUNTIME=ON -DTHEROCK_ENABLE_PRIM=ON -DTHEROCK_ENABLE_BLAS=ON -DTHEROCK_ENABLE_RAND=ON -DTHEROCK_ENABLE_SOLVER=ON -DTHEROCK_ENABLE_SPARSE=ON -DTHEROCK_ENABLE_SYSDEPS=OFF -DTHEROCK_ENABLE_COMPOSABLE_KERNEL=OFF -DTHEROCK_ENABLE_OCL_RUNTIME=ON -DTHEROCK_ENABLE_MATH_LIBS=ON -DLLVM_SMREV_REPO='' -DLLVM_SMREV_REVISION=''" run: | cd "${{ steps.subst.outputs.drive }}/" # clear cache before build and after download ccache -z python3 build_tools/github_actions/build_configure.py - name: Configure All Projects if: ${{ github.event_name != 'pull_request' && inputs.test_type == 'full' }} env: cmake_preset: ${{ inputs.build_variant_cmake_preset }} amdgpu_families: ${{ inputs.amdgpu_families }} package_version: ${{ inputs.package_version }} extra_cmake_options: ${{ inputs.extra_cmake_options }} run: | # clear cache before build and after download cd "${{ steps.subst.outputs.drive }}/" ccache -z cmake -B "B:\build" -GNinja -S "${{ steps.subst.outputs.drive }}/" --preset windows-release -DTHEROCK_AMDGPU_FAMILIES=gfx1151 "-DCMAKE_C_COMPILER=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207/bin/Hostx64/x64/cl.exe" "-DCMAKE_CXX_COMPILER=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207/bin/Hostx64/x64/cl.exe" "-DCMAKE_LINKER=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207/bin/Hostx64/x64/link.exe" -DTHEROCK_BACKGROUND_BUILD_JOBS=4 - name: Build therock-archives and therock-dist run: | cd "${{ steps.subst.outputs.drive }}/" cmake --build "${{ env.BUILD_DIR }}" --target therock-archives therock-dist -- -j32 - name: Report if: ${{ !cancelled() }} shell: bash run: | if [ -d "${{ env.BUILD_DIR }}" ]; then echo "Build dir:" echo "------------" ls -lh "${{ env.BUILD_DIR }}" echo "Artifact Archives:" echo "------------------" ls -lh "${{ env.BUILD_DIR }}"/artifacts/*.tar.xz echo "Artifacts:" echo "----------" du -h -d 1 "${{ env.BUILD_DIR }}"/artifacts echo "CCache Stats:" echo "-------------" ccache -s else echo "[ERROR] Build directory ${{ env.BUILD_DIR }} does not exist. Skipping report!" echo " This should only happen if the CI is cancelled before the build step." exit 1 fi - name: "Build size report" if: always() shell: powershell run: | $fs = Get-PSDrive -PSProvider "FileSystem" $fsout = $fs | Select-Object -Property Name,Used,Free,Root $fsout | % {$_.Used/=1GB;$_.Free/=1GB;$_} | Write-Host get-disk | Select-object @{Name="Size(GB)";Expression={$_.Size/1GB}} | Write-Host - name: Configure AWS Credentials if: ${{ github.repository == 'ROCm/TheRock' }} uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1 with: aws-region: us-east-2 role-to-assume: arn:aws:iam::692859939525:role/therock-ci-external special-characters-workaround: true - name: Post Build Upload if: always() run: | python3 build_tools/github_actions/post_build_upload.py \ --run-id ${{ github.run_id }} \ --artifact-group ${{ inputs.artifact_group }} \ --build-dir ${{ env.BUILD_DIR }} \ --upload - name: Remove Drive Substitution if: always() && steps.subst.outcome == 'success' shell: cmd run: | REM Remove the drive mapping subst ${{ steps.subst.outputs.drive }} /D