|
| 1 | +name: Get Runner Infos |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + test_type: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + description: Test scope |
| 10 | + pytorch: |
| 11 | + type: string |
| 12 | + default: 'main' |
| 13 | + description: Pytorch main by default, or 'commit/branch', or 'repo@commit/repo@branch' |
| 14 | + torch_xpu_ops: |
| 15 | + type: string |
| 16 | + default: 'main' |
| 17 | + description: Torch-xpu-ops main by default, 'commit/branch', or 'repo@commit/repo@branch', or 'pinned' for pytorch pin |
| 18 | + oneapi: |
| 19 | + type: string |
| 20 | + default: 'installed' |
| 21 | + description: Installed oneAPI DLE on host by default, fill offline.sh url if needed |
| 22 | + python: |
| 23 | + type: string |
| 24 | + default: '3.10' |
| 25 | + description: Python version |
| 26 | + |
| 27 | +permissions: read-all |
| 28 | + |
| 29 | +runs: |
| 30 | + using: composite |
| 31 | + steps: |
| 32 | + - name: Setup gh |
| 33 | + uses: actions4gh/setup-gh@v1 |
| 34 | + - name: Setup gcc |
| 35 | + uses: Dup4/actions-setup-gcc@v1 |
| 36 | + with: |
| 37 | + version: 11 |
| 38 | + - name: Setup python-${{ inputs.python }} |
| 39 | + uses: actions/setup-python@v5 |
| 40 | + with: |
| 41 | + python-version: ${{ inputs.python }} |
| 42 | + - name: Check runner |
| 43 | + run: | |
| 44 | + ls -al |
| 45 | + find ./ |grep -v "^\./$" |xargs rm -rf |
| 46 | + hostname && whoami && id |
| 47 | + cat /etc/os-release |
| 48 | + gcc -v && g++ -v |
| 49 | + which python && which pip |
| 50 | + python -V |
| 51 | + pip install -U pip wheel setuptools |
| 52 | + pip list |
| 53 | + uname -a |
| 54 | + dpkg -l |grep -E 'libigc-dev|libze-dev|level-zero-dev' |
| 55 | + clinfo --list |
| 56 | + cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor |sort |uniq -c |
| 57 | + - name: Checkout torch-xpu-ops |
| 58 | + uses: actions/checkout@v4 |
| 59 | + with: |
| 60 | + path: torch-xpu-ops |
| 61 | + - name: Install oneAPI DLE |
| 62 | + if: ${{ inputs.oneapi != 'installed' }} |
| 63 | + run: | |
| 64 | + rm -rf ~/intel ~/.intel |
| 65 | + wget -q -O oneapi.sh "${{ inputs.oneapi }}" |
| 66 | + bash oneapi.sh -a -s --eula accept --action install --install-dir ${HOME}/intel/oneapi |
| 67 | + echo "XPU_ONEAPI_PATH=${HOME}/intel/oneapi" >> ${GITHUB_ENV} |
| 68 | + - name: Download Pytorch wheel |
| 69 | + if: ${{ ! contains(inputs.test_type, 'wheel') }} |
| 70 | + uses: actions/download-artifact@v4 |
| 71 | + with: |
| 72 | + pattern: Torch-XPU-Wheel-* |
| 73 | + - name: Prepare Stock Pytorch |
| 74 | + run: | |
| 75 | + # install pytorch |
| 76 | + if [ $(echo "${{ inputs.pytorch }}" |grep -w "release_wheel" |wc -l) -ne 0 ];then |
| 77 | + pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/xpu |
| 78 | + elif [ $(echo "${{ inputs.pytorch }}" |grep -w "test_wheel" |wc -l) -ne 0 ];then |
| 79 | + pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/test/xpu |
| 80 | + elif [ $(echo "${{ inputs.pytorch }}" |grep -w "nightly_wheel" |wc -l) -ne 0 ];then |
| 81 | + pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu |
| 82 | + else |
| 83 | + pip install --force-reinstall ${{ github.workspace }}/*.whl |
| 84 | + fi |
| 85 | + TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)') |
| 86 | + if [[ "${{ inputs.pytorch }}" == *"https://"* ]];then |
| 87 | + PYTORCH_REPO="$(echo ${{ inputs.pytorch }} |sed 's/@.*//')" |
| 88 | + else |
| 89 | + PYTORCH_REPO="https://github.com/pytorch/pytorch.git" |
| 90 | + fi |
| 91 | + git clone ${PYTORCH_REPO} pytorch |
| 92 | + cd pytorch |
| 93 | + git checkout ${TORCH_COMMIT_ID} |
| 94 | + pip install -r .ci/docker/requirements-ci.txt |
| 95 | + # apply extra PRs for stock pytorch |
| 96 | + if [[ "${{ inputs.test_type }}" == *"cicd"* ]];then |
| 97 | + python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py -e https://github.com/pytorch/pytorch/pull/152940 |
| 98 | + else |
| 99 | + python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py |
| 100 | + fi |
| 101 | + git status && git diff && git show -s |
| 102 | + - name: Prepare Torch-xpu-ops |
| 103 | + if: ${{ inputs.torch_xpu_ops != 'skipped' }} |
| 104 | + run: | |
| 105 | + cd pytorch |
| 106 | + rm -rf third_party/torch-xpu-ops |
| 107 | + if [[ "${{ inputs.torch_xpu_ops }}" == *"https://"* ]];then |
| 108 | + TORCH_XPU_OPS_REPO="$(echo ${{ inputs.torch_xpu_ops }} |sed 's/@.*//')" |
| 109 | + TORCH_XPU_OPS_COMMIT="$(echo ${{ inputs.torch_xpu_ops }} |sed 's/.*@//')" |
| 110 | + else |
| 111 | + TORCH_XPU_OPS_REPO="https://github.com/intel/torch-xpu-ops.git" |
| 112 | + if [ "${{ inputs.torch_xpu_ops }}" == "pinned" ];then |
| 113 | + TORCH_XPU_OPS_COMMIT="$(cat third_party/xpu.txt)" |
| 114 | + else |
| 115 | + TORCH_XPU_OPS_COMMIT="${{ inputs.torch_xpu_ops }}" |
| 116 | + fi |
| 117 | + fi |
| 118 | + if [ "${{ inputs.test_type }}" == "cicd" ];then |
| 119 | + cp -r ${{ github.workspace }}/torch-xpu-ops third_party/torch-xpu-ops |
| 120 | + else |
| 121 | + git clone ${TORCH_XPU_OPS_REPO} third_party/torch-xpu-ops |
| 122 | + fi |
| 123 | + cd third_party/torch-xpu-ops |
| 124 | + git checkout ${TORCH_XPU_OPS_COMMIT} |
| 125 | + git status && git diff && git show -s |
| 126 | + - name: Torch Config |
| 127 | + run: | |
| 128 | + printenv |
| 129 | + python -c "import torch; print(torch.__config__.show())" |
| 130 | + python -c "import torch; print(torch.__config__.parallel_info())" |
| 131 | + python -c "import torch; print(torch.__config__.torch.xpu.device_count())" |
| 132 | + python -c "import torchvision; print(torchvision.__version__)" |
| 133 | + python -c "import torchaudio; print(torchaudio.__version__)" |
| 134 | + python -c "import triton; print(triton.__version__)" |
| 135 | + python pytorch/torch/utils/collect_env.py |
| 136 | + pip list |grep -E 'torch|intel' |
0 commit comments