Skip to content

Commit b0bf7f2

Browse files
change the baseline save and compare function
1 parent cd7067e commit b0bf7f2

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

.github/workflows/_linux_op_benchmark.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,38 @@ jobs:
121121
bash ${{ github.workspace }}/.github/scripts/microbench_summary.sh ${{ github.workspace }}/op_benchmark ${{ github.workspace }}/op_benchmark/forward_op_summary.csv
122122
# Summary backward op time
123123
bash ${{ github.workspace }}/.github/scripts/microbench_summary.sh ${{ github.workspace }}/op_benchmark ${{ github.workspace }}/op_benchmark/backward_op_summary.csv True
124-
- name: Upload Inductor XPU OP benchmark Log
125-
if: always()
126-
uses: actions/upload-artifact@v4
127-
with:
128-
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}
129-
path: ${{ github.workspace }}/op_benchmark
130124
- name: Download OP Baseline
131125
continue-on-error: true
132126
run: |
133-
# Download forward baseline
134-
curl -L "https://api.github.com/repos/${GITHUB_REPOSITORY:-"intel/torch-xpu-ops"}/new_baseline/baseline_forward_op_summary.csv?ref=gh-pages" \
135-
-H "Accept: application/vnd.github.raw" \
136-
-o baseline_forward_op_summary.csv
137-
138-
# Download backward baseline
139-
curl -L "https://api.github.com/repos/${GITHUB_REPOSITORY:-"intel/torch-xpu-ops"}/new_baseline/baseline_backward_op_summary.csv?ref=gh-pages" \
140-
-H "Accept: application/vnd.github.raw" \
141-
-o baseline_backward_op_summary.csv
127+
gh api \
128+
--method GET -F per_page=100 -F page=10 \
129+
-H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
130+
/repos/${GITHUB_REPOSITORY:-"intel/torch-xpu-ops"}/actions/artifacts \
131+
> ${GITHUB_WORKSPACE:-"/tmp"}/refer.json
132+
artifact_id="$(eval "jq -r \
133+
'[.artifacts[] | \
134+
select(.name|test(\"Inductor-XPU-OP-Benchmark-Data.*\")) | \
135+
select(.workflow_run.head_branch|test(\"main\"))][0].id' \
136+
${GITHUB_WORKSPACE:-"/tmp"}/refer.json")"
137+
if [ "$artifact_id" -gt 1 ];then
138+
gh api \
139+
-H "Accept: application/vnd.github+json" \
140+
-H "X-GitHub-Api-Version: 2022-11-28" \
141+
/repos/${GITHUB_REPOSITORY:-"intel/torch-xpu-ops"}/actions/artifacts/${artifact_id}/zip > reference.zip
142+
fi
143+
rm -rf ${GITHUB_WORKSPACE:-"/tmp"}/reference
144+
mkdir ${GITHUB_WORKSPACE:-"/tmp"}/reference
145+
mv reference.zip ${GITHUB_WORKSPACE:-"/tmp"}/reference
146+
unzip ${GITHUB_WORKSPACE:-"/tmp"}/reference/reference.zip -d ${GITHUB_WORKSPACE:-"/tmp"}/reference > /dev/null 2>&1
142147
143148
mkdir ${{ github.workspace }}/baseline
144-
cp baseline*.csv ${{ github.workspace }}/baseline
149+
if [ -f "${GITHUB_WORKSPACE:-"/tmp"}/reference/new_baseline/baseline_forward_op_summary.csv" ]; then
150+
cp ${GITHUB_WORKSPACE:-"/tmp"}/reference/new_baseline/baseline_forward_op_summary.csv ${{ github.workspace }}/baseline
151+
cp ${GITHUB_WORKSPACE:-"/tmp"}/reference/new_baseline/baseline_backward_op_summary.csv ${{ github.workspace }}/baseline
152+
else
153+
cp ${GITHUB_WORKSPACE:-"/tmp"}/reference/forward_op_summary.csv ${{ github.workspace }}/baseline/baseline_forward_op_summary.csv
154+
cp ${GITHUB_WORKSPACE:-"/tmp"}/reference/backward_op_summary.csv ${{ github.workspace }}/baseline/baseline_backward_op_summary.csv
155+
fi
145156
- name: Check OP Baseline
146157
run: |
147158
forward_exists=$([ -f "baseline/baseline_forward_op_summary.csv" ] && echo "true" || echo "false")
@@ -155,6 +166,7 @@ jobs:
155166
mkdir ${{ github.workspace }}/new_baseline
156167
cp ${{ github.workspace }}/op_benchmark/forward_op_summary.csv ${{ github.workspace }}/new_baseline/baseline_forward_op_summary.csv
157168
cp ${{ github.workspace }}/op_benchmark/backward_op_summary.csv ${{ github.workspace }}/new_baseline/baseline_backward_op_summary.csv
169+
cp -r ${{ github.workspace }}/new_baseline ${{ github.workspace }}/op_benchmark
158170
echo "Initial the Baseline Data"
159171
- name: Check the OP Regression
160172
if: steps.check-baseline.outputs.both_exist == 'true'
@@ -176,11 +188,10 @@ jobs:
176188
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
177189
# Update backward op
178190
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
179-
- name: Deploy Baseline to gh-pages
191+
cp -r ${{ github.workspace }}/new_baseline ${{ github.workspace }}/op_benchmark
192+
- name: Upload Inductor XPU OP benchmark Log
180193
if: always()
181-
uses: peaceiris/actions-gh-pages@v3
194+
uses: actions/upload-artifact@v4
182195
with:
183-
github_token: ${{ secrets.GITHUB_TOKEN }}
184-
publish_dir: ./new_baseline
185-
publish_branch: gh-pages
186-
force_orphan: true
196+
name: Inductor-XPU-OP-Benchmark-Data-${{ github.event.pull_request.number || github.sha }}
197+
path: ${{ github.workspace }}/op_benchmark

0 commit comments

Comments
 (0)