Skip to content

Commit

Permalink
disable benchmark and move test llvm build
Browse files Browse the repository at this point in the history
  • Loading branch information
pyYTn9 authored and pyYTn9 committed Jan 2, 2025
1 parent 1f777ad commit 7c105aa
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
defaults:
run:
shell: bash -o pipefail {0}
if: github.repository_owner == 'dyKiU'
if: github.repository_owner == 'tinygrad'
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand Down
169 changes: 118 additions & 51 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,63 @@ on:
workflow_dispatch:

jobs:
macos_tiny_tests:
name: Mac tiny tests on AMD
runs-on: [self-hosted, macOS]
timeout-minutes: 200
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Dependencies
run: |
brew update
brew install cmake ninja llvm lld git
- name: Set LLVM Environment
run: |
# Set LLVM_PATH to the Homebrew LLVM installation
echo "LLVM_PATH=$(brew --prefix llvm)" >> $GITHUB_ENV
echo "LLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm" >> $GITHUB_ENV
echo "LLD_DIR=$(brew --prefix llvm)/lib/cmake/lld" >> $GITHUB_ENV
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
# Set HIP environment variables
echo "HIP_PATH=/usr/local/hip" >> $GITHUB_ENV
echo "PATH=/usr/local/hip/bin:$PATH" >> $GITHUB_ENV
echo "ROOT_DIR=`pwd`" >> $GITHUB_ENV
echo "INSTALL_DIR=$ROOT_DIR/usr/local" >> $GITHUB_ENV
- name: Cache LLVM Build
uses: actions/cache@v4
with:
path: llvm-project/build
key: llvm-build-${{ hashFiles('**/llvm-project/CMakeLists.txt') }}

- name: Build and Install libamd_comgr with LLVM
run: |
# Build LLVM project
git clone --depth 1 --filter=blob:none --sparse -b amd-staging https://github.com/ROCm/llvm-project.git
cd llvm-project
git sparse-checkout set llvm clang lld cmake third-party/benchmark third-party/unittest
mkdir -p build && cd build
cmake ../llvm \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="llvm;clang;lld" \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;AArch64" \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_PREFIX_PATH=${LLVM_PATH} \
-DCMAKE_MODULE_PATH=${LLVM_PATH}/lib/cmake \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DLLVM_ENABLE_BENCHMARKS=OFF \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-G Ninja
ninja || exit 1 # Exit if build fails
ninja install
cd ../..
autogen:
name: Autogen+Docs
runs-on: ubuntu-latest
Expand Down Expand Up @@ -625,59 +682,69 @@ jobs:
# run: pip install -e '.[testing,arm]' --extra-index-url https://download.pytorch.org/whl/cpu
# - name: Test arm
# run: CI=1 ARM64=1 CLANG=1 python -m pytest -n=auto test/ -k 'not (test_nn.py and (test_conv_transpose2d or test_conv2d))' --ignore=test/models --ignore=test/test_speed_v_torch.py --ignore=test/test_net_speed.py --ignore=test/test_specific_conv.py --ignore=test/unit/test_disk_tensor.py
macos_tiny_tests:
name: Mac tiny tests on AMD
runs-on: [self-hosted, macOS]
timeout-minutes: 200
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Install Dependencies
run: |
brew update
brew install cmake ninja llvm lld git

- name: Set LLVM Environment
run: |
# Set LLVM_PATH to the Homebrew LLVM installation
echo "LLVM_PATH=$(brew --prefix llvm)" >> $GITHUB_ENV
echo "LLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm" >> $GITHUB_ENV
echo "LLD_DIR=$(brew --prefix llvm)/lib/cmake/lld" >> $GITHUB_ENV
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
# Set HIP environment variables
echo "HIP_PATH=/usr/local/hip" >> $GITHUB_ENV
echo "PATH=/usr/local/hip/bin:$PATH" >> $GITHUB_ENV
echo "ROOT_DIR=`pwd`" >> $GITHUB_ENV
echo "INSTALL_DIR=$ROOT_DIR/usr/local" >> $GITHUB_ENV
# osxtests:
# strategy:
# fail-fast: false
# matrix:
# backend: [ptx]

- name: Cache LLVM Build
uses: actions/cache@v4
with:
path: llvm-project/build
key: llvm-build-${{ hashFiles('**/llvm-project/CMakeLists.txt') }}
# name: OSX tiny tests on (${{ matrix.backend }})
# runs-on: macos-15
# timeout-minutes: 20

# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# with:
# fetch-depth: 2 # NOTE: this fetches the HEAD commit of the PR
# - name: Set up Python 3.11
# uses: actions/setup-python@v5
# with:
# python-version: 3.11
# - name: Cache python packages
# uses: actions/cache@v4
# with:
# path: /Users/runner/Library/Python/3.11/lib/python/site-packages
# key: m1-${{ matrix.backend }}-packages-${{ hashFiles('**/setup.py') }}
# - name: Set env
# run: printf "${{ matrix.backend == 'ptx' && 'PTX=1\n\nMOCKGPU=1\nNV=1\nFORWARD_ONLY=1' }}" >> $GITHUB_ENV
# - name: Install packages
# if: matrix.backend == 'ptx' || matrix.backend == 'triton' || matrix.backend == 'nv'
# run: |
# brew update
# brew install cmake ninja llvm@15 zlib glew flex bison boost zstd ncurses
# - name: Cache gpuocelot
# if: matrix.backend == 'ptx'
# id: cache-build
# uses: actions/cache@v4
# env:
# cache-name: cache-gpuocelot-osx-build
# with:
# path: ${{ github.workspace }}/gpuocelot/ocelot
# key: macos-15-gpuocelot-4524e34adb7eaccc6f71262f2e21d7052bb17c2f-rebuild-9
# - name: Clone/compile gpuocelot
# if: matrix.backend == 'ptx' && steps.cache-build.outputs.cache-hit != 'true'
# run: |
# git clone --recurse-submodules https://github.com/gpuocelot/gpuocelot.git ${{ github.workspace }}/gpuocelot
# cd ${{ github.workspace }}/gpuocelot
# git checkout 4524e34adb7eaccc6f71262f2e21d7052bb17c2f
# git apply ${{ github.workspace }}/extra/mockgpu/nv/osx_gpuocelot_patches/*.patch
# cd ocelot
# mkdir build
# cd build
# cmake .. -Wno-dev -G Ninja -DBUILD_TOOLS=OFF -DCMAKE_BUILD_ALWAYS=0 -DBUILD_TESTS_CUDA=OFF
# ninja
# - name: Install gpuocelot
# if: matrix.backend == 'ptx' || matrix.backend == 'triton' || matrix.backend == 'nv'
# run: |
# cd ${{ github.workspace }}/gpuocelot/ocelot/build
# sudo ninja install -d explain
# - name: Install dependencies
# run: pip install --user -e '.[testing]' --extra-index-url https://download.pytorch.org/whl/cpu
# - name: Run tiny test (ptx)
# if: matrix.backend=='ptx'
# run: python3 test/test_tiny.py

- name: Build and Install libamd_comgr with LLVM
run: |
# Build LLVM project
git clone --depth 1 --filter=blob:none --sparse -b amd-staging https://github.com/ROCm/llvm-project.git
cd llvm-project
git sparse-checkout set llvm clang lld cmake third-party/benchmark third-party/unittest
mkdir -p build && cd build
cmake ../llvm \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="llvm;clang;lld" \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;AArch64" \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_PREFIX_PATH=${LLVM_PATH} \
-DCMAKE_MODULE_PATH=${LLVM_PATH}/lib/cmake \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DLLVM_ENABLE_BENCHMARKS=OFF \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-G Ninja
ninja || exit 1 # Exit if build fails
ninja install
cd ../..

0 comments on commit 7c105aa

Please sign in to comment.