You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
455 lines
14 KiB
455 lines
14 KiB
# MIT License |
|
# |
|
# Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All rights reserved. |
|
# |
|
# Permission is hereby granted, free of charge, to any person obtaining a copy |
|
# of this software and associated documentation files (the "Software"), to deal |
|
# in the Software without restriction, including without limitation the rights |
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
# copies of the Software, and to permit persons to whom the Software is |
|
# furnished to do so, subject to the following conditions: |
|
# |
|
# The above copyright notice and this permission notice shall be included in all |
|
# copies or substantial portions of the Software. |
|
# |
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
# SOFTWARE. |
|
|
|
include: |
|
- project: 'amd/ci-templates' |
|
ref: main |
|
file: |
|
- /defaults.yaml |
|
- /gpus-rocm.yaml |
|
- /gpus-nvcc.yaml |
|
- /rules.yaml |
|
|
|
variables: |
|
# Temporary suppress warnings due to nvidia_hip_runtime_api bug |
|
CUDA_WARNING_SUPPRESS_FLAGS: ",-Wno-missing-field-initializers,-Wno-deprecated-declarations,-Wno-sign-compare,-Wno-return-local-addr -diag-suppress=1056" |
|
CUDA_FLAGS: "-Xcompiler -Wall,-Wextra,-Werror${CUDA_WARNING_SUPPRESS_FLAGS} --Werror all-warnings" |
|
# We require '-Wno-unused-command-line-argument' due to the following warning: |
|
# argument unused during compilation: '--rtlib=compiler-rt' |
|
CXX_FLAGS: "-Wno-unused-command-line-argument -Wall -Wextra -Werror" |
|
HIP_FLAGS: "-Wno-unused-command-line-argument -Wall -Wextra -Werror" |
|
# Keep in sync with ROCM_VERSION in Dockerfiles/hip-libraries-cuda-ubuntu.Dockerfile |
|
# and Dockerfiles/hip-libraries-rocm-ubuntu.Dockerfile |
|
DOCKER_ROCM_VERSION: 6.2.0 |
|
DOCKER_HIP_LIBRARIES_ROCM_TAG: rocm-ubuntu-${DOCKER_ROCM_VERSION} |
|
DOCKER_HIP_LIBRARIES_CUDA_TAG: cuda-ubuntu-${DOCKER_ROCM_VERSION} |
|
DOCKER_HIP_LIBRARIES_ROCM: $DOCKER_TAG_PREFIX:$DOCKER_HIP_LIBRARIES_ROCM_TAG |
|
DOCKER_HIP_LIBRARIES_CUDA: $DOCKER_TAG_PREFIX:$DOCKER_HIP_LIBRARIES_CUDA_TAG |
|
|
|
stages: |
|
- lint |
|
- build |
|
- test |
|
|
|
clang-format: |
|
image: $DOCKER_HIP_LIBRARIES_ROCM |
|
stage: lint |
|
needs: [] |
|
tags: |
|
- build |
|
variables: |
|
CLANG_FORMAT: "/opt/rocm/llvm/bin/clang-format" |
|
GIT_CLANG_FORMAT: "/opt/rocm/llvm/bin/git-clang-format" |
|
rules: |
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' |
|
script: |
|
- cd $CI_PROJECT_DIR |
|
- git config --global --add safe.directory $CI_PROJECT_DIR |
|
- Scripts/CodeFormat/check_format.sh $CI_MERGE_REQUEST_DIFF_BASE_SHA --binary "$CLANG_FORMAT" |
|
|
|
copyright-date: |
|
image: $DOCKER_HIP_LIBRARIES_ROCM |
|
stage: lint |
|
needs: [] |
|
tags: |
|
- build |
|
rules: |
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' |
|
script: |
|
- cd $CI_PROJECT_DIR |
|
- git config --global --add safe.directory $CI_PROJECT_DIR |
|
- Scripts/CopyrightDate/check_copyright.sh -v -d $CI_MERGE_REQUEST_DIFF_BASE_SHA |
|
|
|
check-vs-files: |
|
image: $DOCKER_TAG_PREFIX:rocm-ubuntu |
|
stage: lint |
|
needs: [] |
|
tags: |
|
- build |
|
rules: |
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' |
|
script: |
|
- cd $CI_PROJECT_DIR |
|
- git config --global --add safe.directory $CI_PROJECT_DIR |
|
- sudo apt-get update |
|
- sudo apt-get install -y python3-pip |
|
- python3 -m pip install rich |
|
- Scripts/VisualStudio/check_vs_files.py |
|
|
|
.build:dockerfiles: |
|
timeout: 60m |
|
image: |
|
name: gcr.io/kaniko-project/executor:debug |
|
entrypoint: [""] |
|
stage: build |
|
needs: [] |
|
tags: |
|
- build |
|
script: |
|
- mkdir -p /kaniko/.docker |
|
- echo "${DOCKER_AUTH_CONFIG}" > /kaniko/.docker/config.json |
|
- if [ "$CI_COMMIT_BRANCH" != "$CI_DEFAULT_BRANCH" ]; then NO_PUSH="--no-push"; fi; |
|
- >- |
|
/kaniko/executor |
|
--context "${CI_PROJECT_DIR}/Dockerfiles" |
|
--dockerfile "${CI_PROJECT_DIR}/Dockerfiles/${DOCKERFILE}" |
|
--destination "docker.io/${DOCKER_TAG_PREFIX}:${TAG}" |
|
${NO_PUSH} |
|
rules: |
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' |
|
changes: |
|
- Dockerfiles/hip-libraries-${TAG}.Dockerfile |
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH |
|
changes: |
|
- Dockerfiles/hip-libraries-${TAG}.Dockerfile |
|
|
|
build:rocm-ubuntu-dockerfile: |
|
extends: |
|
- .build:dockerfiles |
|
variables: |
|
DOCKERFILE: hip-libraries-rocm-ubuntu.Dockerfile |
|
TAG: $DOCKER_HIP_LIBRARIES_ROCM_TAG |
|
|
|
build:cuda-ubuntu-dockerfile: |
|
extends: |
|
- .build:dockerfiles |
|
variables: |
|
DOCKERFILE: hip-libraries-cuda-ubuntu.Dockerfile |
|
TAG: $DOCKER_HIP_LIBRARIES_CUDA_TAG |
|
|
|
######################## |
|
# Ubuntu make # |
|
######################## |
|
|
|
build:make-rocm: |
|
image: $DOCKER_HIP_LIBRARIES_ROCM |
|
stage: build |
|
extends: |
|
- .rules:build |
|
tags: |
|
- build |
|
needs: [] |
|
script: |
|
- cd $CI_PROJECT_DIR && make CXXFLAGS="$HIP_FLAGS" -j $(nproc) |
|
|
|
build:make-cuda: |
|
image: $DOCKER_HIP_LIBRARIES_CUDA |
|
stage: build |
|
extends: |
|
- .rules:build |
|
tags: |
|
- build |
|
needs: [] |
|
script: |
|
- cd $CI_PROJECT_DIR && make CXXFLAGS="$CUDA_FLAGS" GPU_RUNTIME=CUDA -j $(nproc) |
|
|
|
######################## |
|
# Ubuntu cmake # |
|
######################## |
|
|
|
.build:cmake: |
|
stage: build |
|
extends: |
|
- .rules:build |
|
needs: [] |
|
artifacts: |
|
paths: |
|
- $CI_PROJECT_DIR/build |
|
|
|
build:cmake-rocm: |
|
image: $DOCKER_HIP_LIBRARIES_ROCM |
|
extends: |
|
- .build:cmake |
|
- .gpus:rocm-gpus |
|
tags: |
|
- build |
|
script: |
|
- cmake |
|
-S $CI_PROJECT_DIR |
|
-B $CI_PROJECT_DIR/build |
|
-D CMAKE_HIP_ARCHITECTURES="$GPU_TARGETS" |
|
-D CMAKE_CXX_FLAGS="$CXX_FLAGS" |
|
-D CMAKE_HIP_FLAGS="$HIP_FLAGS" |
|
2>&1 | tee cmake_log.txt |
|
# check if all dependencies were found |
|
- |- |
|
if grep -qi "could not find" cmake_log.txt; then |
|
echo "Some CMake libraries could not be found" |
|
exit 1 |
|
fi |
|
- cmake --build $CI_PROJECT_DIR/build |
|
- cmake --install $CI_PROJECT_DIR/build --prefix $CI_PROJECT_DIR/install |
|
|
|
build:cmake-cuda: |
|
image: $DOCKER_HIP_LIBRARIES_CUDA |
|
extends: |
|
- .build:cmake |
|
tags: |
|
- build |
|
script: |
|
- cmake |
|
-S $CI_PROJECT_DIR |
|
-B $CI_PROJECT_DIR/build |
|
-D GPU_RUNTIME=CUDA |
|
-D CMAKE_CXX_FLAGS="$CXX_FLAGS" |
|
-D CMAKE_CUDA_FLAGS="$CUDA_FLAGS" |
|
-D CMAKE_MODULE_PATH=/opt/rocm/lib/cmake/hip |
|
2>&1 | tee cmake_log.txt |
|
# check if all dependencies were found |
|
- |- |
|
if grep -qi "could not find" cmake_log.txt; then |
|
echo "Some CMake libraries could not be found" |
|
exit 1 |
|
fi |
|
- cmake --build $CI_PROJECT_DIR/build |
|
- cmake --install $CI_PROJECT_DIR/build --prefix $CI_PROJECT_DIR/install |
|
|
|
######################## |
|
# Ubuntu Tests # |
|
######################## |
|
|
|
.test: |
|
stage: test |
|
extends: |
|
- .rules:test |
|
script: |
|
- cd $CI_PROJECT_DIR/build && ctest --output-on-failure --parallel 8 |
|
|
|
test:rocm: |
|
image: $DOCKER_HIP_LIBRARIES_ROCM |
|
extends: |
|
- .test |
|
- .gpus:rocm |
|
needs: |
|
- build:cmake-rocm |
|
|
|
test:cuda: |
|
image: $DOCKER_HIP_LIBRARIES_CUDA |
|
extends: |
|
- .test |
|
- .gpus:nvcc |
|
before_script: |
|
- export HIP_COMPILER=nvcc |
|
- export HIP_PLATFORM=nvidia |
|
- export HIP_RUNTIME=cuda |
|
needs: |
|
- build:cmake-cuda |
|
|
|
######################## |
|
# Windows VisualStudio # |
|
######################## |
|
|
|
.test:windows-rocm: |
|
tags: |
|
- windows |
|
- shell |
|
- rx6900 |
|
variables: |
|
SOLUTION_PREFIX: ROCm-Examples-VS |
|
# hip_vulkant_interop: graphical |
|
# hip_texture_management: does not work |
|
# rocsparse_*: broken with new SDK |
|
SkippedExamples: > |
|
hip_vulkan_interop_*.exe, |
|
hip_texture_management_*.exe, |
|
rocsparse_bsric0_*.exe, |
|
rocsparse_bsrilu0_*.exe, |
|
rocsparse_bsrsm_*.exe, |
|
rocsparse_bsrsv_*.exe, |
|
rocsparse_csric0_*.exe, |
|
rocsparse_csrilu0_*.exe, |
|
rocsparse_csrsv_*.exe, |
|
rocsparse_spsv_*.exe, |
|
rocsparse_spsm_*.exe |
|
|
|
.test:windows-nvcc: |
|
tags: |
|
- nvcc-windows |
|
|
|
.test:windows-vs: |
|
stage: test |
|
timeout: 30m |
|
extends: |
|
- .rules:test |
|
parallel: |
|
matrix: |
|
- VS_VERSION: |
|
- 2017 |
|
- 2019 |
|
- 2022 |
|
BUILD_TYPE: |
|
- Debug |
|
- Release |
|
variables: |
|
Timeout: 60 |
|
Filter: "*_vs$VS_VERSION.exe" |
|
script: |
|
- | |
|
& ${env:HIP_PATH}/bin/clang++ --version |
|
- | # Find MSBuild.exe of the associated version. |
|
$MSBUILD = ( |
|
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -find MSBuild\**\Bin\MSBuild.exe |
|
| Select-String -Pattern $VS_VERSION |
|
)[0] |
|
Write-Output ("MSBuild: $MSBUILD" -f $MSBUILD) |
|
- | # Fixes error MSB8036: The Windows SDK version 8.1 was not found |
|
if ($VS_VERSION -eq 2017) { |
|
$MSBUILD_EXTRA_OPTIONS = "/p:WindowsTargetPlatformVersion=10.0.20348.0" |
|
} |
|
- | # Build! |
|
& $MSBUILD @( |
|
"/clp:Summary;ShowEventId;ShowTimestamp" |
|
"/p:Configuration=$BUILD_TYPE" |
|
"/p:Verbose=false" |
|
"/maxCpuCount:8" |
|
"/p:CL_MPCount=8" |
|
"/verbosity:minimal" |
|
"/validate" |
|
"/warnAsError" |
|
# MSBuild cannot properly resolve the `<Content Include=` dependencies, and will sometimes try to copy |
|
# two or more files at once. This results in a warning before it retries, which is counted towards |
|
# /warnAsError by default. For this reason, we disable the relevant warning (MSB3026). |
|
"/warnAsMessage:MSB3026" |
|
"/t:build" |
|
$MSBUILD_EXTRA_OPTIONS |
|
"$CI_PROJECT_DIR\$SOLUTION_PREFIX$VS_VERSION.sln" |
|
) |
|
- | # Use external script to test examples |
|
& $CI_PROJECT_DIR\Scripts\WindowsRunner.ps1 $CI_PROJECT_DIR\$BUILD_TYPE $Filter $Timeout $("$SkippedExamples".split(',')) |
|
|
|
test:windows-rocm-vs: |
|
extends: |
|
- .test:windows-rocm |
|
- .test:windows-vs |
|
tags: |
|
- windows |
|
- shell |
|
- rx6900 |
|
variables: |
|
SOLUTION_PREFIX: ROCm-Examples-VS |
|
# hip_vulkan_interop: graphical |
|
# applications_monte_carlo_pi: broken with new SDK (5.7 v66) |
|
# hipfft/rocfft_*: broken with new SDK (5.7 v66) |
|
SkippedExamples: > |
|
hip_vulkan_interop_*.exe, |
|
applications_monte_carlo_pi_*.exe, |
|
hipfft_plan_d2z_*.exe, |
|
hipfft_plan_z2z_*.exe, |
|
hipfft_plan_many_2d_r2c_*.exe, |
|
hipfft_plan_many_2d_z2z_*.exe, |
|
hipfft_setworkarea_*.exe, |
|
rocfft_complex_complex_*.exe, |
|
rocfft_complex_real_*.exe, |
|
rocfft_real_complex_*.exe |
|
test:windows-nvcc-vs: |
|
extends: |
|
- .test:windows-nvcc |
|
- .test:windows-vs |
|
tags: |
|
- nvcc-windows |
|
variables: |
|
SOLUTION_PREFIX: ROCm-Examples-Portable-VS |
|
# NVCC examples broken with new SDK (5.7 v66) |
|
SkippedExamples: > |
|
*.exe |
|
before_script: |
|
# To test for NVIDIA, we need to set the platform toolset to HIP_nvcc. This cannot be done with /p:PlatformToolset |
|
# though, as some examples use the regular msvc toolchain. |
|
- | |
|
Foreach ($f in (Get-ChildItem -Recurse -Filter "*.vcxproj" "$CI_PROJECT_DIR").FullName) { |
|
(Get-Content $f) | |
|
% { $_ -replace "<PlatformToolset>HIP_clang</PlatformToolset>","<PlatformToolset>HIP_nvcc</PlatformToolset>" } | |
|
Set-Content $f |
|
} |
|
|
|
######################## |
|
# Windows cmake # |
|
######################## |
|
|
|
.test:windows-cmake: |
|
extends: |
|
- .rules:test |
|
variables: |
|
VS_VERSION: 2022 |
|
BUILD_TYPE: Release |
|
before_script: |
|
- | # Find VS installation |
|
$VS_PATH = ( |
|
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -property InstallationPath |
|
| Select-String -Pattern $VS_VERSION |
|
)[0] |
|
- | # Find DevShell.dll |
|
$VS_DEV_SHELL = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -path "$VS_PATH" -find "**\Tools\Microsoft.VisualStudio.DevShell.dll" |
|
- Import-Module "$VS_DEV_SHELL" |
|
- Enter-VsDevShell -InstallPath "$VS_PATH" -SkipAutomaticLocation -DevCmdArguments '/arch=x64 /host_arch=x64 /no_logo' |
|
script: |
|
- | # Ensure no libraries are missing during compilation! |
|
if (Select-String -Path cmake_log.txt -Pattern "could not find") { |
|
throw "Some cmake libraries are missing" |
|
} |
|
- cmake --build "$CI_PROJECT_DIR/build" |
|
# CMake does not copy the dependencies to the test folder, and there is no sufficiently concise way of doing it. |
|
# So for now, just add the library path here. |
|
- $env:PATH = "${env:HIP_PATH}\bin;" + $env:PATH |
|
- cd "$CI_PROJECT_DIR/build" |
|
- ctest --output-on-failure --timeout 15 --parallel 8 |
|
- cmake --install "$CI_PROJECT_DIR/build" --prefix "$CI_PROJECT_DIR/install" |
|
needs: [] |
|
|
|
test:windows-rocm-cmake: |
|
extends: |
|
- .test:windows-rocm |
|
- .test:windows-cmake |
|
script: |
|
- cmake |
|
-S "$CI_PROJECT_DIR" |
|
-B "$CI_PROJECT_DIR/build" |
|
-G Ninja |
|
-D CMAKE_CXX_COMPILER:PATH="${env:HIP_PATH}\bin\clang++.exe" |
|
-D CMAKE_HIP_COMPILER:PATH="${env:HIP_PATH}\bin\clang++.exe" |
|
-D CMAKE_HIP_LINK_EXECUTABLE:PATH="${env:HIP_PATH}\bin\lld-link.exe" |
|
-D CMAKE_CXX_FLAGS="$CXX_FLAGS" |
|
-D CMAKE_PREFIX_PATH:PATH="${env:HIP_PATH}" |
|
-D CMAKE_HIP_FLAGS="$HIP_FLAGS" |
|
-D CMAKE_BUILD_TYPE="$BUILD_TYPE" |
|
-D CMAKE_HIP_ARCHITECTURES=gfx1030 |
|
-D CMAKE_TOOLCHAIN_FILE:PATH="C:\Tools\Microsoft\vcpkg\scripts\buildsystems\vcpkg.cmake" |
|
2>&1 | Tee-Object -filepath cmake_log.txt |
|
- !reference [.test:windows-cmake, script] |
|
|
|
test:windows-nvcc-cmake: |
|
extends: |
|
- .test:windows-nvcc |
|
- .test:windows-cmake |
|
script: |
|
# Note: The current version of the HIP SDK does not ship with CMake config files for Nvidia, so we can only test |
|
# the HIP-Basic and Applications examples. It is expected that some dependencies will not be found for this. |
|
- cmake |
|
-S "$CI_PROJECT_DIR" |
|
-B "$CI_PROJECT_DIR/build" |
|
-G Ninja |
|
-D CMAKE_TOOLCHAIN_FILE="C:/Tools/Microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake" |
|
-D CMAKE_BUILD_TYPE="$BUILD_TYPE" |
|
-D CMAKE_CXX_COMPILER="cl.exe" |
|
-D GPU_RUNTIME=CUDA |
|
2>&1 | Tee-Object -filepath cmake_log.txt |
|
- !reference [.test:windows-cmake, script]
|
|
|