33
33
type : string
34
34
default : ' lts'
35
35
description : Driver lts/rolling
36
+ update_lkg :
37
+ required : false
38
+ type : string
39
+ default : ' false'
40
+ description : Whether update LKG torch version to issue # 1280
36
41
outputs :
37
- whl_name :
38
- description : The name of the wheel file
39
- value : ${{ jobs.build.outputs.whl_name }}
40
42
torch_commit_id :
41
43
description : The commit id of the torch build
42
44
value : ${{ jobs.build.outputs.TORCH_COMMIT_ID }}
@@ -46,7 +48,6 @@ permissions:
46
48
47
49
jobs :
48
50
build :
49
- if : ${{ inputs.pytorch }} != 'nightly_wheel'
50
51
runs-on : ${{ inputs.runner }}
51
52
outputs :
52
53
TORCH_COMMIT_ID : ${{ steps.build_version.outputs.TORCH_COMMIT_ID }}
@@ -65,24 +66,22 @@ jobs:
65
66
which conda && conda clean -ay
66
67
conda remove --all -y -n xpu_build || \
67
68
rm -rf $(dirname ${CONDA_EXE})/../envs/xpu_build
68
- conda create -n xpu_build python=${{ inputs.python }} cmake ninja -y
69
+ conda create -n xpu_build python=${{ inputs.python }} cmake=3.28 ninja -y
69
70
source activate xpu_build
70
71
cd ../ && rm -rf pytorch
71
72
pip install requests
72
73
git clone https://github.com/pytorch/pytorch pytorch
73
- if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
74
- cd pytorch && git checkout $(echo ${{ inputs.pytorch }})
75
- # apply PRs for stock pytorch
76
- python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py
77
- git status && git show -s
78
- git submodule sync && git submodule update --init --recursive
79
- if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then
80
- echo "Don't replace torch-xpu-ops!"
81
- else
82
- rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/
83
- # Workaround for torch-xpu-ops ci test
84
- sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt
85
- fi
74
+ cd pytorch && git checkout $(echo ${{ inputs.pytorch }})
75
+ # apply PRs for stock pytorch
76
+ python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py
77
+ git status && git show -s
78
+ git submodule sync && git submodule update --init --recursive
79
+ if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then
80
+ echo "Don't replace torch-xpu-ops!"
81
+ else
82
+ rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/
83
+ # Workaround for torch-xpu-ops ci test
84
+ sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt
86
85
fi
87
86
- name : Build Pytorch XPU
88
87
run : |
@@ -100,74 +99,64 @@ jobs:
100
99
else
101
100
export _GLIBCXX_USE_CXX11_ABI=1
102
101
fi
103
- if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
104
- build_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
105
- repo="${{ github.repository }}"
106
- last_commit=$(gh --repo $repo issue view $commit_issue --json body -q .body | grep ${{ inputs.pytorch }} | cut -d'[' -f 2 | cut -d']' -f 1)
107
- cd ../pytorch
108
- current_commit=$(git rev-parse HEAD)
109
- is_fork_pr=false
110
- if [ -n "${{ github.event.pull_request }}" ] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
111
- is_fork_pr=true
112
- fi
113
- echo ">>>>>>>>>>>>Fork PR: ${is_fork_pr}, pytorch branch: ${{ inputs.pytorch }}, last commit: ${last_commit}, current commit: ${current_commit}"
102
+ build_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
103
+ repo="${{ github.repository }}"
104
+ last_commit=$(gh --repo $repo issue view $commit_issue --json body -q .body | grep ${{ inputs.pytorch }} | cut -d'[' -f 2 | cut -d']' -f 1)
105
+ cd ../pytorch
106
+ current_commit=$(git rev-parse HEAD)
107
+ is_fork_pr=false
108
+ if [ -n "${{ github.event.pull_request }}" ] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
109
+ is_fork_pr=true
110
+ fi
111
+ echo ">>>>>>>>>>>>Fork PR: ${is_fork_pr}, pytorch branch: ${{ inputs.pytorch }}, last commit: ${last_commit}, current commit: ${current_commit}"
114
112
115
- export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
116
- pip install -r requirements.txt
117
- WERROR=1 python setup.py bdist_wheel 2>&1 | tee pytorch_${current_commit}_build.log
113
+ export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
114
+ pip install -r requirements.txt
115
+ WERROR=1 python setup.py bdist_wheel 2>&1 | tee pytorch_${current_commit}_build.log
118
116
119
- if [[ "${is_fork_pr}" == "false" ]]; then
120
- if [ -f dist/torch*.whl ] && [ "${last_commit}" != "${current_commit}" ] && [[ "${{ inputs.pytorch }}" == "main" || "${{ inputs.pytorch }}" == "release/"* ]]; then
121
- echo "Wheel build successful, update last commit in the issue https://github.com/intel/torch-xpu-ops/issues/1280"
122
- gh --repo $repo issue view $commit_issue --json body -q .body | sed "s;${last_commit};${current_commit};g" | sed '/^$/d' > new_body.txt
123
- gh --repo $repo issue edit $commit_issue --body-file new_body.txt
124
- fi
125
- if [ ! -f dist/torch*.whl ]; then
126
- echo "Wheel build failed, use last commit in the issue https://github.com/intel/torch-xpu-ops/issues/1280"
127
- gh --repo $repo issue comment $commit_issue -b "Wheel build failed with commit [${current_commit}](https://github.com/pytorch/pytorch/tree/${current_commit}), refer ${build_url}. CC @intel/torch-xpu-ops-maintain @EikanWang @riverliuintel @fengyuan14 @xytintel @etaf @chuanqi129 @mengfei25"
128
- python setup.py clean
129
- git clean -df .
130
- git reset --hard
131
- git checkout $last_commit
132
- # apply PRs for stock pytorch
133
- python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py
134
- git status && git show -s
135
- git submodule sync && git submodule update --init --recursive
136
- if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then
137
- echo "Don't replace torch-xpu-ops!"
138
- else
139
- rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/
140
- # Workaround for torch-xpu-ops ci test
141
- sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt
142
- fi
143
- WERROR=1 python setup.py bdist_wheel
117
+ if [[ "${is_fork_pr}" == "false" ]]; then
118
+ if [ -f dist/torch*.whl ] && \
119
+ [ "${{ inputs.update_lkg }}" == "true" ] && \
120
+ [ "${last_commit}" != "${current_commit}" ] && \
121
+ [[ "${{ inputs.pytorch }}" == "main" || "${{ inputs.pytorch }}" == "release/"* ]]; then
122
+ echo "Wheel build successful, update last commit in the issue https://github.com/intel/torch-xpu-ops/issues/1280"
123
+ gh --repo $repo issue view $commit_issue --json body -q .body | sed "s;${last_commit};${current_commit};g" | sed '/^$/d' > new_body.txt
124
+ gh --repo $repo issue edit $commit_issue --body-file new_body.txt
125
+ gh --repo $repo issue comment $commit_issue -b "Update LKG torch, refer ${build_url}"
126
+ fi
127
+ if [ ! -f dist/torch*.whl ]; then
128
+ echo "Wheel build failed, use last commit in the issue https://github.com/intel/torch-xpu-ops/issues/1280"
129
+ gh --repo $repo issue comment $commit_issue -b "Wheel build failed with commit [${current_commit}](https://github.com/pytorch/pytorch/tree/${current_commit}), refer ${build_url}. CC @intel/torch-xpu-ops-maintain @EikanWang @riverliuintel @fengyuan14 @xytintel @etaf @chuanqi129 @mengfei25"
130
+ python setup.py clean
131
+ git clean -df .
132
+ git reset --hard
133
+ git checkout $last_commit
134
+ # apply PRs for stock pytorch
135
+ python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py
136
+ git status && git show -s
137
+ git submodule sync && git submodule update --init --recursive
138
+ if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then
139
+ echo "Don't replace torch-xpu-ops!"
140
+ else
141
+ rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/
142
+ # Workaround for torch-xpu-ops ci test
143
+ sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt
144
144
fi
145
- else
146
- echo "Forked PR, don't update the issue"
145
+ WERROR=1 python setup.py bdist_wheel
147
146
fi
148
- pip install --force-reinstall dist/*.whl
149
- cp dist/*.whl ${{ github.workspace }}/
150
- cp pytorch_${current_commit}_build.log ${{ github.workspace }}/
151
147
else
152
- pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu
153
- TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)')
154
- cd ../pytorch
155
- git reset --hard && git checkout ${TORCH_COMMIT_ID}
156
- TORCH_XPU_OPS_COMMIT=$(<third_party/xpu.txt)
157
- rm -rf third_party/torch-xpu-ops
158
- git clone https://github.com/intel/torch-xpu-ops.git third_party/torch-xpu-ops
159
- cd third_party/torch-xpu-ops
160
- git checkout ${TORCH_XPU_OPS_COMMIT}
161
- cd ../..
148
+ echo "Forked PR, don't update the issue"
162
149
fi
150
+ pip install --force-reinstall dist/*.whl
151
+ cp dist/*.whl ${{ github.workspace }}/
152
+ cp pytorch_${current_commit}_build.log ${{ github.workspace }}/
163
153
- name : Torch Config
164
154
run : |
165
155
source activate xpu_build
166
156
source .github/scripts/env.sh ${{ inputs.pytorch }}
167
157
python -c "import torch; print(torch.__config__.show())"
168
158
python -c "import torch; print(torch.__config__.parallel_info())"
169
159
python -c "import torch; print(torch.__config__.torch.xpu.device_count())"
170
-
171
160
cd ..
172
161
python pytorch/torch/utils/collect_env.py
173
162
- name : Identify Build version
0 commit comments