Merge branch 'main' into mengfeil/containerd #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux OP Benchmark Test | ||
on: | ||
workflow_call: | ||
inputs: | ||
runner: | ||
required: true | ||
type: string | ||
default: 'pvc_rolling' | ||
description: Runner label | ||
test_type: | ||
type: string | ||
default: 'build-from-source' | ||
description: Build from source or install nightly wheel | ||
pytorch: | ||
type: string | ||
default: 'main' | ||
description: Pytorch main by default, or 'commit/branch', or 'repo@commit/repo@branch' | ||
oneapi: | ||
type: string | ||
default: 'installed' | ||
description: Installed oneAPI DLE on host by default, fill offline.sh url if needed | ||
python: | ||
type: string | ||
default: '3.10' | ||
description: Python version | ||
permissions: read-all | ||
defaults: | ||
run: | ||
shell: bash -xe {0} | ||
jobs: | ||
runner: | ||
runs-on: ${{ inputs.runner }} | ||
outputs: | ||
runner_id: ${{ steps.runner-info.outputs.runner_id }} | ||
user_id: ${{ steps.runner-info.outputs.user_id }} | ||
render_id: ${{ steps.runner-info.outputs.render_id }} | ||
hostname: ${{ steps.runner-info.outputs.hostname }} | ||
steps: | ||
- name: Cleanup workspace | ||
run: | | ||
sudo find ./ |grep -v "^\./$" |xargs sudo rm -rf | ||
- name: Checkout torch-xpu-ops | ||
uses: actions/checkout@v4 | ||
- name: Get runner | ||
id: runner-info | ||
uses: ./.github/actions/get-runner | ||
op_benchmark: | ||
needs: runner | ||
runs-on: ${{ needs.runner.outputs.runner_id }} | ||
permissions: | ||
issues: write | ||
timeout-minutes: 900 | ||
container: | ||
image: mengfeili/intel-pvc-driver:1146-1136 | ||
volumes: | ||
- ${{ github.workspace }}:${{ github.workspace }} | ||
options: --device=/dev/mem --device=/dev/dri --group-add video --security-opt seccomp=unconfined --cap-add=SYS_PTRACE --shm-size=8g | ||
-u ${{ needs.runner.outputs.user_id }}:${{ needs.runner.outputs.render_id }} | ||
env: | ||
AGENT_TOOLSDIRECTORY: /opt/xpu-tool | ||
GH_TOKEN: ${{ github.token }} | ||
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }} | ||
REFERENCE_ISSUE: 1689 | ||
steps: | ||
- name: Cleanup workspace | ||
run: | | ||
find ./ |grep -v "^\./$" |xargs rm -rf | ||
- name: Checkout torch-xpu-ops | ||
uses: actions/checkout@v4 | ||
- name: Launch Test on ${{ needs.runner.outputs.hostname }} | ||
uses: ./.github/actions/linux-testenv | ||
with: | ||
test_type: ${{ inputs.test_type }} | ||
pytorch: ${{ inputs.pytorch }} | ||
torch_xpu_ops: skipped | ||
oneapi: ${{ inputs.oneapi }} | ||
python: ${{ inputs.python }} | ||
- name: Run Torch XPU Op Benchmark | ||
run: | | ||
mkdir -p ${{ github.workspace }}/op_benchmark | ||
cd test/microbench | ||
filename=$(find -- *.py) | ||
for i in $filename | ||
do | ||
python ${i%.*}.py > ${{ github.workspace }}/op_benchmark/${i%.*}.log | ||
done | ||
pip install pandas openpyxl | ||
# Summary forward op time | ||
python ${{ github.workspace }}/.github/scripts/microbench_summary.py ${{ github.workspace }}/op_benchmark ${{ github.workspace }}/op_benchmark/forward_op_summary.csv | ||
# Summary backward op time | ||
python ${{ github.workspace }}/.github/scripts/microbench_summary.py ${{ github.workspace }}/op_benchmark ${{ github.workspace }}/op_benchmark/backward_op_summary.csv --backward | ||
- name: Upload Inductor XPU OP benchmark Log | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }} | ||
path: ${{ github.workspace }}/op_benchmark | ||
op_benchmark_test_results_check: | ||
needs: op_benchmark_test | ||
runs-on: ubuntu-22.04 | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
reference_issue: 1689 | ||
steps: | ||
- name: Checkout torch-xpu-ops | ||
uses: actions/checkout@v4 | ||
- name: Setup python-${{ inputs.python }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python }} | ||
- 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 | ||
- name: Download OP Baseline | ||
continue-on-error: true | ||
id: reference_id | ||
run: | | ||
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-*" | ||
rm -rf ${{ github.workspace }}/reference | ||
mkdir -p ${{ github.workspace }}/reference | ||
mv -f Inductor-XPU-OP-Benchmark-Data-*-Updated/* ${{ github.workspace }}/reference | ||
mkdir -p ${{ github.workspace }}/baseline | ||
if [[ -f "${{ github.workspace }}/reference/new_baseline/baseline_forward_op_summary.csv" ]]; then | ||
cp ${{ github.workspace }}/reference/new_baseline/baseline_forward_op_summary.csv ${{ github.workspace }}/baseline | ||
cp ${{ github.workspace }}/reference/new_baseline/baseline_backward_op_summary.csv ${{ github.workspace }}/baseline | ||
else | ||
cp ${{ github.workspace }}/reference/forward_op_summary.csv ${{ github.workspace }}/baseline/baseline_forward_op_summary.csv | ||
cp ${{ github.workspace }}/reference/backward_op_summary.csv ${{ github.workspace }}/baseline/baseline_backward_op_summary.csv | ||
fi | ||
- name: Check the OP Regression | ||
run: | | ||
pip install tabulate pandas | ||
# Compare forward op | ||
python ${{ github.workspace }}/.github/scripts/op_perf_comparison.py --xpu_file ${{ github.workspace }}/op_benchmark/forward_op_summary.csv --baseline_file ${{ github.workspace }}/baseline/baseline_forward_op_summary.csv | ||
# Compare backward op | ||
python ${{ github.workspace }}/.github/scripts/op_perf_comparison.py --xpu_file ${{ github.workspace }}/op_benchmark/backward_op_summary.csv --baseline_file ${{ github.workspace }}/baseline/baseline_backward_op_summary.csv | ||
- name: Update OP Baseline | ||
run: | | ||
mkdir ${{ github.workspace }}/new_baseline | ||
cp ${{ github.workspace }}/baseline/baseline*.csv ${{ github.workspace }}/new_baseline | ||
# Update forward op | ||
python ${{ github.workspace }}/.github/scripts/op_calculate_best_perf.py --xpu ${{ github.workspace }}/op_benchmark/forward_op_summary.csv --baseline ${{ github.workspace }}/new_baseline/baseline_forward_op_summary.csv -r | ||
# Update backward op | ||
python ${{ github.workspace }}/.github/scripts/op_calculate_best_perf.py --xpu ${{ github.workspace }}/op_benchmark/backward_op_summary.csv --baseline ${{ github.workspace }}/new_baseline/baseline_backward_op_summary.csv -r | ||
cp -r ${{ github.workspace }}/new_baseline ${{ github.workspace }}/op_benchmark | ||
- name: Upload Inductor XPU OP benchmark Log | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}-Updated | ||
path: ${{ github.workspace }}/op_benchmark | ||
- name: Upload Reference Run ID | ||
run: | | ||
gh --repo ${GITHUB_REPOSITORY} issue view ${REFERENCE_ISSUE} --json body -q .body | \ | ||
sed "s/Inductor-XPU-OP-Benchmark-Data:.*/Inductor-XPU-OP-Benchmark-Data: ${GITHUB_RUN_ID}/" | sed '/^$/d' > new_body.txt | ||
gh --repo ${GITHUB_REPOSITORY} issue edit ${REFERENCE_ISSUE} --body-file new_body.txt |