Skip to content
Open
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
22 changes: 12 additions & 10 deletions .github/actions/linux-uttest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,24 @@ runs:
shell: timeout 3600 bash -xe {0}
if: ${{ inputs.ut_name == 'xpu_profiling' }}
run: |
mkdir -p ut_log/xpu_profiling/issue_reproduce
# Set specific PYTEST_ADDOPTS to avoid the threading conflict between profile UT test and para '--dist worksteal'
export PYTEST_ADDOPTS="-v --timeout 600"
mkdir -p ut_log/xpu_profiling
cd pytorch/third_party/torch-xpu-ops
# RN50 Test
PROFILE=1 python -u test/profiling/rn50.py -a resnet50 --dummy ./ --num-iterations 20 --xpu 0
cp profiling.fp32.train.pt ${{ github.workspace }}/ut_log/xpu_profiling
# All Issue Reproduce UT
python -u test/profiling/correlation_id_mixed.py | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/issue_reproduce/correlation_id_mixed.log
tee ${{ github.workspace }}/ut_log/xpu_profiling/correlation_id_mixed.log
python -u test/profiling/reproducer.missing.gpu.kernel.time.py | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/issue_reproduce/reproducer.missing.gpu.kernel.time.log
tee ${{ github.workspace }}/ut_log/xpu_profiling/reproducer.missing.gpu.kernel.time.log
python -u test/profiling/time_precision_in_profile.py | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/issue_reproduce/time_precision_in_profile.log
tee ${{ github.workspace }}/ut_log/xpu_profiling/time_precision_in_profile.log
python -u test/profiling/profile_partial_runtime_ops.py | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/issue_reproduce/profile_partial_runtime_ops.log
tee ${{ github.workspace }}/ut_log/xpu_profiling/profile_partial_runtime_ops.log
python -u test/profiling/triton_xpu_ops_time.py | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/issue_reproduce/triton_xpu_ops_time.log
tee ${{ github.workspace }}/ut_log/xpu_profiling/triton_xpu_ops_time.log

# llama case for calls number test
pip install transformers
Expand All @@ -160,13 +162,13 @@ runs:

# All xpu ut under test/profiler
cd ../../test/profiler
python -m pytest -s test_cpp_thread.py | \
python -m pytest -s test_cpp_thread.py --junit-xml=${{ github.workspace }}/ut_log/xpu_profiling_test_cpp_thread.xml | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/test_cpp_thread.log
python -m pytest -s test_execution_trace.py | \
python -m pytest -s test_execution_trace.py --junit-xml=${{ github.workspace }}/ut_log/xpu_profiling_test_execution_trace.xml | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/test_execution_trace.log
python -m pytest -s test_memory_profiler.py | \
python -m pytest -s test_memory_profiler.py --junit-xml=${{ github.workspace }}/ut_log/xpu_profiling_test_memory_profiler.xml | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/test_memory_profiler.log
python -m pytest -s -vs test_profiler_tree.py | \
python -m pytest -s -vs test_profiler_tree.py --junit-xml=${{ github.workspace }}/ut_log/xpu_profiling_test_profiler_tree.xml | \
tee ${{ github.workspace }}/ut_log/xpu_profiling/test_profiler_tree.log

- name: xpu_distributed
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/check-ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ def determine_category(ut):
return 'op_transformers'
elif ut == 'test_xpu':
return 'test_xpu'
elif 'xpu_profiling' in ut:
return 'xpu_profiling'
elif 'op_ut' in ut:
return 'op_ut'
else:
Expand Down
100 changes: 100 additions & 0 deletions .github/scripts/profile_ut_result_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash

# Wrapper script to run all analyses and show statistics using total_errors count

echo "Running all profile analysis checks..."
echo "======================================"

# Arrays to track results
declare -a PASSED_TESTS
declare -a FAILED_TESTS
declare -A ERROR_COUNTS
declare -A LOG_FILES

# Function to extract error count from analysis output
extract_error_count() {
local output="$1"
echo "$output" | grep -E "Total errors:? [0-9]+" | tail -1 | grep -oE '[0-9]+' | head -1
}

# Function to run test and track result
run_test() {
local test_name=$1
local log_file=$2
local analysis_type=$3

echo
echo "Running: $test_name ($log_file)"
echo "--------------------------------"

local output
output=$(bash profile_ut_result_summary.sh "$log_file" "$analysis_type" 2>&1)
local error_count

error_count=$(extract_error_count "$output")

if [ -z "$error_count" ]; then
error_count=1
echo "⚠️ Could not extract error count, assuming test failed"
fi

echo "$output"

ERROR_COUNTS["$test_name"]=$error_count
LOG_FILES["$test_name"]=$log_file

if [ "$error_count" -eq 0 ]; then
PASSED_TESTS+=("$test_name")
echo "✅ $test_name: PASSED (0 errors)"
else
FAILED_TESTS+=("$test_name")
echo "❌ $test_name: FAILED ($error_count errors)"
fi
}

# Run all tests
run_test "correlation_id_mixed" "correlation_id_mixed.log" 1
run_test "reproducer_missing_gpu_kernel_time" "reproducer.missing.gpu.kernel.time.log" 2
run_test "time_precision" "time_precision_in_profile.log" 3
run_test "partial_runtime_ops" "profile_partial_runtime_ops.log" 4
run_test "triton_xpu_ops" "triton_xpu_ops_time.log" 5
run_test "profiling_fp32_train_resnet50" "profiling.fp32.train.pt" 6

# Display detailed summary
echo
echo "======================================"
echo " DETAILED TEST SUMMARY"
echo "======================================"

echo "✅ PASSED TESTS: ${#PASSED_TESTS[@]}"
for test in "${PASSED_TESTS[@]}"; do
printf " - %-40s: 0 errors\n" "$test"
done

echo
echo "❌ FAILED TESTS: ${#FAILED_TESTS[@]}"
for test in "${FAILED_TESTS[@]}"; do
printf " - %-40s: %d errors (File: %s)\n" "$test" "${ERROR_COUNTS[$test]}" "${LOG_FILES[$test]}"
done

echo
echo "--------------------------------------"
echo "STATISTICS:"
echo " Total tests run: $(( ${#PASSED_TESTS[@]} + ${#FAILED_TESTS[@]} ))"
echo " Tests passed: ${#PASSED_TESTS[@]}"
echo " Tests failed: ${#FAILED_TESTS[@]}"
echo " Total errors found: $(printf "%s\n" "${ERROR_COUNTS[@]}" | awk '{sum+=$1} END {print sum}')"

# Final result
if [ ${#FAILED_TESTS[@]} -eq 0 ]; then
echo
echo "🎉 ALL TESTS PASSED! No errors found in any analysis."
exit 0
else
echo
echo "⚠️ SOME TESTS FAILED! Please check the following analyses:"
for test in "${FAILED_TESTS[@]}"; do
echo " - $test (${ERROR_COUNTS[$test]} errors) - File: ${LOG_FILES[$test]}"
done
exit 1
fi
Loading