Skip to content

Commit

Permalink
keep a commit hash for llvm build, cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
pyYTn9 authored and pyYTn9 committed Jan 3, 2025
1 parent 9cb0a01 commit a68de1d
Showing 1 changed file with 23 additions and 82 deletions.
105 changes: 23 additions & 82 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
name: Build libcomgr
runs-on: [self-hosted, macOS]
timeout-minutes: 200
env:
LLVM_COMMIT: f9dc83dca5a058a339163a3c7d1903e423f46f17
steps:
- name: Install Dependencies
run: |
Expand All @@ -27,43 +29,46 @@ jobs:
- name: Set LLVM Environment
run: |
# Set LLVM_PATH to the Homebrew LLVM installation
export ROOT_DIR=`pwd`
echo "ROOT_DIR=$ROOT_DIR" >> $GITHUB_ENV
echo "LLVM_PATH=$(brew --prefix llvm)" >> $GITHUB_ENV
echo "LLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm" >> $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=$ROOT_DIR/usr/local/hip" >> $GITHUB_ENV
echo "PATH=$ROOT_DIR/usr/local/hip/bin:$PATH" >> $GITHUB_ENV
echo "INSTALL_DIR=$ROOT_DIR/usr/local" >> $GITHUB_ENV
# Set LLVM paths
LLVM_PREFIX=$(brew --prefix llvm)
{
echo "LLVM_PATH=$LLVM_PREFIX"
echo "LLVM_DIR=$LLVM_PREFIX/lib/cmake/llvm"
echo "CC=$LLVM_PREFIX/bin/clang"
echo "CXX=$LLVM_PREFIX/bin/clang++"
# Set project paths
ROOT_DIR=$PWD
echo "ROOT_DIR=$ROOT_DIR"
echo "INSTALL_DIR=$ROOT_DIR/usr/local"
echo "HIP_PATH=$ROOT_DIR/usr/local/hip"
echo "PATH=$ROOT_DIR/usr/local/hip/bin:$PATH"
} >> $GITHUB_ENV
- name: Cache LLVM Build
uses: actions/cache@v4
with:
path: |
llvm-project/.git/info/sparse-checkout
llvm-project/build
#key: llvm-build-sparse-${{ github.run_id }}
key: llvm-build-sparse-f9dc83dca5a058a339163a3c7d1903e423f46f17
key: llvm-build-sparse-${{ env.LLVM_COMMIT }}

- name: Get LLVM commit hash
run: |
# Build LLVM project with sparse checkout
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
COMMIT_HASH=$(git rev-parse HEAD)
echo "LLVM_COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
git checkout ${{ env.LLVM_COMMIT }} # Checkout specific commit
echo "LLVM_COMMIT_HASH=${{ env.LLVM_COMMIT }}" >> $GITHUB_ENV
cd ..
- name: Update Cache Key
if: always()
run: |
echo "Using LLVM commit hash: ${LLVM_COMMIT_HASH}"
mv llvm-project/build "llvm-project/build-${LLVM_COMMIT_HASH}" || true
echo "llvm-build-sparse-${LLVM_COMMIT_HASH}" > cache_key.txt
echo "Using LLVM commit hash: ${LLVM_COMMIT}"
mv llvm-project/build "llvm-project/build-${LLVM_COMMIT}" || true
echo "llvm-build-sparse-${LLVM_COMMIT}" > cache_key.txt
- name: Cache LLVM Build (with hash)
uses: actions/cache@v4
Expand Down Expand Up @@ -768,67 +773,3 @@ jobs:
# 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


# osxtests:
# strategy:
# fail-fast: false
# matrix:
# backend: [ptx]

# 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


0 comments on commit a68de1d

Please sign in to comment.