diff --git a/.ci/templates/ci-report.txt b/.ci/templates/ci-report.txt new file mode 100644 index 0000000000..79f2b09cf7 --- /dev/null +++ b/.ci/templates/ci-report.txt @@ -0,0 +1,18 @@ +# ๐Ÿงช CI Test Summary Report + +## ๐Ÿ“Š Executive Summary +โณ **All tests scheduled!** Waiting for launch. + +## ๐Ÿ“ˆ Category-Specific Results + +| Category | Status | Acc/UT Total | Acc/UT Pass Rate | Perf Eager Ratio | Perf Inductor Ratio | +|-----------------|----------|--------------|-------------------|------------------|---------------------| +| **Lnit Check** | WIP | +| **Clang Check** | WIP | +| **Unit Tests** | WIP | +| **HuggingFace** | WIP | +| **Timm Models** | WIP | +| **TorchBench** | WIP | + +## ๐Ÿ” Test Details +- **Workflow:** https://github.com/GITHUB_REPOSITORY/actions/runs/GITHUB_RUN_ID diff --git a/.github/actions/add-comment/action.yml b/.github/actions/add-comment/action.yml new file mode 100644 index 0000000000..a2cf5b6c24 --- /dev/null +++ b/.github/actions/add-comment/action.yml @@ -0,0 +1,67 @@ +name: CI Test Report Publisher +description: 'Publishes detailed test reports as GitHub comments with smart updates' + +inputs: + comment-body: + description: 'Path to the summary report HTML file' + required: true + default: 'test-results/report.html' + report-title: + description: 'Title for the test report comment' + required: false + default: '๐Ÿงช CI Test Summary Report' + +runs: + using: composite + steps: + - name: Validate inputs + shell: bash + run: | + if [[ ! -f "${{ inputs.comment-body }}" ]]; then + echo "โŒ Report file not found: ${{ inputs.comment-body }}" + exit 1 + fi + - name: Publish or update comment + uses: actions/github-script@v7 + with: + script: | + // Read the comment content from a file + const fs = require('fs'); + const commentBody = fs.readFileSync('${{ inputs.comment-body }}', 'utf8'); + + // Helper function to find bot comments + const findBotComment = async () => { + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + return comments.find(comment => + comment.body.includes('${{ inputs.report-title }}') + ); + }; + + try { + const existingComment = await findBotComment(); + if (existingComment) { + console.log('๐Ÿ“ Updating existing test report comment'); + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body: commentBody + }); + } else { + console.log('๐Ÿ’ฌ Creating new test report comment'); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: commentBody + }); + } + console.log('โœ… Test report published successfully'); + } catch (error) { + console.error('โŒ Failed to publish test report:', error.message); + throw error; + } diff --git a/.github/actions/lint-checks/action.yml b/.github/actions/lint-checks/action.yml new file mode 100644 index 0000000000..271530180b --- /dev/null +++ b/.github/actions/lint-checks/action.yml @@ -0,0 +1,61 @@ +name: 'Run Lint Checks' +description: 'Execute code quality and linting checks' + +runs: + using: "composite" + steps: + - name: Run Standard Lint Check + shell: bash + run: | + ci_report=".ci/templates/ci-report.txt" + + # Update CI report template + sed -i "s+GITHUB_REPOSITORY+${{ github.repository }}+g;s+GITHUB_RUN_ID+${{ github.run_id }}+g" "${ci_report}" + + # Run lint check + export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" + + if bash ".github/scripts/lintrunner.sh"; then + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โœ…|1|100%|N/A|N/A|+' "${ci_report}" + echo "โœ… Standard lint check passed" + else + sed -i 's+.*Lnit Check.*+|**Lnit Check**|โŒ|1|0%|N/A|N/A|+' "${ci_report}" + echo "โŒ Standard lint check failed" + exit 1 + fi + - name: Checkout Repository + uses: actions/checkout@v4 + with: + path: torch-xpu-ops + - name: Run Clang-based Lint Check + shell: bash + run: | + set -euo pipefail + + # Clone PyTorch and setup environment + rm -rf pytorch + git clone https://github.com/pytorch/pytorch pytorch + + cd pytorch + cp -r ../torch-xpu-ops third_party/ + + # Configure and run clang checks + export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \ + build/xpu/**/*.* \ + build/xpu/*.* \ + third_party/torch-xpu-ops/src/*.* \ + third_party/torch-xpu-ops/src/**/*.* \ + third_party/torch-xpu-ops/src/**/**/*.* \ + third_party/torch-xpu-ops/src/**/**/**/*.*" + export CLANG=1 + + ci_report="../.ci/templates/ci-report.txt" + + if bash "third_party/torch-xpu-ops/.github/scripts/lintrunner.sh"; then + sed -i 's+.*Clang Check.*+|**Clang Check**|โœ…|1|100%|N/A|N/A|+' "${ci_report}" + echo "โœ… Clang lint check passed" + else + sed -i 's+.*Clang Check.*+|**Clang Check**|โŒ|1|0%|N/A|N/A|+' "${ci_report}" + echo "โŒ Clang lint check failed" + exit 1 + fi diff --git a/.github/workflows/_linux_e2e_summary.yml b/.github/workflows/_linux_e2e_summary.yml index 42955817f9..39dbbbad7f 100644 --- a/.github/workflows/_linux_e2e_summary.yml +++ b/.github/workflows/_linux_e2e_summary.yml @@ -95,19 +95,9 @@ jobs: gh --repo ${GITHUB_REPOSITORY} issue edit ${REFERENCE_ISSUE_ID} --body-file new_body.txt - name: Add comment for performance outliers if: ${{ github.event_name == 'pull_request' && steps.summary.outputs.performance_regression == 1 }} - uses: actions/github-script@v7 + uses: ./.github/actions/add-comment with: - script: | - // Read the comment content from a file - const fs = require('fs'); - const commentBody = fs.readFileSync('./performance.regression.pr.html', 'utf8'); - // Create comment on an issue or PR - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: commentBody - }); + comment-body: './performance.regression.pr.html' - name: Result check if: ${{ ! cancelled() }} run: | diff --git a/.github/workflows/_performance_comparison.yml b/.github/workflows/_performance_comparison.yml index 5a0d08993b..53ce959cd8 100644 --- a/.github/workflows/_performance_comparison.yml +++ b/.github/workflows/_performance_comparison.yml @@ -25,7 +25,7 @@ jobs: - name: Setup python uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.10' - name: Checkout torch-xpu-ops uses: actions/checkout@v4 - name: Downlaod artifacts diff --git a/.github/workflows/_windows_ut.yml b/.github/workflows/_windows_ut.yml index 28ec8bbfe4..f27051ff25 100644 --- a/.github/workflows/_windows_ut.yml +++ b/.github/workflows/_windows_ut.yml @@ -46,7 +46,7 @@ on: permissions: read-all -env: +env: USE_XPU: 1 PYTORCH_EXTRA_INSTALL_REQUIREMENTS: >- intel-cmplr-lib-rt==2025.2.1 | @@ -156,8 +156,8 @@ jobs: git config --global core.symlinks true git config --global core.fsmonitor false powershell -Command "Set-ItemProperty -Path "HKLM:\\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1" - git status - git show -s + git status + git show -s git submodule sync && git submodule update --init --recursive if %TORCH_XPU_OPS_COMMIT% == 'pinned' ( echo "Don't replace torch-xpu-ops!" @@ -277,7 +277,7 @@ jobs: REM Check the failure logs if exist "%GITHUB_WORKSPACE%\failures*.log" ( echo Exist Failure logs - echo Found Failure logs as below: + echo Found Failure logs as below: for %%f in ("%GITHUB_WORKSPACE%\failures*.log") do ( echo - %%f copy "%%f" "%GITHUB_WORKSPACE%\ut_log\" diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 6c26af3c71..1222420e5e 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -24,31 +24,28 @@ jobs: if: ${{ github.repository_owner == 'intel' }} runs-on: ubuntu-24.04 timeout-minutes: 30 + permissions: + issues: write + pull-requests: write + env: + GH_TOKEN: ${{ github.token }} steps: - - name: Checkout torch-xpu-ops + - name: Checkout Repository uses: actions/checkout@v4 - with: - path: torch-xpu-ops - - name: Run lint check - run: | - export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" - cd ./torch-xpu-ops - bash .github/scripts/lintrunner.sh - - name: Run lint check with Clang + + - name: Setup Linting Environment run: | - sudo apt update && sudo apt install -y libomp-dev - rm -rf pytorch - git clone https://github.com/pytorch/pytorch pytorch - cd pytorch && cp -r ../torch-xpu-ops third_party/ - export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGTIDY,CLANGFORMAT \ - build/xpu/**/*.* \ - build/xpu/*.* \ - third_party/torch-xpu-ops/src/*.* \ - third_party/torch-xpu-ops/src/**/*.* \ - third_party/torch-xpu-ops/src/**/**/*.* \ - third_party/torch-xpu-ops/src/**/**/**/*.*" - export CLANG=1 - bash third_party/torch-xpu-ops/.github/scripts/lintrunner.sh + sudo apt-get update + sudo apt-get install -y libomp-dev dos2unix + + - name: Run Code Quality Checks + id: lint-checks + uses: ./.github/actions/lint-checks + + - name: Publish test report + uses: ./.github/actions/add-comment + with: + comment-body: './.ci/templates/ci-report.txt' conditions-filter: if: ${{ github.repository_owner == 'intel' && github.event.pull_request.draft == false }} @@ -66,7 +63,7 @@ jobs: id: check-files with: filters: | - src_changed: + src_changed: - 'cmake/**' - 'tools/**' - 'src/**.cmake' @@ -161,11 +158,11 @@ jobs: windows: name: windows - if: ${{ !(contains(needs.conditions-filter.outputs.disabled_tests, 'disable_all') || contains(needs.conditions-filter.outputs.disabled_tests, 'disable_win')) }} + if: ${{ !(contains(needs.conditions-filter.outputs.disabled_tests, 'disable_all') || contains(needs.conditions-filter.outputs.disabled_tests, 'disable_win')) }} needs: [conditions-filter, preci-lint-check] secrets: inherit uses: ./.github/workflows/_windows_ut.yml - with: + with: ut: op_extended,test_xpu runner: Windows_CI src_changed: ${{ needs.conditions-filter.outputs.src_changed }}