Skip to content

Commit df2b6dd

Browse files
change the threshold and baseline download method
1 parent 2a57513 commit df2b6dd

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

.github/scripts/op_perf_comparison.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ def main():
181181
parser = argparse.ArgumentParser(description='Compare time values between two CSV files')
182182
parser.add_argument('-x', '--xpu_file', required=True, help='XPU OP performance result csv files dir')
183183
parser.add_argument('-b', '--baseline_file', required=True, help="XPU OP baseline result csv files dir")
184-
parser.add_argument('-t', '--threshold', type=float, default=0.05,
185-
help='Threshold for time difference (default: 0.05 for 5%)')
184+
parser.add_argument('-t', '--threshold', type=float, default=0.10,
185+
help='Threshold for time difference (default: 0.10 for 10%)')
186186
args = parser.parse_args()
187187

188188
print(f" Compared file: {args.xpu_file}{args.baseline_file}")

.github/workflows/_linux_op_benchmark.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ on:
3434
default: 'rolling'
3535
description: Driver lts/rolling
3636

37-
permissions: read-all
37+
permissions: write-all
3838

3939
jobs:
4040
op_benchmark_test:
4141
runs-on: ${{ inputs.runner }}
4242
timeout-minutes: 900
4343
env:
4444
GH_TOKEN: ${{ github.token }}
45+
reference_issue: 1689
4546
NEOReadDebugKeys: ${{ inputs.driver == 'rolling' && '1' || '0' }}
4647
DisableScratchPages: ${{ inputs.driver == 'rolling' && '1' || '0' }}
4748
steps:
@@ -87,7 +88,6 @@ jobs:
8788
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
8889
pip install -r requirements.txt
8990
pip install --force-reinstall ${{ github.workspace }}/torch*.whl
90-
git clone https://github.com/pytorch/vision && cd vision && python setup.py install && cd ..
9191
else
9292
pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu
9393
TORCH_COMMIT_ID=$(python -c 'import torch; print(torch.version.git_version)')
@@ -123,30 +123,16 @@ jobs:
123123
bash ${{ github.workspace }}/.github/scripts/microbench_summary.sh ${{ github.workspace }}/op_benchmark ${{ github.workspace }}/op_benchmark/backward_op_summary.csv True
124124
- name: Download OP Baseline
125125
continue-on-error: true
126+
id: reference_id
126127
run: |
127128
source .github/scripts/env.sh ${{ inputs.pytorch }}
128129
source activate xpu_op_${ZE_AFFINITY_MASK}
129-
sudo apt-get install -y jq
130-
gh api \
131-
--method GET -F per_page=100 -F page=10 \
132-
-H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
133-
/repos/${GITHUB_REPOSITORY:-"intel/torch-xpu-ops"}/actions/artifacts \
134-
> ${GITHUB_WORKSPACE:-"/tmp"}/refer.json
135-
artifact_id="$(eval "jq -r \
136-
'[.artifacts[] | \
137-
select(.name|test(\"Inductor-XPU-OP-Benchmark-Data.*\")) | \
138-
select(.workflow_run.head_branch|test(\"main\"))][0].id' \
139-
${GITHUB_WORKSPACE:-"/tmp"}/refer.json")"
140-
if [ "$artifact_id" -gt 1 ];then
141-
gh api \
142-
-H "Accept: application/vnd.github+json" \
143-
-H "X-GitHub-Api-Version: 2022-11-28" \
144-
/repos/${GITHUB_REPOSITORY:-"intel/torch-xpu-ops"}/actions/artifacts/${artifact_id}/zip > reference.zip
145-
fi
130+
REFERENCE_RUN_ID="$(gh --repo ${GITHUB_REPOSITORY} issue view ${reference_issue} \
131+
--json body -q .body |grep "Inductor-XPU-OP-Benchmark-Data" |sed 's/.*: *//')"
132+
gh --repo ${GITHUB_REPOSITORY} run download ${REFERENCE_RUN_ID} -p "Inductor-XPU-OP-Benchmark-Data-*"
146133
rm -rf ${GITHUB_WORKSPACE:-"/tmp"}/reference
147134
mkdir ${GITHUB_WORKSPACE:-"/tmp"}/reference
148-
mv reference.zip ${GITHUB_WORKSPACE:-"/tmp"}/reference
149-
unzip ${GITHUB_WORKSPACE:-"/tmp"}/reference/reference.zip -d ${GITHUB_WORKSPACE:-"/tmp"}/reference > /dev/null 2>&1
135+
mv Inductor-XPU-OP-Benchmark-Data-*/* ${GITHUB_WORKSPACE:-"/tmp"}/reference
150136
151137
mkdir ${{ github.workspace }}/baseline
152138
if [[ -f "${GITHUB_WORKSPACE:-"/tmp"}/reference/new_baseline/baseline_forward_op_summary.csv" ]]; then
@@ -182,3 +168,9 @@ jobs:
182168
with:
183169
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}
184170
path: ${{ github.workspace }}/op_benchmark
171+
- name: Upload Reference Run ID
172+
if: ${{ env.run_type != 'on-demand' }}
173+
run: |
174+
gh --repo ${GITHUB_REPOSITORY} issue view ${reference_issue} --json body -q .body | \
175+
sed "s/Inductor-XPU-OP-Benchmark-Data:.*/Inductor-XPU-OP-Benchmark-Data: ${GITHUB_RUN_ID}/" | sed '/^$/d' > new_body.txt
176+
gh --repo ${GITHUB_REPOSITORY} issue edit ${reference_issue} --body-file new_body.txt

0 commit comments

Comments
 (0)