Skip to content

Commit d408f23

Browse files
authored
Merge branch 'main' into xccl/new_api
2 parents 82e4f96 + 9b212ae commit d408f23

14 files changed

+321
-158
lines changed

.github/workflows/_linux_build.yml

+62-73
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ on:
3333
type: string
3434
default: 'lts'
3535
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
3641
outputs:
37-
whl_name:
38-
description: The name of the wheel file
39-
value: ${{ jobs.build.outputs.whl_name }}
4042
torch_commit_id:
4143
description: The commit id of the torch build
4244
value: ${{ jobs.build.outputs.TORCH_COMMIT_ID }}
@@ -46,7 +48,6 @@ permissions:
4648

4749
jobs:
4850
build:
49-
if: ${{ inputs.pytorch }} != 'nightly_wheel'
5051
runs-on: ${{ inputs.runner }}
5152
outputs:
5253
TORCH_COMMIT_ID: ${{ steps.build_version.outputs.TORCH_COMMIT_ID }}
@@ -65,24 +66,22 @@ jobs:
6566
which conda && conda clean -ay
6667
conda remove --all -y -n xpu_build || \
6768
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
6970
source activate xpu_build
7071
cd ../ && rm -rf pytorch
7172
pip install requests
7273
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
8685
fi
8786
- name: Build Pytorch XPU
8887
run: |
@@ -100,74 +99,64 @@ jobs:
10099
else
101100
export _GLIBCXX_USE_CXX11_ABI=1
102101
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}"
114112
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
118116
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
144144
fi
145-
else
146-
echo "Forked PR, don't update the issue"
145+
WERROR=1 python setup.py bdist_wheel
147146
fi
148-
pip install --force-reinstall dist/*.whl
149-
cp dist/*.whl ${{ github.workspace }}/
150-
cp pytorch_${current_commit}_build.log ${{ github.workspace }}/
151147
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"
162149
fi
150+
pip install --force-reinstall dist/*.whl
151+
cp dist/*.whl ${{ github.workspace }}/
152+
cp pytorch_${current_commit}_build.log ${{ github.workspace }}/
163153
- name: Torch Config
164154
run: |
165155
source activate xpu_build
166156
source .github/scripts/env.sh ${{ inputs.pytorch }}
167157
python -c "import torch; print(torch.__config__.show())"
168158
python -c "import torch; print(torch.__config__.parallel_info())"
169159
python -c "import torch; print(torch.__config__.torch.xpu.device_count())"
170-
171160
cd ..
172161
python pytorch/torch/utils/collect_env.py
173162
- name: Identify Build version

.github/workflows/nightly_ondemand.yml

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
abi: 1
8080
python: ${{ github.event_name == 'schedule' && '3.10' || inputs.python }}
8181
runner: pvc_e2e
82+
update_lkg: 'true'
8283

8384
Linux-Nightly-Ondemand-UT-Tests:
8485
if: ${{ github.event_name == 'schedule' || inputs.ut != '' }}

.github/workflows/nightly_ondemand_rolling.yml

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
python: ${{ github.event_name == 'schedule' && '3.10' || inputs.python }}
8282
driver: rolling
8383
runner: pvc_rolling
84+
update_lkg: 'true'
8485

8586
Linux-Nightly-Ondemand-UT-Tests-Rolling:
8687
if: ${{ github.event_name == 'schedule' || inputs.ut != '' }}

cmake/BuildFlags.cmake

+1-4
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
8383
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -fno-approx-func)
8484
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -Wno-absolute-value)
8585
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -no-ftz)
86-
# Equivalent to build option -fpreview-breaking-changes for SYCL compiler.
87-
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -D__INTEL_PREVIEW_BREAKING_CHANGES)
88-
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI})
8986
endif()
9087
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -D__INTEL_LLVM_COMPILER_VERSION=${__INTEL_LLVM_COMPILER})
9188

@@ -113,7 +110,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
113110
set(SYCL_DEVICE_LINK_FLAGS ${SYCL_DEVICE_LINK_FLAGS} --offload-compress)
114111

115112
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-poison-unsupported-fp64-kernels")
116-
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-intel-128-GRF-per-thread")
113+
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-intel-enable-auto-large-GRF-mode")
117114
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-fp32-correctly-rounded-divide-sqrt")
118115
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "${SYCL_OFFLINE_COMPILER_CG_OPTIONS} -cl-intel-greater-than-4GB-buffer-required")
119116
set(SYCL_OFFLINE_COMPILER_CG_OPTIONS "-options '${SYCL_OFFLINE_COMPILER_CG_OPTIONS}'")

cmake/Modules/FindSYCLToolkit.cmake

-7
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,6 @@ set(SYCL_FLAGS "")
171171
set(SYCL_LINK_FLAGS "")
172172
list(APPEND SYCL_FLAGS "-fsycl")
173173
list(APPEND SYCL_LINK_FLAGS "-fsycl")
174-
if(LINUX)
175-
string(REGEX MATCH "libsycl-preview.so" is_abi_neutral ${SYCL_LIBRARY})
176-
if(is_abi_neutral)
177-
list(APPEND SYCL_FLAGS "-fpreview-breaking-changes")
178-
list(APPEND SYCL_LINK_FLAGS "-fpreview-breaking-changes")
179-
endif()
180-
endif()
181174

182175
set(SYCL_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SYCL_FLAGS}")
183176

src/ATen/native/transformers/Attention.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ std::tuple<Tensor, Tensor, Tensor> transform_bias_rescale_qkv_xpu(
3838
auto T = qkv.is_nested() ? native::NestedTensor_get_max_size(
3939
*native::get_nested_tensor_impl(qkv))[0]
4040
: qkv.size(1);
41-
if (qkv.is_nested()) {
42-
// Don't mess with non-nested case for now since it's not set up to fiddle
43-
// with mask size.
44-
45-
// Round T up to next multiple of 8 so as to be able to utilize Tensor
46-
// cores. Otherwise, sometimes with padding, *no* row will have the maximum
47-
// sequence length and so we'll have a non-divisible-by-8 dimension even if
48-
// the model author chose a multiple of 8.
49-
T = T + (8 - (T % 8)) % 8;
50-
}
5141
auto _3D = qkv_bias.size(0);
5242
auto D = _3D / 3;
5343
TORCH_CHECK(D % num_head == 0);

src/ATen/native/xpu/AdaptiveAveragePooling2d.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
#include <comm/xpu_aten.h>
77

8-
#include <ATen/ops/mean.h>
9-
#include <ATen/ops/zeros_like.h>
108
#include <ATen/ops/_adaptive_avg_pool2d_backward_native.h>
119
#include <ATen/ops/_adaptive_avg_pool2d_native.h>
10+
#include <ATen/ops/mean.h>
11+
#include <ATen/ops/zeros_like.h>
1212

1313
#include <ATen/native/xpu/sycl/AdaptiveAveragePooling2dKernels.h>
1414

@@ -22,6 +22,13 @@ Tensor adaptive_avg_pool2d_backward_xpu(
2222

2323
native::adaptive_pool_empty_output_check(
2424
grad_output, "adaptive_avg_pool2d_backward");
25+
TORCH_CHECK(
26+
input.dim() == grad_output.dim(),
27+
__func__,
28+
": Expected dimensions ",
29+
input.dim(),
30+
" for `gradOutput_` but got dimensions ",
31+
grad_output.dim());
2532

2633
checkAllSameGPU(__func__, {grad_output_arg, input_arg});
2734

src/ATen/native/xpu/sycl/AdaptiveAveragePooling3dKernels.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,13 @@ void adaptive_avg_pool3d_backward_kernel(
563563
TensorArg input_arg{input, "input", 3};
564564

565565
adaptive_pool_empty_output_check(gradOutput_, "adaptive_avg_pool3d_backward");
566+
TORCH_CHECK(
567+
input.dim() == gradOutput_.dim(),
568+
__func__,
569+
": Expected dimensions ",
570+
input.dim(),
571+
" for `gradOutput_` but got dimensions ",
572+
gradOutput_.dim());
566573

567574
checkAllSameGPU(
568575
"adaptive_avg_pool3d_backward_xpu",

0 commit comments

Comments
 (0)