23
23
type : string
24
24
default : ' '
25
25
description : UT scope. `op_regression,op_regression_dev1,op_extended,op_ut,torch_xpu` Delimiter is comma
26
- abi :
27
- required : false
28
- type : string
29
- default : ' 1'
30
- description : ABI version. Default abi as 1.
31
26
python :
32
27
required : false
33
28
type : string
@@ -49,7 +44,7 @@ permissions: read-all
49
44
jobs :
50
45
ut_test :
51
46
runs-on : ${{ inputs.runner }}
52
- if : ${{ inputs.ut != 'xpu_distributed' || inputs.ut != 'pytorch_distributed' }}
47
+ if : ${{ inputs.ut != 'xpu_distributed' && inputs.ut != 'pytorch_distributed' }}
53
48
timeout-minutes : 900
54
49
env :
55
50
NEOReadDebugKeys : ${{ inputs.driver == 'rolling' && '1' || '0' }}
@@ -100,18 +95,13 @@ jobs:
100
95
if : ${{ inputs.pytorch != 'nightly_wheel' }}
101
96
uses : actions/download-artifact@v4
102
97
with :
103
- name : Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}-${{ inputs.abi }}
98
+ name : Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}-${{ inputs.pytorch }}
104
99
path : ${{ github.workspace }}
105
100
- name : Install Pytorch XPU
106
101
run : |
107
102
source activate xpu_op_${ZE_AFFINITY_MASK}
108
103
source .github/scripts/env.sh ${{ inputs.pytorch }}
109
104
pip install mkl-static==2025.0.1 mkl-include==2025.0.1
110
- if [[ ${{ inputs.abi }} == '0' ]]; then
111
- export _GLIBCXX_USE_CXX11_ABI=0
112
- else
113
- export _GLIBCXX_USE_CXX11_ABI=1
114
- fi
115
105
if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
116
106
cd ../pytorch
117
107
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
@@ -293,7 +283,7 @@ jobs:
293
283
if : always()
294
284
uses : actions/upload-artifact@v4
295
285
with :
296
- name : Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-${{ inputs.abi }}-${{ env.UT_NAME }}
286
+ name : Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-${{ env.UT_NAME }}
297
287
path : ${{ github.workspace }}/ut_log
298
288
299
289
distributed_ut_test :
@@ -349,18 +339,13 @@ jobs:
349
339
if : ${{ inputs.pytorch != 'nightly_wheel' }}
350
340
uses : actions/download-artifact@v4
351
341
with :
352
- name : Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}-${{ inputs.abi }}
342
+ name : Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}-${{ inputs.pytorch }}
353
343
path : ${{ github.workspace }}
354
344
- name : Install Pytorch XPU
355
345
run : |
356
346
source activate xpu_op_${ZE_AFFINITY_MASK}
357
347
source .github/scripts/env.sh ${{ inputs.pytorch }}
358
348
pip install mkl-static==2025.0.1 mkl-include==2025.0.1
359
- if [[ ${{ inputs.abi }} == '0' ]]; then
360
- export _GLIBCXX_USE_CXX11_ABI=0
361
- else
362
- export _GLIBCXX_USE_CXX11_ABI=1
363
- fi
364
349
if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
365
350
cd ../pytorch
366
351
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
@@ -433,7 +418,142 @@ jobs:
433
418
if : ${{ ! cancelled() }}
434
419
uses : actions/upload-artifact@v4
435
420
with :
436
- name : Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-${{ inputs.abi }}-xpu_distributed
421
+ name : Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-xpu_distributed
422
+ path : ${{ github.workspace }}/ut_log
423
+
424
+ pytorch_distributed_test :
425
+ runs-on : ${{ inputs.runner }}
426
+ if : contains(inputs.ut, 'pytorch_distributed')
427
+ timeout-minutes : 900
428
+ env :
429
+ NEOReadDebugKeys : ${{ inputs.driver == 'rolling' && '1' || '0' }}
430
+ DisableScratchPages : ${{ inputs.driver == 'rolling' && '1' || '0' }}
431
+ steps :
432
+ - name : Checkout torch-xpu-ops
433
+ uses : actions/checkout@v4
434
+ - name : Prepare Stock Pytorch
435
+ run : |
436
+ pwd
437
+ which conda && conda clean -ay
438
+ conda remove --all -y -n xpu_op_${ZE_AFFINITY_MASK} || \
439
+ rm -rf $(dirname ${CONDA_EXE})/../envs/xpu_op_${ZE_AFFINITY_MASK}
440
+ conda create -n xpu_op_${ZE_AFFINITY_MASK} python=${{ inputs.python }} cmake ninja -y
441
+ source activate xpu_op_${ZE_AFFINITY_MASK}
442
+ cd ../ && rm -rf pytorch
443
+ pip install requests
444
+ git clone https://github.com/daisyden/pytorch.git pytorch
445
+ if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
446
+ cd pytorch && git checkout $(echo ${{ inputs.pytorch }})
447
+ # apply PRs for stock pytorch
448
+ python ../torch-xpu-ops/.github/scripts/apply_torch_pr.py
449
+ git status && git show -s
450
+ git submodule sync && git submodule update --init --recursive
451
+ if [[ ${{ inputs.keep_torch_xpu_ops }} == 'true' ]]; then
452
+ echo "Don't replace torch-xpu-ops!"
453
+ else
454
+ rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/
455
+ # Workaround for torch-xpu-ops ci test
456
+ sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt
457
+ fi
458
+ fi
459
+ - name : Triton Installation
460
+ run : |
461
+ source activate xpu_op_${ZE_AFFINITY_MASK}
462
+ cd ../pytorch
463
+ TRITON_REPO="https://github.com/intel/intel-xpu-backend-for-triton"
464
+ if [ -z ${{ inputs.triton }} ]; then
465
+ TRITON_COMMIT_ID="$(<.ci/docker/ci_commit_pins/triton-xpu.txt)"
466
+ else
467
+ TRITON_COMMIT_ID="${{ inputs.triton }}"
468
+ fi
469
+ echo ${TRITON_REPO}@${TRITON_COMMIT_ID}
470
+ if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
471
+ pip install --force-reinstall "git+${TRITON_REPO}@${TRITON_COMMIT_ID}#subdirectory=python"
472
+ fi
473
+ - name : Download Pytorch wheel
474
+ if : ${{ inputs.pytorch != 'nightly_wheel' }}
475
+ uses : actions/download-artifact@v4
476
+ with :
477
+ name : Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}-${{ inputs.pytorch }}
478
+ path : ${{ github.workspace }}
479
+ - name : Install Pytorch XPU
480
+ run : |
481
+ source activate xpu_op_${ZE_AFFINITY_MASK}
482
+ source .github/scripts/env.sh ${{ inputs.pytorch }}
483
+ pip install mkl-static==2025.0.1 mkl-include==2025.0.1
484
+ if [ "${{ inputs.pytorch }}" != "nightly_wheel" ]; then
485
+ cd ../pytorch
486
+ export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
487
+ pip install -r requirements.txt
488
+ pip install --force-reinstall ${{ github.workspace }}/torch*.whl
489
+ git clone https://github.com/pytorch/vision && cd vision && python setup.py install && cd ..
490
+ else
491
+ pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu
492
+ TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)')
493
+ cd ../pytorch
494
+ git reset --hard && git checkout ${TORCH_COMMIT_ID}
495
+ TORCH_XPU_OPS_COMMIT=$(<third_party/xpu.txt)
496
+ rm -rf third_party/torch-xpu-ops
497
+ git clone https://github.com/intel/torch-xpu-ops.git third_party/torch-xpu-ops
498
+ cd third_party/torch-xpu-ops
499
+ git checkout ${TORCH_XPU_OPS_COMMIT}
500
+ cd ../..
501
+ python third_party/torch-xpu-ops/.github/scripts/apply_torch_pr.py
502
+ fi
503
+ pip install -r .ci/docker/requirements-ci.txt
504
+ - name : Torch Config
505
+ run : |
506
+ source activate xpu_op_${ZE_AFFINITY_MASK}
507
+ source .github/scripts/env.sh ${{ inputs.pytorch }}
508
+ python -c "import torch; print(torch.__config__.show())"
509
+ python -c "import torch; print(torch.__config__.parallel_info())"
510
+ python -c "import torch; print(torch.__config__.torch.xpu.device_count())"
511
+ python -c "import triton; print(triton.__version__)"
512
+
513
+ cd ..
514
+ python pytorch/torch/utils/collect_env.py
515
+ rm -rf /tmp/torchinductor_*
516
+ rm -rf ~/.triton/cache
517
+ - name : Run Torch XPU Distributed UT
518
+ run : |
519
+ source .github/scripts/env.sh ${{ inputs.pytorch }}
520
+ source activate xpu_op_${ZE_AFFINITY_MASK}
521
+ pip install pytest
522
+ cd ${{ github.workspace }}
523
+ sudo cp /proc/sys/kernel/yama/ptrace_scope ptrace_scope.bk
524
+ sudo echo "0"|sudo tee /proc/sys/kernel/yama/ptrace_scope
525
+ mkdir -p ut_log/pytorch_distributed
526
+ cd ../pytorch/third_party/torch-xpu-ops/test/xpu
527
+ XCCL_EANBLE=$(python -c "import torch;print(torch.distributed.is_xccl_available())")
528
+ if [[ "${XCCL_ENABLE}}" == 'False' ]]; then
529
+ echo -e "[ERROR] XCCL is not enabled"
530
+ exit 1
531
+ fi
532
+ python run_distributed_local.py 2>${{ github.workspace }}/ut_log/pytorch_distributed/pytorch_distributed_test_error.log | tee ${{ github.workspace }}/ut_log/pytorch_distributed/pytorch_distributed_test.log
533
+ cd ${{ github.workspace }}
534
+ sudo cp ptrace_scope.bk /proc/sys/kernel/yama/ptrace_scope
535
+ - name : UT Test Results Check
536
+ shell : bash
537
+ run : |
538
+ function contains() {
539
+ contains_status="echo 'Start $2 ...'"
540
+ {
541
+ [[ $1 =~ (^|,)$2($|,) ]]
542
+ } || {
543
+ echo "[Warning] $2 is not suppotted type! Skipped!"
544
+ contains_status="continue"
545
+ }
546
+ }
547
+ set -xe
548
+ echo "UT_NAME=$(echo ${{ inputs.ut }} |sed 's/,/-/g')" |tee -a "${GITHUB_OUTPUT}" >> "${GITHUB_ENV}"
549
+ cd ${{ github.workspace }}/ut_log/pytorch_distributed
550
+ cp ${{ github.workspace }}/.github/scripts/ut_result_check.sh ./
551
+ bash ut_result_check.sh 'pytorch_distributed'
552
+ - name : Upload Inductor XPU UT Log
553
+ if : ${{ ! cancelled() }}
554
+ uses : actions/upload-artifact@v4
555
+ with :
556
+ name : Inductor-XPU-UT-Data-${{ github.event.pull_request.number || github.sha }}-pytorch_distributed
437
557
path : ${{ github.workspace }}/ut_log
438
558
439
559
pytorch_distributed_test :
0 commit comments