From 7ba75a3b35b82d9b328ba624ff89530912db70cd Mon Sep 17 00:00:00 2001 From: mengfeil Date: Thu, 12 Dec 2024 15:11:54 +0800 Subject: [PATCH 1/6] modify --- .github/scripts/apply_torch_pr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/apply_torch_pr.py b/.github/scripts/apply_torch_pr.py index d48121ff6..89fa32fdf 100644 --- a/.github/scripts/apply_torch_pr.py +++ b/.github/scripts/apply_torch_pr.py @@ -58,7 +58,7 @@ def appyly_pr(pr_info, re_apply_msg): pr_file = pr_info["diff_url"].split("/")[-1] urllib.request.urlretrieve(pr_info["diff_url"], pr_file) # apply diff - apply_cmd = "git apply --3way " + pr_file + " && rm -f " + pr_file + apply_cmd = "git apply --3way " + pr_file apply_info = subprocess.Popen(apply_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) apply_message = apply_info.communicate()[0].decode("utf-8") apply_status = apply_info.returncode From 69af7e5bfd51bb951a3fc5a540ded0307051a8d3 Mon Sep 17 00:00:00 2001 From: mengfeil Date: Thu, 12 Dec 2024 15:22:42 +0800 Subject: [PATCH 2/6] checkout right torch & xpu ops versions for whl test --- .github/workflows/_linux_ut.yml | 11 ++++++++++- .github/workflows/nightly_ondemand_whl.yml | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index d2f717230..553d993fb 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -98,13 +98,13 @@ jobs: source activate xpu_op_${ZE_AFFINITY_MASK} source .github/scripts/env.sh pip install mkl-static==2025.0.1 mkl-include==2025.0.1 - cd ../pytorch if [[ ${{ inputs.abi }} == '0' ]]; then export _GLIBCXX_USE_CXX11_ABI=0 else export _GLIBCXX_USE_CXX11_ABI=1 fi if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then + cd ../pytorch export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"} pip install -r requirements.txt WERROR=1 python setup.py bdist_wheel @@ -112,6 +112,15 @@ jobs: git clone https://github.com/pytorch/vision && cd vision && python setup.py install && cd .. else pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu + TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)') + cd ../pytorch + git reset --hard && git checkout ${TORCH_COMMIT_ID} + TORCH_XPU_OPS_COMMIT=$(> "${GITHUB_ENV}" - echo "TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" + TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)') + echo "TORCH_COMMIT_ID=${TORCH_COMMIT_ID}" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" source .github/scripts/env.sh cd ../ && rm -rf pytorch git clone https://github.com/pytorch/pytorch pytorch @@ -118,7 +119,8 @@ jobs: python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py git status && git show -s pip install -r requirements.txt - echo "TORCH_XPU_OPS_COMMIT=$(> "${GITHUB_ENV}" + TORCH_XPU_OPS_COMMIT=$(> "${GITHUB_ENV}" rm -rf third_party/torch-xpu-ops git clone https://github.com/intel/torch-xpu-ops.git third_party/torch-xpu-ops cd third_party/torch-xpu-ops From 6d32e88465c920a8e5df8b01053f685e5b3cc0a7 Mon Sep 17 00:00:00 2001 From: mengfeil Date: Thu, 12 Dec 2024 15:28:41 +0800 Subject: [PATCH 3/6] modify --- .github/workflows/_linux_ut.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index 553d993fb..e8f948635 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -65,19 +65,21 @@ jobs: conda create -n xpu_op_${ZE_AFFINITY_MASK} python=${{ inputs.python }} cmake ninja -y source activate xpu_op_${ZE_AFFINITY_MASK} cd ../ && rm -rf pytorch - git clone https://github.com/pytorch/pytorch pytorch - cd pytorch && git checkout $(echo ${{ inputs.pytorch }} |sed 's/^nightly_wheel$/nightly/') - # apply PRs for stock pytorch pip install requests - python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py - git status && git show -s - git submodule sync && git submodule update --init --recursive - if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then - echo "Don't replace torch-xpu-ops!" - else - rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/ - # Workaround for torch-xpu-ops ci test - sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt + git clone https://github.com/pytorch/pytorch pytorch + if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then + cd pytorch && git checkout $(echo ${{ inputs.pytorch }}) + # apply PRs for stock pytorch + python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py + git status && git show -s + git submodule sync && git submodule update --init --recursive + if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then + echo "Don't replace torch-xpu-ops!" + else + rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/ + # Workaround for torch-xpu-ops ci test + sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt + fi fi - name: Triton Installation run: | From 5996263b922db6f4a960d899362495708f3f4c68 Mon Sep 17 00:00:00 2001 From: mengfeil Date: Thu, 12 Dec 2024 15:29:28 +0800 Subject: [PATCH 4/6] modify --- .github/workflows/nightly_ondemand_whl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly_ondemand_whl.yml b/.github/workflows/nightly_ondemand_whl.yml index 2046c8567..90ac52179 100644 --- a/.github/workflows/nightly_ondemand_whl.yml +++ b/.github/workflows/nightly_ondemand_whl.yml @@ -116,7 +116,7 @@ jobs: cd pytorch && git checkout ${TORCH_COMMIT_ID} # apply PRs for stock pytorch pip install requests - python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py + # python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py git status && git show -s pip install -r requirements.txt TORCH_XPU_OPS_COMMIT=$( Date: Thu, 12 Dec 2024 15:34:50 +0800 Subject: [PATCH 5/6] modify --- .github/workflows/nightly_ondemand_whl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly_ondemand_whl.yml b/.github/workflows/nightly_ondemand_whl.yml index 90ac52179..4ffc2e0e9 100644 --- a/.github/workflows/nightly_ondemand_whl.yml +++ b/.github/workflows/nightly_ondemand_whl.yml @@ -140,7 +140,7 @@ jobs: echo "MODEL_ONLY_NAME=${{ inputs.model }}" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" echo "DRIVER_VERSION=$(dkms status 2>&1 |grep 'intel-i915-dkms' |sed 's/.*\///;s/,.*//')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" echo "KERNEL_VERSION=$(uname -rv 2>&1)" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" - echo "BUNDLE_VERSION=$(dpcpp --version 2>&1 |grep 'DPC++/C++' |sed 's/.*(//;s/).*//')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" + echo "BUNDLE_VERSION=$(pip list |grep cmplr |head -n 1)" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" . /etc/os-release echo "OS_PRETTY_NAME=${PRETTY_NAME}" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" echo "GCC_VERSION=$(gcc -dumpversion)" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" From 39cacd01aefb92cfc78f5343d0142109c1b27d4b Mon Sep 17 00:00:00 2001 From: mengfeil Date: Thu, 12 Dec 2024 15:47:59 +0800 Subject: [PATCH 6/6] Don't need source DL-Essential for nightly wheel test --- .github/actions/inductor-xpu-e2e-test/action.yml | 4 ++-- .github/scripts/env.sh | 11 ++++++++--- .github/workflows/_linux_ut.yml | 14 +++++++------- .github/workflows/nightly_ondemand_whl.yml | 2 -- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/actions/inductor-xpu-e2e-test/action.yml b/.github/actions/inductor-xpu-e2e-test/action.yml index 4f81534fd..4e1fce079 100644 --- a/.github/actions/inductor-xpu-e2e-test/action.yml +++ b/.github/actions/inductor-xpu-e2e-test/action.yml @@ -51,7 +51,7 @@ runs: shell: bash run: | source activate e2e_ci - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} if [[ ${{ inputs.suite }} == *"torchbench"* ]]; then if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then cd ../ && rm -rf audio && git clone --single-branch -b main https://github.com/pytorch/audio.git @@ -94,7 +94,7 @@ runs: shell: bash run: | source activate e2e_ci - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} cp .github/scripts/inductor_xpu_test.sh ../pytorch cd ../pytorch diff --git a/.github/scripts/env.sh b/.github/scripts/env.sh index 56d8e3930..4fd192c06 100644 --- a/.github/scripts/env.sh +++ b/.github/scripts/env.sh @@ -1,4 +1,9 @@ #!/bin/bash -source /opt/intel/oneapi/compiler/latest/env/vars.sh -source /opt/intel/oneapi/umf/latest/env/vars.sh -source /opt/intel/oneapi/pti/latest/env/vars.sh + +if [ "$1" != "nightly_wheel" ];then + source /opt/intel/oneapi/compiler/latest/env/vars.sh + source /opt/intel/oneapi/umf/latest/env/vars.sh + source /opt/intel/oneapi/pti/latest/env/vars.sh +else + echo "Don't need to source DL-Essential for nightly wheel" +fi diff --git a/.github/workflows/_linux_ut.yml b/.github/workflows/_linux_ut.yml index e8f948635..b724d4259 100644 --- a/.github/workflows/_linux_ut.yml +++ b/.github/workflows/_linux_ut.yml @@ -98,7 +98,7 @@ jobs: - name: Build Pytorch XPU run: | source activate xpu_op_${ZE_AFFINITY_MASK} - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} pip install mkl-static==2025.0.1 mkl-include==2025.0.1 if [[ ${{ inputs.abi }} == '0' ]]; then export _GLIBCXX_USE_CXX11_ABI=0 @@ -128,7 +128,7 @@ jobs: - name: Torch Config run: | source activate xpu_op_${ZE_AFFINITY_MASK} - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} python -c "import torch; print(torch.__config__.show())" python -c "import torch; print(torch.__config__.parallel_info())" python -c "import torch; print(torch.__config__.torch.xpu.device_count())" @@ -143,7 +143,7 @@ jobs: run: | cd ${{ github.workspace }} xpu-smi discovery - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} source activate xpu_op_${ZE_AFFINITY_MASK} cd ${{ github.workspace }} cd test/regressions @@ -154,7 +154,7 @@ jobs: run: | cd ${{ github.workspace }} xpu-smi discovery - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} source activate xpu_op_${ZE_AFFINITY_MASK} export ZE_AFFINITY_MASK_OLD=${ZE_AFFINITY_MASK} unset ZE_AFFINITY_MASK @@ -166,7 +166,7 @@ jobs: - name: Run XPU OP Extended UT if: contains(inputs.ut, 'op_extended') || github.event_name == 'schedule' run: | - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} source activate xpu_op_${ZE_AFFINITY_MASK} export PYTORCH_TEST_WITH_SLOW=1 cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/ @@ -174,7 +174,7 @@ jobs: - name: Run XPU OP UT if: contains(inputs.ut, 'op_ut') || github.event_name == 'schedule' run: | - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} source activate xpu_op_${ZE_AFFINITY_MASK} export PYTORCH_ENABLE_XPU_FALLBACK=1 export PYTORCH_TEST_WITH_SLOW=1 @@ -188,7 +188,7 @@ jobs: - name: Run Torch XPU UT if: contains(inputs.ut, 'torch_xpu') || github.event_name == 'schedule' run: | - source .github/scripts/env.sh + source .github/scripts/env.sh ${{ inputs.pytorch }} source activate xpu_op_${ZE_AFFINITY_MASK} cd ../pytorch TEST_REPORTS_DIR=$(pwd)/test/test-reports diff --git a/.github/workflows/nightly_ondemand_whl.yml b/.github/workflows/nightly_ondemand_whl.yml index 4ffc2e0e9..efed58f4e 100644 --- a/.github/workflows/nightly_ondemand_whl.yml +++ b/.github/workflows/nightly_ondemand_whl.yml @@ -110,7 +110,6 @@ jobs: echo "TORCH_BRANCH_ID=$(python -c 'import torch; print(torch.__version__)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)') echo "TORCH_COMMIT_ID=${TORCH_COMMIT_ID}" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" - source .github/scripts/env.sh cd ../ && rm -rf pytorch git clone https://github.com/pytorch/pytorch pytorch cd pytorch && git checkout ${TORCH_COMMIT_ID} @@ -129,7 +128,6 @@ jobs: id: pinned run: | source activate e2e_ci - source .github/scripts/env.sh echo "TORCHVISION_COMMIT_ID=$(python -c 'import torchvision; print(torchvision.version.git_version)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" echo "TORCHAUDIO_COMMIT_ID=$(python -c 'import torchaudio; print(torchaudio.version.git_version)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}" echo "TRITON_COMMIT_ID=$(python -c 'import triton; print(triton.__version__)')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}"