From 9f7db4996419a692d035497128e11bb37a2940c4 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Fri, 1 Dec 2023 23:11:32 +0800 Subject: [PATCH 01/13] add cuda and hip support --- .github/workflows/build.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40caeb4..aa747e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -183,6 +183,10 @@ jobs: defines: '-DRWKV_AVX2=OFF' - build: 'avx512' defines: '-DRWKV_AVX512=ON' + - build: 'cuda12' + defines: '-DRWKV_CUBLAS=ON' + - build: 'rocm5.5' + defines: '-G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130;gfx1132"' steps: - name: Clone @@ -191,6 +195,21 @@ jobs: with: submodules: 'recursive' + - name: Install cuda-toolkit + id: cuda_toolkit + if: ${{ matrix.build == 'cuda12' }} + uses: Jimver/cuda-toolkit@v0.2.11 + with: + cuda: '12.2.0' + method: 'local' + + - name: Install rocm-toolkit + id: rocm-toolkit + if: ${{ matrix.build == 'rocm5.5' }} + uses: Cyberhan123/rocm-toolkit@v0.0.1 + with: + rocm: '5.5.0' + - name: Build id: cmake_build run: | @@ -215,7 +234,7 @@ jobs: - name: Test id: cmake_test # Test AVX-512 only when possible - if: ${{ matrix.build != 'avx512' || env.HAS_AVX512F == '1' }} + if: ${{ matrix.build != 'avx512' || env.HAS_AVX512F == '1' || matrix.build != 'hipBLAS' }} run: | cd build ctest -C Release --verbose From 5e23d004efd4b1c240b022f228ab21e8f9650f8f Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Fri, 1 Dec 2023 23:38:03 +0800 Subject: [PATCH 02/13] fix ci fail --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa747e8..0e217cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -206,7 +206,7 @@ jobs: - name: Install rocm-toolkit id: rocm-toolkit if: ${{ matrix.build == 'rocm5.5' }} - uses: Cyberhan123/rocm-toolkit@v0.0.1 + uses: Cyberhan123/rocm-toolkit@v0.1.0 with: rocm: '5.5.0' @@ -234,7 +234,7 @@ jobs: - name: Test id: cmake_test # Test AVX-512 only when possible - if: ${{ matrix.build != 'avx512' || env.HAS_AVX512F == '1' || matrix.build != 'hipBLAS' }} + if: ${{ (matrix.build != 'avx512' || env.HAS_AVX512F == '1') && matrix.build != 'cuda12' && matrix.build != 'rocm5.5'}} run: | cd build ctest -C Release --verbose From 4befa3c16cc683141e8cd790617e0249a999758c Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 00:03:48 +0800 Subject: [PATCH 03/13] add ninja --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e217cc..5736ad5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -210,6 +210,13 @@ jobs: with: rocm: '5.5.0' + - name: Setup Ninja + id: setup-ninja + if: ${{ matrix.build == 'rocm5.5' }} + uses: ashutoshvarma/setup-ninja@1.1 + with: + version: 1.11.1 + - name: Build id: cmake_build run: | From 885c9ded92524bfdaa8106edb654d93a40f5e98f Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 00:07:38 +0800 Subject: [PATCH 04/13] add ninja --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5736ad5..c78cb52 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -213,7 +213,7 @@ jobs: - name: Setup Ninja id: setup-ninja if: ${{ matrix.build == 'rocm5.5' }} - uses: ashutoshvarma/setup-ninja@1.1 + uses: ashutoshvarma/setup-ninja@master with: version: 1.11.1 From 792ed181b90b3e17b8b4ea727431ee8674025f6a Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 00:28:50 +0800 Subject: [PATCH 05/13] peek ninja --- .github/workflows/build.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c78cb52..874ceb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -203,6 +203,17 @@ jobs: cuda: '12.2.0' method: 'local' + - name: Setup Ninja + id: setup-ninja + if: ${{ matrix.build == 'rocm5.5' }} + uses: ashutoshvarma/setup-ninja@master + with: + version: '1.11.1' + + - name: Peek Ninja + id: peek_ninja + run: ninja --version + - name: Install rocm-toolkit id: rocm-toolkit if: ${{ matrix.build == 'rocm5.5' }} @@ -210,13 +221,6 @@ jobs: with: rocm: '5.5.0' - - name: Setup Ninja - id: setup-ninja - if: ${{ matrix.build == 'rocm5.5' }} - uses: ashutoshvarma/setup-ninja@master - with: - version: 1.11.1 - - name: Build id: cmake_build run: | From beb420ee88e245002065e2daab5297a2992bf242 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 01:06:07 +0800 Subject: [PATCH 06/13] peek ninja --- .github/workflows/build.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 874ceb7..83eb736 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -203,20 +203,35 @@ jobs: cuda: '12.2.0' method: 'local' - - name: Setup Ninja - id: setup-ninja + - name: Install Ninja + id: install-ninja if: ${{ matrix.build == 'rocm5.5' }} uses: ashutoshvarma/setup-ninja@master with: version: '1.11.1' + dest: 'C:\Program Files\ninja' - name: Peek Ninja id: peek_ninja - run: ninja --version + if: ${{ matrix.build == 'rocm5.5' }} + run: | + $ninjaPath = "C:\Program Files\ninja" + if (Test-Path (Join-Path $env:PATH $ninjaPath)) { + try { + echo "Ninja found in PATH." + cmake -G "Ninja" --version + echo "CMake can use Ninja." + echo HAS_NINJA=1 >> $env:GITHUB_ENV + } catch { + echo "CMake cannot use Ninja. Error: $_" + } + } else { + echo "Ninja not found in PATH. Please install Ninja or update your PATH environment variable." + } - name: Install rocm-toolkit id: rocm-toolkit - if: ${{ matrix.build == 'rocm5.5' }} + if: ${{ matrix.build == 'rocm5.5' && env.HAS_NINJA == 1 }} uses: Cyberhan123/rocm-toolkit@v0.1.0 with: rocm: '5.5.0' From f148878b502300fb8fe6b8620e04057bb0c48de7 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 01:12:28 +0800 Subject: [PATCH 07/13] peek ninja --- .github/workflows/build.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83eb736..e6c7d58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -215,18 +215,13 @@ jobs: id: peek_ninja if: ${{ matrix.build == 'rocm5.5' }} run: | - $ninjaPath = "C:\Program Files\ninja" - if (Test-Path (Join-Path $env:PATH $ninjaPath)) { - try { - echo "Ninja found in PATH." - cmake -G "Ninja" --version - echo "CMake can use Ninja." - echo HAS_NINJA=1 >> $env:GITHUB_ENV - } catch { - echo "CMake cannot use Ninja. Error: $_" - } - } else { - echo "Ninja not found in PATH. Please install Ninja or update your PATH environment variable." + try { + ninja --version + cmake -G "Ninja" --version + echo "CMake can use Ninja." + echo HAS_NINJA=1 >> $env:GITHUB_ENV + } catch { + echo "CMake cannot use Ninja. Error: $_" } - name: Install rocm-toolkit From 1edf5b66c4512275ad1960906eec068b7b928547 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 01:24:42 +0800 Subject: [PATCH 08/13] peek ninja --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6c7d58..0baa968 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -208,8 +208,7 @@ jobs: if: ${{ matrix.build == 'rocm5.5' }} uses: ashutoshvarma/setup-ninja@master with: - version: '1.11.1' - dest: 'C:\Program Files\ninja' + version: 1.10.0 - name: Peek Ninja id: peek_ninja @@ -217,7 +216,7 @@ jobs: run: | try { ninja --version - cmake -G "Ninja" --version + cmake -G "Ninja" echo "CMake can use Ninja." echo HAS_NINJA=1 >> $env:GITHUB_ENV } catch { From c3d6d88d259d499af92775253428c700933a3e7b Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 01:41:37 +0800 Subject: [PATCH 09/13] peek ninja --- .github/workflows/build.yml | 324 ++++++++++++++++++------------------ 1 file changed, 164 insertions(+), 160 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0baa968..c528af7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,158 +16,158 @@ env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: - ubuntu-latest-cmake-sanitizer: - runs-on: ubuntu-latest - - continue-on-error: true - - strategy: - matrix: - sanitizer: [ADDRESS, THREAD, UNDEFINED] - build_type: [Debug, Release] - - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Dependencies - id: depends - run: | - sudo apt-get update - sudo apt-get install build-essential - - - name: Build - id: cmake_build - run: | - mkdir build - cd build - cmake .. -DRWKV_SANITIZE_${{ matrix.sanitizer }}=ON -DGGML_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - cmake --build . --config ${{ matrix.build_type }} - - - name: Test - id: cmake_test - run: | - cd build - ctest --verbose - - ubuntu-latest-cmake: - runs-on: ubuntu-latest - - continue-on-error: true - - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Dependencies - id: depends - run: | - sudo apt-get update - sudo apt-get install build-essential zip - - - name: Build - id: cmake_build - run: | - mkdir build - cd build - cmake .. - cmake --build . --config Release - - - name: Test - id: cmake_test - run: | - cd build - ctest --verbose - - - name: Get commit hash - id: commit - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - uses: pr-mpt/actions-commit-hash@v2 - - - name: Fetch system info - id: system-info - run: | - echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" - echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT" - echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT" - echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" - - - name: Pack artifacts - id: pack_artifacts - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - run: | - zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.so - - - name: Upload artifacts - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - uses: actions/upload-artifact@v3 - with: - path: | - rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip - - macOS-latest-cmake: - runs-on: macOS-latest - - continue-on-error: true - - steps: - - name: Clone - id: checkout - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Dependencies - id: depends - run: | - brew install zip - - - name: Build - id: cmake_build - # FMA disabled because it gives "Illegal instruction" in GitHub Actions runner - run: | - mkdir build - cd build - cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF .. - cmake --build . --config Release - - - name: Test - id: cmake_test - run: | - cd build - ctest --verbose - - - name: Get commit hash - id: commit - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - uses: pr-mpt/actions-commit-hash@v2 - - - name: Fetch system info - id: system-info - run: | - echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" - echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT" - echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT" - echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" - - - name: Pack artifacts - id: pack_artifacts - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - run: | - zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.dylib - - - name: Upload artifacts - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - uses: actions/upload-artifact@v3 - with: - path: | - rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip +# ubuntu-latest-cmake-sanitizer: +# runs-on: ubuntu-latest +# +# continue-on-error: true +# +# strategy: +# matrix: +# sanitizer: [ADDRESS, THREAD, UNDEFINED] +# build_type: [Debug, Release] +# +# steps: +# - name: Clone +# id: checkout +# uses: actions/checkout@v3 +# with: +# submodules: 'recursive' +# +# - name: Dependencies +# id: depends +# run: | +# sudo apt-get update +# sudo apt-get install build-essential +# +# - name: Build +# id: cmake_build +# run: | +# mkdir build +# cd build +# cmake .. -DRWKV_SANITIZE_${{ matrix.sanitizer }}=ON -DGGML_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} +# cmake --build . --config ${{ matrix.build_type }} +# +# - name: Test +# id: cmake_test +# run: | +# cd build +# ctest --verbose +# +# ubuntu-latest-cmake: +# runs-on: ubuntu-latest +# +# continue-on-error: true +# +# steps: +# - name: Clone +# id: checkout +# uses: actions/checkout@v3 +# with: +# submodules: 'recursive' +# +# - name: Dependencies +# id: depends +# run: | +# sudo apt-get update +# sudo apt-get install build-essential zip +# +# - name: Build +# id: cmake_build +# run: | +# mkdir build +# cd build +# cmake .. +# cmake --build . --config Release +# +# - name: Test +# id: cmake_test +# run: | +# cd build +# ctest --verbose +# +# - name: Get commit hash +# id: commit +# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} +# uses: pr-mpt/actions-commit-hash@v2 +# +# - name: Fetch system info +# id: system-info +# run: | +# echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" +# echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT" +# echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT" +# echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" +# +# - name: Pack artifacts +# id: pack_artifacts +# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} +# run: | +# zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.so +# +# - name: Upload artifacts +# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} +# uses: actions/upload-artifact@v3 +# with: +# path: | +# rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip +# +# macOS-latest-cmake: +# runs-on: macOS-latest +# +# continue-on-error: true +# +# steps: +# - name: Clone +# id: checkout +# uses: actions/checkout@v3 +# with: +# submodules: 'recursive' +# +# - name: Dependencies +# id: depends +# run: | +# brew install zip +# +# - name: Build +# id: cmake_build +# # FMA disabled because it gives "Illegal instruction" in GitHub Actions runner +# run: | +# mkdir build +# cd build +# cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF .. +# cmake --build . --config Release +# +# - name: Test +# id: cmake_test +# run: | +# cd build +# ctest --verbose +# +# - name: Get commit hash +# id: commit +# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} +# uses: pr-mpt/actions-commit-hash@v2 +# +# - name: Fetch system info +# id: system-info +# run: | +# echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" +# echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT" +# echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT" +# echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" +# +# - name: Pack artifacts +# id: pack_artifacts +# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} +# run: | +# zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.dylib +# +# - name: Upload artifacts +# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} +# uses: actions/upload-artifact@v3 +# with: +# path: | +# rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip windows-latest-cmake: runs-on: windows-latest @@ -177,14 +177,14 @@ jobs: strategy: matrix: include: - - build: 'avx2' - defines: '' - - build: 'avx' - defines: '-DRWKV_AVX2=OFF' - - build: 'avx512' - defines: '-DRWKV_AVX512=ON' - - build: 'cuda12' - defines: '-DRWKV_CUBLAS=ON' +# - build: 'avx2' +# defines: '' +# - build: 'avx' +# defines: '-DRWKV_AVX2=OFF' +# - build: 'avx512' +# defines: '-DRWKV_AVX512=ON' +# - build: 'cuda12' +# defines: '-DRWKV_CUBLAS=ON' - build: 'rocm5.5' defines: '-G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130;gfx1132"' @@ -215,8 +215,12 @@ jobs: if: ${{ matrix.build == 'rocm5.5' }} run: | try { + $env:Path ninja --version + cmake --version cmake -G "Ninja" + clang --version + clang++ --version echo "CMake can use Ninja." echo HAS_NINJA=1 >> $env:GITHUB_ENV } catch { From 1d453931aeebdecd931a447fc460de59dc3e8dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=BA=E6=97=BA=E7=A2=8E=E5=86=B0=E5=86=B0?= <38837039+Cyberhan123@users.noreply.github.com> Date: Sat, 2 Dec 2023 01:42:34 +0800 Subject: [PATCH 10/13] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c528af7..7ae6b8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -287,8 +287,8 @@ jobs: runs-on: ubuntu-latest needs: - - ubuntu-latest-cmake - - macOS-latest-cmake + # - ubuntu-latest-cmake + # - macOS-latest-cmake - windows-latest-cmake steps: From daa28a265b5e7f28a60efa4e4c2342d1e9b2893d Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 02:39:31 +0800 Subject: [PATCH 11/13] test build with rocm --- .github/workflows/build.yml | 359 +++++++++++++++++------------------- 1 file changed, 171 insertions(+), 188 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ae6b8a..4179f80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,158 +16,158 @@ env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: -# ubuntu-latest-cmake-sanitizer: -# runs-on: ubuntu-latest -# -# continue-on-error: true -# -# strategy: -# matrix: -# sanitizer: [ADDRESS, THREAD, UNDEFINED] -# build_type: [Debug, Release] -# -# steps: -# - name: Clone -# id: checkout -# uses: actions/checkout@v3 -# with: -# submodules: 'recursive' -# -# - name: Dependencies -# id: depends -# run: | -# sudo apt-get update -# sudo apt-get install build-essential -# -# - name: Build -# id: cmake_build -# run: | -# mkdir build -# cd build -# cmake .. -DRWKV_SANITIZE_${{ matrix.sanitizer }}=ON -DGGML_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -# cmake --build . --config ${{ matrix.build_type }} -# -# - name: Test -# id: cmake_test -# run: | -# cd build -# ctest --verbose -# -# ubuntu-latest-cmake: -# runs-on: ubuntu-latest -# -# continue-on-error: true -# -# steps: -# - name: Clone -# id: checkout -# uses: actions/checkout@v3 -# with: -# submodules: 'recursive' -# -# - name: Dependencies -# id: depends -# run: | -# sudo apt-get update -# sudo apt-get install build-essential zip -# -# - name: Build -# id: cmake_build -# run: | -# mkdir build -# cd build -# cmake .. -# cmake --build . --config Release -# -# - name: Test -# id: cmake_test -# run: | -# cd build -# ctest --verbose -# -# - name: Get commit hash -# id: commit -# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} -# uses: pr-mpt/actions-commit-hash@v2 -# -# - name: Fetch system info -# id: system-info -# run: | -# echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" -# echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT" -# echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT" -# echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" -# -# - name: Pack artifacts -# id: pack_artifacts -# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} -# run: | -# zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.so -# -# - name: Upload artifacts -# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} -# uses: actions/upload-artifact@v3 -# with: -# path: | -# rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip -# -# macOS-latest-cmake: -# runs-on: macOS-latest -# -# continue-on-error: true -# -# steps: -# - name: Clone -# id: checkout -# uses: actions/checkout@v3 -# with: -# submodules: 'recursive' -# -# - name: Dependencies -# id: depends -# run: | -# brew install zip -# -# - name: Build -# id: cmake_build -# # FMA disabled because it gives "Illegal instruction" in GitHub Actions runner -# run: | -# mkdir build -# cd build -# cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF .. -# cmake --build . --config Release -# -# - name: Test -# id: cmake_test -# run: | -# cd build -# ctest --verbose -# -# - name: Get commit hash -# id: commit -# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} -# uses: pr-mpt/actions-commit-hash@v2 -# -# - name: Fetch system info -# id: system-info -# run: | -# echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" -# echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT" -# echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT" -# echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" -# -# - name: Pack artifacts -# id: pack_artifacts -# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} -# run: | -# zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.dylib -# -# - name: Upload artifacts -# if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} -# uses: actions/upload-artifact@v3 -# with: -# path: | -# rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip + ubuntu-latest-cmake-sanitizer: + runs-on: ubuntu-latest + + continue-on-error: true + + strategy: + matrix: + sanitizer: [ADDRESS, THREAD, UNDEFINED] + build_type: [Debug, Release] + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Dependencies + id: depends + run: | + sudo apt-get update + sudo apt-get install build-essential + + - name: Build + id: cmake_build + run: | + mkdir build + cd build + cmake .. -DRWKV_SANITIZE_${{ matrix.sanitizer }}=ON -DGGML_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + cmake --build . --config ${{ matrix.build_type }} + + - name: Test + id: cmake_test + run: | + cd build + ctest --verbose + + ubuntu-latest-cmake: + runs-on: ubuntu-latest + + continue-on-error: true + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Dependencies + id: depends + run: | + sudo apt-get update + sudo apt-get install build-essential zip + + - name: Build + id: cmake_build + run: | + mkdir build + cd build + cmake .. + cmake --build . --config Release + + - name: Test + id: cmake_test + run: | + cd build + ctest --verbose + + - name: Get commit hash + id: commit + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: pr-mpt/actions-commit-hash@v2 + + - name: Fetch system info + id: system-info + run: | + echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" + echo "OS_NAME=`lsb_release -s -i`" >> "$GITHUB_OUTPUT" + echo "OS_VERSION=`lsb_release -s -r`" >> "$GITHUB_OUTPUT" + echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" + + - name: Pack artifacts + id: pack_artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + run: | + zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.so + + - name: Upload artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v3 + with: + path: | + rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip + + macOS-latest-cmake: + runs-on: macOS-latest + + continue-on-error: true + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Dependencies + id: depends + run: | + brew install zip + + - name: Build + id: cmake_build + # FMA disabled because it gives "Illegal instruction" in GitHub Actions runner + run: | + mkdir build + cd build + cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF .. + cmake --build . --config Release + + - name: Test + id: cmake_test + run: | + cd build + ctest --verbose + + - name: Get commit hash + id: commit + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: pr-mpt/actions-commit-hash@v2 + + - name: Fetch system info + id: system-info + run: | + echo "CPU_ARCH=`uname -m`" >> "$GITHUB_OUTPUT" + echo "OS_NAME=`sw_vers -productName`" >> "$GITHUB_OUTPUT" + echo "OS_VERSION=`sw_vers -productVersion`" >> "$GITHUB_OUTPUT" + echo "OS_TYPE=`uname -s`" >> "$GITHUB_OUTPUT" + + - name: Pack artifacts + id: pack_artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + run: | + zip -j rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/librwkv.dylib + + - name: Upload artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v3 + with: + path: | + rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip windows-latest-cmake: runs-on: windows-latest @@ -177,16 +177,16 @@ jobs: strategy: matrix: include: -# - build: 'avx2' -# defines: '' -# - build: 'avx' -# defines: '-DRWKV_AVX2=OFF' -# - build: 'avx512' -# defines: '-DRWKV_AVX512=ON' -# - build: 'cuda12' -# defines: '-DRWKV_CUBLAS=ON' + - build: 'avx2' + defines: '' + - build: 'avx' + defines: '-DRWKV_AVX2=OFF' + - build: 'avx512' + defines: '-DRWKV_AVX512=ON' + - build: 'cuda12' + defines: '-DRWKV_CUBLAS=ON' - build: 'rocm5.5' - defines: '-G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130;gfx1132"' + defines: -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130" steps: - name: Clone @@ -203,37 +203,20 @@ jobs: cuda: '12.2.0' method: 'local' - - name: Install Ninja - id: install-ninja - if: ${{ matrix.build == 'rocm5.5' }} - uses: ashutoshvarma/setup-ninja@master - with: - version: 1.10.0 - - - name: Peek Ninja - id: peek_ninja - if: ${{ matrix.build == 'rocm5.5' }} - run: | - try { - $env:Path - ninja --version - cmake --version - cmake -G "Ninja" - clang --version - clang++ --version - echo "CMake can use Ninja." - echo HAS_NINJA=1 >> $env:GITHUB_ENV - } catch { - echo "CMake cannot use Ninja. Error: $_" - } - - name: Install rocm-toolkit id: rocm-toolkit - if: ${{ matrix.build == 'rocm5.5' && env.HAS_NINJA == 1 }} + if: ${{ matrix.build == 'rocm5.5' }} uses: Cyberhan123/rocm-toolkit@v0.1.0 with: rocm: '5.5.0' + - name: Setup Ninja + id: setup-ninja + if: ${{ matrix.build == 'rocm5.5' }} + uses: ashutoshvarma/setup-ninja@master + with: + version: 1.11.1 + - name: Build id: cmake_build run: | @@ -287,8 +270,8 @@ jobs: runs-on: ubuntu-latest needs: - # - ubuntu-latest-cmake - # - macOS-latest-cmake + - ubuntu-latest-cmake + - macOS-latest-cmake - windows-latest-cmake steps: From 48bd8930e363508c068dd4855ab1ac7f14cd69e2 Mon Sep 17 00:00:00 2001 From: Cyberhan123 <255542417@qq.com> Date: Sat, 2 Dec 2023 11:30:11 +0800 Subject: [PATCH 12/13] change set ninja action --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4179f80..90bff48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,7 +186,7 @@ jobs: - build: 'cuda12' defines: '-DRWKV_CUBLAS=ON' - build: 'rocm5.5' - defines: -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130" + defines: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130"' steps: - name: Clone @@ -213,7 +213,7 @@ jobs: - name: Setup Ninja id: setup-ninja if: ${{ matrix.build == 'rocm5.5' }} - uses: ashutoshvarma/setup-ninja@master + uses: urkle/action-get-ninja@v1 with: version: 1.11.1 From 2d3753e1b6dc253fd2479240de8ae86409d12d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=BA=E6=97=BA=E7=A2=8E=E5=86=B0=E5=86=B0?= <38837039+Cyberhan123@users.noreply.github.com> Date: Sat, 2 Dec 2023 11:42:47 +0800 Subject: [PATCH 13/13] fix rocm build fail build.yml --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90bff48..cdadf3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,7 +186,7 @@ jobs: - build: 'cuda12' defines: '-DRWKV_CUBLAS=ON' - build: 'rocm5.5' - defines: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1130"' + defines: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DRWKV_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1030"' steps: - name: Clone @@ -210,8 +210,8 @@ jobs: with: rocm: '5.5.0' - - name: Setup Ninja - id: setup-ninja + - name: Install Ninja + id: install-ninja if: ${{ matrix.build == 'rocm5.5' }} uses: urkle/action-get-ninja@v1 with: