diff --git a/.github/workflows/nightly_tests_xpu.yml b/.github/workflows/nightly_tests_xpu.yml new file mode 100644 index 000000000000..fa1ea394e86d --- /dev/null +++ b/.github/workflows/nightly_tests_xpu.yml @@ -0,0 +1,278 @@ +name: Nightly tests on Intel XPU + +on: + workflow_dispatch: + schedule: + - cron: "0 4 * * *" # every day at 4am (offset from the main CUDA nightly) + +env: + DIFFUSERS_IS_CI: yes + HF_XET_HIGH_PERFORMANCE: 1 + OMP_NUM_THREADS: 8 + MKL_NUM_THREADS: 8 + PYTEST_TIMEOUT: 600 + RUN_SLOW: yes + RUN_NIGHTLY: yes + PIPELINE_USAGE_CUTOFF: 0 + SLACK_API_TOKEN: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }} + CONSOLIDATED_REPORT_PATH: consolidated_test_report.md + +permissions: {} + +jobs: + setup_torch_xpu_pipeline_matrix: + permissions: + contents: read + name: Setup Torch Pipelines XPU Slow Tests Matrix + runs-on: + group: hfc-intel-b60 + container: + image: huggingface/xpu_ci + options: >- + --shm-size "8g" + --privileged + --network host + -v /dev/dri/by-path:/dev/dri/by-path + --device /dev/dri:/dev/dri + -v /mnt/cache/.cache/huggingface:/mnt/cache/ + outputs: + pipeline_test_matrix: ${{ steps.fetch_pipeline_matrix.outputs.pipeline_test_matrix }} + steps: + - name: Checkout diffusers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 2 + - name: Fetch Pipeline Matrix + id: fetch_pipeline_matrix + run: | + matrix=$(python utils/fetch_torch_cuda_pipeline_test_matrix.py) + echo $matrix + echo "pipeline_test_matrix=$matrix" >> $GITHUB_OUTPUT + - name: Pipeline Tests Artifacts + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-pipelines.json + path: reports + + run_nightly_tests_for_torch_pipelines_xpu: + permissions: + contents: read + id-token: write + name: Nightly Torch Pipelines XPU Tests + needs: setup_torch_xpu_pipeline_matrix + strategy: + fail-fast: false + max-parallel: 3 + matrix: + module: ${{ fromJson(needs.setup_torch_xpu_pipeline_matrix.outputs.pipeline_test_matrix) }} + runs-on: + group: hfc-intel-b60 + container: + image: huggingface/xpu_ci + options: >- + --shm-size "8g" + --privileged + --network host + -v /dev/dri/by-path:/dev/dri/by-path + --device /dev/dri:/dev/dri + -v /mnt/cache/.cache/huggingface:/mnt/cache/ + steps: + - name: Checkout diffusers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 2 + - name: Environment + run: | + diffusers-cli env + - name: Pipeline XPU Test + env: + HF_OIDC_RESOURCE: Diffusers-CI-Bot + run: | + pytest -n 1 --max-worker-restart=0 --dist=loadfile \ + --make-reports=tests_pipeline_${{ matrix.module }}_xpu \ + --report-log=tests_pipeline_${{ matrix.module }}_xpu.log \ + tests/pipelines/${{ matrix.module }} + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/tests_pipeline_${{ matrix.module }}_xpu_stats.txt + cat reports/tests_pipeline_${{ matrix.module }}_xpu_failures_short.txt + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: pipeline_${{ matrix.module }}_xpu_test_reports + path: reports + + run_nightly_tests_for_other_torch_modules_xpu: + permissions: + contents: read + id-token: write + name: Nightly Torch XPU Tests + runs-on: + group: hfc-intel-b60 + container: + image: huggingface/xpu_ci + options: >- + --shm-size "8g" + --privileged + --network host + -v /dev/dri/by-path:/dev/dri/by-path + --device /dev/dri:/dev/dri + -v /mnt/cache/.cache/huggingface:/mnt/cache/ + defaults: + run: + shell: bash + strategy: + fail-fast: false + max-parallel: 2 + matrix: + module: [models, schedulers, hooks, lora, others, single_file, examples] + steps: + - name: Checkout diffusers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 2 + + - name: Environment + run: diffusers-cli env + + - name: Run nightly PyTorch XPU tests for non-pipeline modules + if: ${{ matrix.module != 'examples'}} + env: + HF_OIDC_RESOURCE: Diffusers-CI-Bot + run: | + pytest -n 1 --max-worker-restart=0 --dist=loadfile \ + -m "not compile" \ + --make-reports=tests_torch_${{ matrix.module }}_xpu \ + --report-log=tests_torch_${{ matrix.module }}_xpu.log \ + tests/${{ matrix.module }} + + - name: Run nightly example tests with Torch + if: ${{ matrix.module == 'examples' }} + env: + HF_OIDC_RESOURCE: Diffusers-CI-Bot + run: | + pytest -n 1 --max-worker-restart=0 --dist=loadfile \ + --make-reports=examples_torch_xpu \ + --report-log=examples_torch_xpu.log \ + examples/ + + - name: Failure short reports + if: ${{ failure() }} + run: | + cat reports/tests_torch_${{ matrix.module }}_xpu_stats.txt + cat reports/tests_torch_${{ matrix.module }}_xpu_failures_short.txt + + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: torch_${{ matrix.module }}_xpu_test_reports + path: reports + + run_torch_compile_tests_xpu: + permissions: + contents: read + id-token: write + name: PyTorch Compile XPU tests + + runs-on: + group: hfc-intel-b60 + + container: + image: huggingface/xpu_ci + options: >- + --shm-size "8g" + --privileged + --network host + -v /dev/dri/by-path:/dev/dri/by-path + --device /dev/dri:/dev/dri + -v /mnt/cache/.cache/huggingface:/mnt/cache/ + + steps: + - name: Checkout diffusers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 2 + + - name: Environment + run: | + diffusers-cli env + - name: Run torch compile tests on XPU + env: + HF_OIDC_RESOURCE: Diffusers-CI-Bot + run: | + pytest -n 1 --max-worker-restart=0 --dist=loadfile -m compile --make-reports=tests_torch_compile_xpu tests/ + - name: Failure short reports + if: ${{ failure() }} + run: cat reports/tests_torch_compile_xpu_failures_short.txt + + - name: Test suite reports artifacts + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: torch_compile_xpu_test_reports + path: reports + + generate_consolidated_report_xpu: + permissions: + contents: read + name: Generate Consolidated Test Report + needs: [ + run_nightly_tests_for_torch_pipelines_xpu, + run_nightly_tests_for_other_torch_modules_xpu, + run_torch_compile_tests_xpu, + ] + if: always() + runs-on: + group: aws-general-8-plus + container: + image: huggingface/xpu_ci + options: >- + --shm-size "8g" + --privileged + --network host + -v /dev/dri/by-path:/dev/dri/by-path + --device /dev/dri:/dev/dri + -v /mnt/cache/.cache/huggingface:/mnt/cache/ + steps: + - name: Checkout diffusers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 2 + + - name: Create reports directory + run: mkdir -p combined_reports + + - name: Download all test reports + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + path: artifacts + + - name: Prepare reports + run: | + # Move all report files to a single directory for processing + find artifacts -name "*.txt" -exec cp {} combined_reports/ \; + + - name: Install dependencies + run: | + pip install slack_sdk tabulate + + - name: Generate consolidated report + run: | + python utils/consolidated_test_report.py \ + --reports_dir combined_reports \ + --output_file $CONSOLIDATED_REPORT_PATH \ + --slack_channel_name intel-xpu-hf-ci + + - name: Show consolidated report + run: | + cat $CONSOLIDATED_REPORT_PATH >> $GITHUB_STEP_SUMMARY + + - name: Upload consolidated report + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: consolidated_test_report + path: ${{ env.CONSOLIDATED_REPORT_PATH }}