|
| 1 | +name: Integration Tests AMD |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + matrix: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + |
| 10 | +jobs: |
| 11 | + integration-tests-amd: |
| 12 | + runs-on: ${{ matrix.runner }} |
| 13 | + timeout-minutes: 45 |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + runner: ${{ fromJson(inputs.matrix) }} |
| 17 | + env: |
| 18 | + RUNNER_TYPE: ${{ matrix.runner[1] }} |
| 19 | + TRITON_BUILD_WITH_CCACHE: "true" |
| 20 | + TRITON_BUILD_WITH_CLANG_LLD: "TRUE" |
| 21 | + TRITON_USE_ASSERT_ENABLED_LLVM: "TRUE" |
| 22 | + TRITON_DISABLE_LINE_INFO: 1 |
| 23 | + PROTON_SKIP_PC_SAMPLING_TEST: 1 |
| 24 | + PYTHON: "python3" |
| 25 | + CCACHE_COMPRESS: "true" |
| 26 | + container: |
| 27 | + image: rocm/pytorch:rocm6.2.2_ubuntu22.04_py3.10_pytorch_2.5.1_asan |
| 28 | + options: --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --user root |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + submodules: 'true' |
| 34 | + - name: Compute cache keys |
| 35 | + id: cache-key |
| 36 | + run: | |
| 37 | + llvm_file="cmake/llvm-hash.txt" |
| 38 | + nvidia_file="cmake/nvidia-toolchain-version.json" |
| 39 | + json_file="cmake/json-version.txt" |
| 40 | +
|
| 41 | + # Check if files exist before proceeding |
| 42 | + if [[ ! -f "$llvm_file" || ! -f "$nvidia_file" || ! -f "$json_file" ]]; then |
| 43 | + echo "Error: Required dependency files are missing." |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +
|
| 47 | + # Process the files if they exist |
| 48 | + echo "llvm=$(cat $llvm_file | cut -c 1-8)" >> $GITHUB_OUTPUT |
| 49 | + echo "nvidia=$(sha256sum $nvidia_file | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT |
| 50 | + echo "json=$(cat $json_file)" >> $GITHUB_OUTPUT |
| 51 | + echo "datetime=$(date -u -Iseconds)" >> $GITHUB_OUTPUT |
| 52 | + shell: bash |
| 53 | + - name: Cache build dependencies |
| 54 | + uses: actions/cache@v4 |
| 55 | + with: |
| 56 | + # Note that we cannot use environment variables here given there is |
| 57 | + # no shell to interpret them in the paths. |
| 58 | + path: | |
| 59 | + ~/.triton/llvm |
| 60 | + ~/.triton/nvidia |
| 61 | + ~/.triton/json |
| 62 | + key: ${{ runner.os }}-${{ runner.arch }}-llvm-${{ steps.cache-key.outputs.llvm }}-nvidia-${{ steps.cache-key.outputs.nvidia }}-json-${{ steps.cache-key.outputs.json }} |
| 63 | + - # Cache ~/.cache/ccache to speed up compilation. |
| 64 | + # |
| 65 | + # On branch `main` we always start from an empty cache, i.e. we skip the |
| 66 | + # "restore" step. This is to prevent the caches from accumulating stale |
| 67 | + # files over time. |
| 68 | + name: Restore cache of ccache and Triton compilation artifacts |
| 69 | + id: restore-build-cache |
| 70 | + if: github.ref != 'refs/heads/main' |
| 71 | + uses: actions/cache/restore@v4 |
| 72 | + with: |
| 73 | + path: | |
| 74 | + ~/.ccache |
| 75 | + # Restore the most recent cache entry. |
| 76 | + restore-keys: | |
| 77 | + triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}- |
| 78 | + triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}- |
| 79 | + # We expect this cache key never to hit and for us to fall back |
| 80 | + # unconditionally to the restore-key, so it doesn't actually matter |
| 81 | + # what we put here (so long as it doesn't hit an existing key). |
| 82 | + key: triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }} |
| 83 | + - name: Inspect cache directories |
| 84 | + run: | |
| 85 | + mkdir -p ~/.triton |
| 86 | + du -h -d 1 ~/.triton |
| 87 | +
|
| 88 | + mkdir -p ~/.ccache |
| 89 | + du -h -d 1 ~/.ccache |
| 90 | + - name: Update compiler to clang |
| 91 | + run: | |
| 92 | + export CC=/usr/bin/clang |
| 93 | + export CXX=/usr/bin/clang++ |
| 94 | + - name: Install Triton |
| 95 | + id: amd-install-triton |
| 96 | + run: | |
| 97 | + echo "PATH is '$PATH'" |
| 98 | + pip uninstall -y triton pytorch-triton-rocm |
| 99 | + ccache --zero-stats |
| 100 | + make dev-install |
| 101 | + - name: CCache Stats |
| 102 | + run: ccache --print-stats |
| 103 | + - name: Run lit tests |
| 104 | + run: make test-lit |
| 105 | + - name: Run python tests on AMD |
| 106 | + run: | |
| 107 | + INSTRUMENTATION_LIB_DIR="${GITHUB_WORKSPACE}/python/triton/instrumentation" |
| 108 | + if [ ! -d "${INSTRUMENTATION_LIB_DIR}" ]; then |
| 109 | + echo "Could not find '${INSTRUMENTATION_LIB_DIR}'" ; exit -1 |
| 110 | + fi |
| 111 | + pytest --capture=tee-sys -rfs python/tutorials/06-fused-attention.py |
| 112 | + pytest --capture=tee-sys -rfs third_party/amd/python/test/test_extract_slice.py |
| 113 | + cd python/test/unit |
| 114 | + pytest --capture=tee-sys -rfs -n 12 language runtime \ |
| 115 | + --ignore=language/test_line_info.py \ |
| 116 | + --ignore=test_debug.py |
| 117 | + # TODO: uncomment |
| 118 | + # pytest --capture=tee-sys -rfs test_debug.py |
| 119 | + TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${INSTRUMENTATION_LIB_DIR}/libGPUInstrumentationTestLib.so \ |
| 120 | + pytest --capture=tee-sys -rfs -vvv instrumentation/test_gpuhello.py |
| 121 | +
|
| 122 | + # Run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0 |
| 123 | + TRITON_DISABLE_LINE_INFO=0 python3 -m pytest -s -n 8 language/test_line_info.py |
| 124 | + - name: Run asan tests on AMD |
| 125 | + if: false |
| 126 | + run: | |
| 127 | + cd third_party/amd/python/test/ |
| 128 | + ulimit -s 1024 |
| 129 | + export PATH=$(find ~/.triton/llvm -name llvm-symbolizer -printf '%h\n'):$PATH |
| 130 | + export LD_LIBRARY_PATH=$(find /opt -name libclang_rt.asan-x86_64.so -printf '%h\n'):$LD_LIBRARY_PATH |
| 131 | + export LD_LIBRARY_PATH=$(find /opt -type d -wholename *lib/llvm/lib/asan):$LD_LIBRARY_PATH |
| 132 | + export LD_LIBRARY_PATH=$(find /usr -name libcaffe2_nvrtc.so -printf '%h\n'):$LD_LIBRARY_PATH |
| 133 | + export CLANG_ASAN_LIB=$(find /opt -name libclang_rt.asan-x86_64.so) |
| 134 | + export HIP_ASAN_LIB=$(find /opt -wholename *lib/asan/libamdhip64.so) |
| 135 | + ASAN_OPTIONS=detect_leaks=0,alloc_dealloc_mismatch=0 \ |
| 136 | + LD_PRELOAD=$CLANG_ASAN_LIB:$HIP_ASAN_LIB python3 -m pytest -s test_address_sanitizer.py |
| 137 | + - name: Run regression tests |
| 138 | + run: | |
| 139 | + # Reenable test_functional_regression.py once it's fixed |
| 140 | + cd python/test/regression |
| 141 | + python3 -m pytest -s -n 8 ./test_cast_matmul.py |
| 142 | + - name: Run Proton tests |
| 143 | + if: ${{ matrix.runner[0] != 'nvidia-gb200' }} |
| 144 | + run: make test-proton |
| 145 | + - name: Run C++ unittests |
| 146 | + run: make test-cpp |
| 147 | + - name: Inspect cache directories |
| 148 | + run: | |
| 149 | + mkdir -p ~/.triton |
| 150 | + du -h -d 1 ~/.triton |
| 151 | +
|
| 152 | + mkdir -p ~/.ccache |
| 153 | + du -h -d 1 ~/.ccache |
| 154 | + - # If we're on branch `main`, save the ccache Triton compilation artifacts |
| 155 | + # to the cache so they can be used by other (non-main) CI runs. |
| 156 | + # |
| 157 | + # (It wouldn't be a problem to save the cache on every run, because github |
| 158 | + # evicts cache entries LRU, but maybe this saves a bit of time in CI.) |
| 159 | + name: Save ccache and Triton compilation artifacts to cache |
| 160 | + if: github.ref == 'refs/heads/main' |
| 161 | + uses: actions/cache/save@v4 |
| 162 | + with: |
| 163 | + path: | |
| 164 | + ~/.ccache |
| 165 | + key: triton-artifacts-${{ runner.os }}-${{ runner.arch }}-${{ env.RUNNER_TYPE }}-llvm-${{ steps.cache-key.outputs.llvm }}-${{ steps.cache-key.outputs.datetime }} |
| 166 | + - name: Clean up caches |
| 167 | + # Always cleanup the worker, even if builds or tests failed |
| 168 | + if: always() |
| 169 | + run: | |
| 170 | + rm -rf ~/.triton |
| 171 | + rm -rf ~/.ccache |
0 commit comments