Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/linux-testenv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ runs:
fi
sudo apt update
sudo apt install -y jq numactl
rm -rf Torch-XPU-Wheel-*
- name: Setup python-${{ inputs.python }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -65,7 +66,8 @@ runs:
elif [ $(echo "${{ inputs.pytorch }}" |grep -w "nightly_wheel" -c) -ne 0 ];then
pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu
else
pip install --force-reinstall $(find ${{ github.workspace }}/ -name "*torch*.whl")
latest_dir="$(find . -type d -name "Torch-XPU-Wheel-*" |sort -V |tail -n 1)"
pip install --force-reinstall $(find ${latest_dir} -name "*torch*.whl")
fi
TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)')
if [[ "${{ inputs.pytorch }}" == *"https://"* ]];then
Expand Down
121 changes: 107 additions & 14 deletions .github/scripts/ut_result_check.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/bin/bash
# Test Suite Runner for Intel Torch-XPU-Ops
# Usage: ./script.sh <test_suite>

# Available suites: op_regression, op_extended, op_ut, test_xpu, xpu_distributed, skipped_ut
ut_suite="${1:-op_regression}" # Default to op_regression if no suite specified
readonly ut_suite="${1:-op_regression}" # Default to op_regression if no suite specified
readonly inputs_pytorch="${2:-nightly_wheel}"
readonly REPO="intel/torch-xpu-ops"

# Expected test case counts for each test suite category
# Used to detect significant test case reductions (>5%)
declare -A EXPECTED_CASES=(
Expand All @@ -13,6 +17,7 @@ declare -A EXPECTED_CASES=(
["op_ut"]=120408
["test_xpu"]=69
)

# Tests that are known to randomly pass and should be ignored when detecting new passes
# These are typically flaky tests that don't indicate real improvements
IGNORE_TESTS=(
Expand All @@ -23,10 +28,13 @@ IGNORE_TESTS=(
"test_python_ref__refs_log2_xpu_complex128"
"_jiterator_" # Pattern to match all jiterator tests
)

# Find new failed test cases that are not in the known issues list
# Args: UT_results_file, known_issues_file, [output_file]
check_new_failed() {
local ut_file="$1" known_file="$2" output_file="${3:-${ut_file%.*}_filtered.log}"
local ut_file="$1"
local known_file="$2"
local output_file="failures_${suite}_filtered.log"
if [[ $# -lt 2 ]]; then
echo "❌ Need 2 files to compare" >&2
return 1
Expand All @@ -45,6 +53,7 @@ check_new_failed() {
echo -e "✅ No new failed cases"
fi
}

# Find known issues that are now passing (regression fixes)
# Args: passed_tests_file, known_issues_file, [output_file]
check_passed_known_issues() {
Expand All @@ -58,7 +67,7 @@ check_passed_known_issues() {
sed -i 's/\r$//' "$passed_file"
fi
# Find known issues that are now passing (intersection of passed tests and known issues)
grep -Fxf "$passed_file" "$known_file" > "$output_file"
grep -Fxf "$passed_file" "$known_file" |sort |uniq > "$output_file"
echo -e "\\n📊 New Passing Known Issues:"
if [[ -s "$output_file" ]]; then
local count
Expand All @@ -68,8 +77,13 @@ check_passed_known_issues() {
else
echo -e "ℹ️ No known issues are now passing"
fi
# Mark passed items in GitHub issues with strikethrough
if [ "$GITHUB_EVENT_NAME" == "schedule" ] && [ "$inputs_pytorch" != "nightly_wheel" ];then
mark_passed_issue "$output_file" "$known_file"
fi
rm -f "$output_file" # Clean up temporary file
}

# Verify test case counts haven't dropped significantly (>5% reduction)
# Args: category_log_file
check_test_cases() {
Expand Down Expand Up @@ -106,6 +120,7 @@ check_test_cases() {
done < "$log_file"
echo "$all_pass" # Return overall status
}

# Clean test case files: extract test names, sort, and remove duplicates
clean_file() {
local file="$1"
Expand All @@ -123,7 +138,7 @@ check_skipped_ut() {
local new_file="new-passed-issue.cases"
local result_file="new-passed-this-run.cases"
# Fetch known passing tests from GitHub issue tracking known passes
if gh --repo intel/torch-xpu-ops issue view "${NEW_PASSED_ISSUE:-2333}" --json body -q .body 2>/dev/null | grep "::.*::" > "$known_file"; then
if gh --repo $REPO issue view "${NEW_PASSED_ISSUE:-2333}" --json body -q .body 2>/dev/null | grep "::.*::" > "$known_file"; then
echo "✅ Fetched known tests from GitHub"
else
echo "⚠️ Using empty known tests file"
Expand Down Expand Up @@ -151,11 +166,14 @@ check_skipped_ut() {
echo "✅ No new passing tests found"
fi
# Update GitHub issue with current passing tests for future reference
if [ -s "$known_file" ] || [ -s "$new_file" ]; then
gh --repo intel/torch-xpu-ops issue edit "${NEW_PASSED_ISSUE:-2333}" --body-file "$new_file"
echo "Successfully updated issue ${NEW_PASSED_ISSUE:-2333}"
if [ "$GITHUB_EVENT_NAME" == "schedule" ] && [ "$inputs_pytorch" != "nightly_wheel" ];then
if [ -s "$known_file" ] || [ -s "$new_file" ]; then
gh --repo $REPO issue edit "${NEW_PASSED_ISSUE:-2333}" --body-file "$new_file"
echo "✅ Successfully updated issue #${NEW_PASSED_ISSUE:-2333}"
fi
fi
}

# Main test runner for standard test suites (op_regression, op_extended, etc.)
run_main_tests() {
local suite="$1"
Expand Down Expand Up @@ -190,7 +208,7 @@ run_main_tests() {
echo -e "\\n✅ Passing Known Issues:"
check_passed_known_issues "passed_${suite}.log" "Known_issue.log"
# Check for new failures not in known issues
echo -e "\\n❌ New Failures:"
echo -e "\\nChecking New Failures:"
if [[ -f "failures_${suite}.log" ]]; then
check_new_failed "failures_${suite}.log" "Known_issue.log"
fi
Expand All @@ -212,15 +230,18 @@ run_main_tests() {
echo "✅ TEST PASSED: ${suite}"
fi
}

# Special runner for distributed test suite (different log format)
run_distributed_tests() {
local suite="$1"
echo "========================================================================="
echo "Running distributed tests for: ${suite}"
echo "========================================================================="
# Process distributed test logs (different format than main tests)
grep -E "^FAILED" "${suite}_test.log" | awk '{print $3 "\n" $2}' | grep -v '^[^.d]\+$' > "${suite}_failed.log"
grep "PASSED" "${suite}_test.log" | awk '{print $1}' > "${suite}_passed.log"
grep "FAILED" "${suite}_test.log" > "${suite}_failed.log"
clean_file "${suite}_failed.log"
grep "PASSED" "${suite}_test.log" > "${suite}_passed.log"
clean_file "${suite}_passed.log"
echo "📋 Failed Cases:"
cat "${suite}_failed.log"
# Identify filtered tests (known issues in distributed tests)
Expand All @@ -239,8 +260,8 @@ run_distributed_tests() {
check_new_failed "${suite}_failed.log" "Known_issue.log"
# Calculate final statistics for distributed tests
local failed_count=0 passed_count=0
if [[ -f "${suite}_failed_filtered.log" ]]; then
failed_count=$(wc -l < "${suite}_failed_filtered.log")
if [[ -f "failures_${suite}_filtered.log" ]]; then
failed_count=$(wc -l < "failures_${suite}_filtered.log")
fi
passed_count=$(wc -l < "${suite}_passed.log")
# Final result determination for distributed tests
Expand All @@ -251,6 +272,75 @@ run_distributed_tests() {
echo "✅ TEST PASSED: ${suite}"
fi
}

# Mark passed items in GitHub issues with strikethrough
mark_passed_issue() {
local PASSED_FILE="$1"
local ISSUE_FILE="$2"
# Cehck before start
[[ ! -f "$PASSED_FILE" ]] && { echo "❌ Missing $PASSED_FILE" >&2; exit 1; }
[[ ! -f "$ISSUE_FILE" ]] && { echo "❌ Missing $ISSUE_FILE" >&2; exit 1; }
command -v gh &>/dev/null || { echo "❌ GitHub CLI required" >&2; exit 1; }
echo "🔍 Loading passed items..."
# Load passed items into array for efficient lookup
declare -a passed_items
mapfile -t passed_items < <(grep -v '^[[:space:]]*$' "$PASSED_FILE")
echo "🔍 Mapping passed items to issues..."
declare -A issue_items
local issue_id=""
local in_cases_section=0
while IFS= read -r line; do
line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
[[ -z "$line" ]] && { in_cases_section=0; continue;}
if [[ "$line" == "Cases:"* ]]; then
in_cases_section=1
continue
fi
# Extract issue ID if this line contains an issue
if [[ "$line" =~ Issue\ #([0-9]+) ]]; then
issue_id="${BASH_REMATCH[1]}"
continue
fi
if [[ $in_cases_section -eq 1 && -n "$issue_id" ]]; then
# Check if this case is in the passed items
for passed_case in "${passed_items[@]}"; do
if [[ "$passed_case" == "$line" ]]; then
if [[ -n "${issue_items[$issue_id]:-}" ]]; then
issue_items["$issue_id"]+=" $passed_case"
else
issue_items["$issue_id"]="$passed_case"
fi
break
fi
done
fi
done < "$ISSUE_FILE"
echo "✅ Done! Found ${#issue_items[@]} issues with passed items"
# Print results and update issues
for issue_id in "${!issue_items[@]}"; do
# Remove duplicate cases and clean up formatting
uniq_cases=$(echo "${issue_items[$issue_id]}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
echo "📝 Processing issue #${issue_id} with cases: ${uniq_cases}"
# Get current issue body
gh --repo "$REPO" issue view "${issue_id}" --json body -q .body > "issue-body-${issue_id}.txt"
# Apply strikethrough to passed cases
for case in $uniq_cases; do
sed -i "s|^${case}[[:space:]]*$|~~${case}~~|g" "issue-body-${issue_id}.txt"
done
# Update the issue
gh --repo "$REPO" issue edit "${issue_id}" --body-file "issue-body-${issue_id}.txt"
# Add comment
if [[ -n "${GITHUB_RUN_ID:-}" && -n "${GITHUB_REPOSITORY:-}" ]]; then
gh --repo "$REPO" issue comment "${issue_id}" --body "✅ ${uniq_cases} Passed in [nightly testing](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})"
else
gh --repo "$REPO" issue comment "${issue_id}" --body "✅ ${uniq_cases} Passed in nightly testing"
fi
# Clean up temporary file
rm -f "issue-body-${issue_id}.txt"
echo "✅ Updated issue #${issue_id}"
done
}

# Main dispatcher - route to appropriate test runner based on suite type
case "$ut_suite" in
op_regression|op_regression_dev1|op_extended|op_transformers|op_ut|test_xpu)
Expand All @@ -262,9 +352,12 @@ case "$ut_suite" in
skipped_ut)
check_skipped_ut
;;
xpu_profiling)
echo "💡 Not check the test suite results: ${ut_suite}" >&2
;;
*)
echo "❌ Unknown test suite: ${ut_suite}" >&2
echo "💡 Available: op_regression, op_extended, op_ut, test_xpu, xpu_distributed, skipped_ut" >&2
exit 1
printf "💡 Available: op_regression, op_regression_dev1, op_extended, op_transformers, " >&2
printf "op_ut, test_xpu, xpu_distributed, skipped_ut, xpu_profiling\n" >&2
;;
esac
4 changes: 2 additions & 2 deletions .github/workflows/_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ jobs:
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}
name: Torch-XPU-Wheel-${{ github.event.pull_request.number || github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/*.whl
- name: Upload Build Log
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Torch-XPU-Build-Log-${{ github.event.pull_request.number || github.sha }}
name: Torch-XPU-Build-Log-${{ github.event.pull_request.number || github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/build_*.log
- name: Cleanup workspace
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_linux_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,5 @@ jobs:
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Inductor-${{ inputs.test_type }}-LTS2-XPU-E2E-Data-${{ github.event.pull_request.number || github.sha }}-${{ inputs.suite }}
name: Inductor-${{ inputs.test_type }}-LTS2-XPU-E2E-Data-${{ github.event.pull_request.number || github.sha }}-${{ inputs.suite }}-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/upload_files
12 changes: 7 additions & 5 deletions .github/workflows/_linux_e2e_summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ jobs:
run: |
mkdir target/
cd target/
target_dir="Inductor-${{ inputs.test_type }}-LTS2-XPU-E2E-Data-*"
gh --repo ${GITHUB_REPOSITORY} run download ${GITHUB_RUN_ID} -p "${target_dir}"
find Inductor-${{ inputs.test_type }}-LTS2-XPU-E2E-Data-*/ -maxdepth 1 -mindepth 1 -type d |\
while read line; do mv $line .; done
gh --repo ${GITHUB_REPOSITORY} run download ${GITHUB_RUN_ID} -p "Inductor-*-XPU-E2E-*"
find Inductor-*-XPU-E2E-*/ -maxdepth 1 -mindepth 1 -type d |sort -V |\
while read line; do rsync -az --delete $line/ $(basename $line)/; done
rm -rf Inductor-*-XPU-E2E-* || true
- name: Download Baseline Artifact
run: |
mkdir baseline/
Expand All @@ -61,7 +61,9 @@ jobs:
REFERENCE_RUN_ID="$(cat body.txt |grep "Inductor-${artifact_type}-LTS2" |sed 's/.*: *//' || echo '')"
if [ "${REFERENCE_RUN_ID}" != "" ];then
gh --repo intel/torch-xpu-ops run download ${REFERENCE_RUN_ID} -p "Inductor-*-XPU-E2E-*"
find Inductor-*-XPU-E2E-*/ -maxdepth 1 -mindepth 1 -type d |while read line; do mv $line .; done
find Inductor-*-XPU-E2E-*/ -maxdepth 1 -mindepth 1 -type d |sort -V |\
while read line; do rsync -az --delete $line/ $(basename $line)/; done
rm -rf Inductor-*-XPU-E2E-* || true
fi
- name: Get summary
id: summary
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/_linux_op_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/op_benchmark

op_benchmark_test_results_check:
Expand All @@ -96,7 +96,6 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install gh rsync ca-certificates -y
find ./ |grep -v "^\./$" |xargs rm -rf
- name: Checkout torch-xpu-ops
uses: actions/checkout@v4
- name: Setup python-${{ inputs.python }}
Expand All @@ -106,12 +105,16 @@ jobs:
- name: Download XPU UT Logs
uses: actions/download-artifact@v4
with:
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}
path: ${{ github.workspace }}/op_benchmark
pattern: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}-*
path: ${{ github.workspace }}/op_benchmark_tmp
- name: Download OP Baseline
continue-on-error: true
id: reference_id
run: |
# latest dir
latest_dir=$(find . -type d -name "Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}-*" |sort -V |tail -n 1)
mv ${{ github.workspace }}/op_benchmark_tmp/${latest_dir} ${{ github.workspace }}/op_benchmark
# baseline
REFERENCE_RUN_ID="$(gh --repo ${GITHUB_REPOSITORY} issue view ${reference_issue} \
--json body -q .body |grep "Inductor-XPU-OP-Benchmark-Data" |sed 's/.*: *//')"
gh --repo ${GITHUB_REPOSITORY} run download ${REFERENCE_RUN_ID} -p "Inductor-XPU-OP-Benchmark-Data-*"
Expand Down Expand Up @@ -147,7 +150,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}-Updated
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}-Updated-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/op_benchmark
- name: Upload Reference Run ID
run: |
Expand Down
Loading