Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fszontagh committed Jan 8, 2025
2 parents 0a562e4 + 2f0c5e5 commit b50f03f
Show file tree
Hide file tree
Showing 48 changed files with 22,558 additions and 65,471 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# Find more information at:
# https://github.com/microsoft/msvc-code-analysis-action

name: Microsoft C++ Code Analysis

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '30 15 * * 4'

env:
# Path to the CMake build directory.
build: '${{ github.workspace }}/build'

permissions:
contents: read

jobs:

prepare-conan-cache:
name: Prepare Conan cache for Windows
runs-on: windows-2022
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cache Conan
id: cache-conan
uses: actions/cache@v4
with:
path: |
~/.conan2
build\generators
CMakeUserPresets.json
key: ${{ runner.os }}-win22-debug-conan-${{ hashFiles('conanfile.txt') }}
restore-keys: ${{ runner.os }}-win22-debug-conan

- name: Install Conan
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install conan
- name: Set up Conan
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
New-Item -ItemType Directory -Force -Path build
cd build
conan profile detect
conan install .. -s compiler.cppstd=17 -s build_type=Debug --build=missing
analyze:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Analyze
runs-on: windows-latest
needs: [prepare-conan-cache]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Conan
id: cache-conan
uses: actions/cache@v4
with:
path: |
~/.conan2
build\generators
CMakeUserPresets.json
key: ${{ runner.os }}-win22-debug-conan-${{ hashFiles('conanfile.txt') }}
restore-keys: ${{ runner.os }}-win22-debug-conan

- name: Install Conan
run: |
python -m pip install --upgrade pip
pip install conan
- name: Set up Conan
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
New-Item -ItemType Directory -Force -Path build
cd build
conan profile detect
conan install .. -s compiler.cppstd=17 -s build_type=Debug --build=missing
- name: Configure and build
run: |
New-Item -ItemType Directory -Force -Path ${{ env.build }}
cd ${{ env.build }}
cmake .. -DCMAKE_BUILD_TYPE=Debug --preset conan-default
cmake --build . --config Debug --target stablediffusiongui_diffuser
cmake --build . --config Debug --target stablediffusiongui
- name: Initialize MSVC Code Analysis
uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99
# Provide a unique ID to access the sarif output path
id: run-analysis
with:
cmakeBuildDirectory: ${{ env.build }}
# Ruleset file that will determine what checks will be run
ruleset: NativeRecommendedRules.ruleset
ignoredTargetPaths: ${{ env.build }}/_deps

# Upload SARIF file to GitHub Code Scanning Alerts
- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
category: msvc

# Upload SARIF file as an Artifact to download and view
- name: Upload SARIF as an Artifact
uses: actions/upload-artifact@v3
with:
name: sarif-file
path: ${{ steps.run-analysis.outputs.sarif }}
75 changes: 52 additions & 23 deletions .github/workflows/multiplatform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:

prepare-conan-cache:
prepare-conan-cache:
name: Prepare Conan cache for Windows
runs-on: windows-2019
steps:
Expand All @@ -25,9 +25,9 @@ jobs:
CMakeUserPresets.json
key: ${{ runner.os }}-conan-${{ hashFiles('conanfile.txt') }}
restore-keys: ${{ runner.os }}-conan

- name: Install Conan
if: steps.cache-conan.outputs.cache-hit != 'true'
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install conan
Expand All @@ -38,12 +38,14 @@ jobs:
New-Item -ItemType Directory -Force -Path build
cd build
conan profile detect
conan install .. -s compiler.cppstd=17 --build=never
conan install .. -s compiler.cppstd=17 --build=never
build-windows:
name: Build on Windows
needs: [prepare-conan-cache]
runs-on: windows-2019
env:
VULKAN_VERSION: 1.3.261.1
strategy:
matrix:
variant:
Expand All @@ -63,14 +65,19 @@ jobs:
cache-key: windows-avx512

- name: CUDA
cmake_flags: "-DSD_CUBLAS=ON"
cmake_flags: "-DSD_CUDA=ON"
targets: "stable_diffusion_cpp_cuda"
cache-key: windows-cuda

- name: HIPBLAS
cmake_flags: "-DSD_HIPBLAS=ON"
targets: "stable_diffusion_cpp_hipblas"
cache-key: windows-hipblas
- name: VULKAN
cmake_flags: "-DSD_VULKAN=ON"
targets: "stable_diffusion_cpp_vulkan"
cache-key: windows-vulkan

# - name: HIPBLAS
# cmake_flags: "-DSD_HIPBLAS=ON"
# targets: "stable_diffusion_cpp_hipblas"
# cache-key: windows-hipblas
steps:
- name: Check out code
uses: actions/checkout@v3
Expand Down Expand Up @@ -107,7 +114,7 @@ jobs:
uses: Jimver/[email protected]
with:
cuda: "12.2.0"
sub-packages: '["nvcc", "visual_studio_integration"]'
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
method: "network"

- name: Print cuda version
Expand All @@ -127,6 +134,15 @@ jobs:
with:
version: 1.11.1

- name: Install Vulkan SDK
id: get_vulkan
if: ${{ matrix.variant.name == 'VULKAN' && steps.cache-build.outputs.cache-hit != 'true' }}
run: |
curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
- name: Set up Conan
if: steps.cache-build.outputs.cache-hit != 'true' && steps.cache-conan.outputs.cache-hit != 'true'
run: |
Expand All @@ -140,7 +156,7 @@ jobs:
run: |
New-Item -ItemType Directory -Force -Path build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release ${{ matrix.variant.cmake_flags }} --preset conan-default
cmake .. -DCMAKE_BUILD_TYPE=Release -DCUDA_TOOLKIT_ROOT_DIR="${{steps.cuda-toolkit.outputs.CUDA_PATH}}" ${{ matrix.variant.cmake_flags }} --preset conan-default
- name: Build Targets
if: steps.cache-build.outputs.cache-hit != 'true'
Expand All @@ -154,7 +170,7 @@ jobs:
name: ${{ matrix.variant.cache-key }}
path: build/Release/*.dll
compression-level: 0
overwrite: true
overwrite: true

package-installer:
name: Build main Application
Expand Down Expand Up @@ -191,7 +207,7 @@ jobs:
run: |
cd build
conan profile detect
conan install .. -s compiler.cppstd=17 --build=never
conan install .. -s compiler.cppstd=17 --build=never
- name: Compile main application
run: |
Expand Down Expand Up @@ -221,11 +237,12 @@ jobs:
overwrite: true

build-ubuntu:
name: Build Ubuntu Releases
name: Build on Ubuntu
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
variant: [CPU, HIPBLAS, CUDA]
# variant: [CPU, HIPBLAS, CUDA, VULKAN]
variant: [CPU, CUDA, VULKAN]
runs-on: ${{ matrix.os }}
steps:
- name: Set up build environment
Expand All @@ -244,9 +261,9 @@ jobs:
path: build/*.so
key: ${{ matrix.os }}-build-${{ matrix.variant }}-${{ hashFiles('cmake/sdcpp_version.cmake') }}
restore-keys: ${{ matrix.os }}-build-${{ matrix.variant }}-

- name: Maximize build space
if: ${{ (matrix.variant == 'HIPBLAS' || matrix.variant == 'CUDA') && steps.sd-cpp-cache.outputs.cache-hit != 'true' }}
if: ${{ (matrix.variant == 'HIPBLAS' || matrix.variant == 'CUDA' || matrix.variant == 'VULKAN' ) && steps.sd-cpp-cache.outputs.cache-hit != 'true' }}
uses: AdityaGarg8/[email protected]
with:
remove-android: 'true'
Expand Down Expand Up @@ -277,22 +294,31 @@ jobs:
run: |
sudo apt install -y wget >/dev/null
source /etc/lsb-release
wget https://repo.radeon.com/amdgpu-install/6.2.2/ubuntu/${DISTRIB_CODENAME}/amdgpu-install_6.2.60202-1_all.deb -O /tmp/amdgpu-install.deb
wget https://repo.radeon.com/amdgpu-install/6.2.2/ubuntu/${DISTRIB_CODENAME}/amdgpu-install_6.2.60202-1_all.deb -O /tmp/amdgpu-install.deb
- name: Install ROCm toolkit
if: ${{ matrix.variant == 'HIPBLAS' && steps.sd-cpp-cache.outputs.cache-hit != 'true' }}
run: |
sudo apt update >/dev/null
sudo apt install -y "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)" >/dev/null
sudo dpkg -i /tmp/amdgpu-install.deb
sudo apt update >/dev/null
sudo apt update >/dev/null
sudo apt install -y rocm-openmp-sdk rocm-cmake hip-dev rocm-hip-runtime-dev clang-tools lld hipblas-dev
sudo tee --append /etc/ld.so.conf.d/rocm.conf <<EOF
/opt/rocm/lib
/opt/rocm/lib64
EOF
sudo ldconfig
- name: Install Vulkan SDK
if: ${{ matrix.variant == 'VULKAN' && steps.sd-cpp-cache.outputs.cache-hit != 'true' }}
run: |
source /etc/lsb-release
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
echo "deb https://packages.lunarg.com/vulkan ${DISTRIB_CODENAME} main" | sudo tee /etc/apt/sources.list.d/lunarg-vulkan-${DISTRIB_CODENAME}.list
sudo apt update
sudo apt install -y vulkan-sdk
- name: Install CUDA toolkit
if: ${{ matrix.variant == 'CUDA' && steps.sd-cpp-cache.outputs.cache-hit != 'true' }}
run: |
Expand All @@ -312,11 +338,14 @@ jobs:
elif [ "${{ matrix.variant }}" = "HIPBLAS" ]; then
cmake .. -DCMAKE_BUILD_TYPE=Release -DSD_HIPBLAS=ON
cmake --build . --config Release --target stable_diffusion_cpp_hipblas
elif [ "${{ matrix.variant }}" = "VULKAN" ]; then
cmake .. -DCMAKE_BUILD_TYPE=Release -DSD_VULKAN=ON
cmake --build . --config Release --target stable_diffusion_cpp_vulkan
elif [ "${{ matrix.variant }}" = "CUDA" ]; then
cmake .. -DCMAKE_BUILD_TYPE=Release -DSD_CUBLAS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DSD_CUDA=ON
cmake --build . --config Release --target stable_diffusion_cpp_cuda
fi
- name: Upload Build Outputs
uses: actions/upload-artifact@v4
Expand All @@ -341,7 +370,7 @@ jobs:
- name: Install base dependencies
run: |
sudo apt update
sudo apt install -y fuse3 cmake gettext git build-essential ninja-build libexiv2-dev libssl-dev libjpeg-dev libpng-dev libtiff-dev libgtk-3-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev libwebkit2gtk-4.1-dev libsdl2-dev >/dev/null
sudo apt install -y fuse3 cmake gettext git build-essential ninja-build libexiv2-dev libssl-dev libjpeg-dev libpng-dev libtiff-dev libgtk-3-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev libwebkit2gtk-4.1-dev libsdl2-dev >/dev/null
- name: Cache wxWidgets
id: cache-wxwidgets
Expand Down Expand Up @@ -392,7 +421,7 @@ jobs:
build/out/*.AppImage
build/*.sha256
compression-level: 0
overwrite: true
overwrite: true

merge-packages:
name: Merge packages
Expand Down
Loading

0 comments on commit b50f03f

Please sign in to comment.