-
Notifications
You must be signed in to change notification settings - Fork 42
[Nightly] Enhance XPU test workflows #1723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c4a5df7
1649d91
6e1eaa0
e88956d
4653aa8
0bee6bf
9c62e16
7148fb4
5e36331
b2cf7dc
0f83a45
4df0df6
9526c42
145314f
1fb7cf4
011d1f4
855b7e9
14bb034
f2ded38
8057d64
563b597
e823753
a6059fc
ec54a2d
0b7b890
21dc4ee
2fd4de4
8df670c
27964a1
dac7180
ac69582
bee9e44
dddf97e
c96b98e
d8dfd22
c2c5193
e6a54bd
693d0ba
cc16f78
fa26db5
9398857
60da1e9
6cdb741
40bc0e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Cleans up diskspace | ||
|
||
description: Cleans up diskspace | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Cleans up diskspace | ||
shell: bash | ||
run: | | ||
set -xe -o pipefail | ||
# Clean workspace | ||
rm -rf ${{ github.workspace }}/* || sudo rm -rf ${{ github.workspace }}/* | ||
# Clean cache | ||
rm -rf /tmp/ || sudo rm -rf /tmp/ | ||
mkdir -m 777 /tmp || sudo mkdir -m 777 /tmp | ||
rm -rf ~/.torch || sudo rm -rf ~/.torch | ||
rm -rf ~/.triton || sudo rm -rf ~/.triton | ||
rm -rf ~/.cache || sudo rm -rf ~/.cache | ||
rm -rf ~/.conda || sudo rm -rf ~/.conda | ||
# Clean docker | ||
docker stop $(docker ps -aq) || true | ||
docker system prune -af |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Cleans up diskspace | ||
|
||
description: Cleans up diskspace | ||
|
||
inputs: | ||
suite: | ||
required: true | ||
type: string | ||
default: 'huggingface' | ||
description: Dynamo benchmarks test suite. huggingface,timm_models,torchbench. Delimiter is comma | ||
env_prepare: | ||
required: false | ||
description: If set to any value, will prepare suite test env | ||
dt: | ||
required: true | ||
type: string | ||
default: 'float32' | ||
description: Data precision of the test.float32,bfloat16,float16,amp_bf16,amp_fp16. Delimiter is comma | ||
mode: | ||
required: true | ||
type: string | ||
default: 'inference' | ||
description: inference,training. Delimiter is comma | ||
scenario: | ||
required: true | ||
type: string | ||
default: 'accuracy' | ||
description: accuracy,performance. Delimiter is comma | ||
cards: | ||
required: false | ||
type: string | ||
default: 'all' | ||
description: which cards can be used in the test | ||
hf_token: | ||
required: false | ||
description: HUGGING_FACE_HUB_TOKEN for torchbench test | ||
pytorch: | ||
required: false | ||
type: string | ||
default: 'main' | ||
description: Pytorch branch/commit | ||
driver: | ||
required: false | ||
type: string | ||
default: 'lts' | ||
description: Driver lts/rolling | ||
|
||
runs: | ||
using: composite | ||
defaults: | ||
run: | ||
shell: bash -xe -o pipefail | ||
steps: | ||
- name: Prepare PyTorch | ||
shell: bash | ||
run: | | ||
echo |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
set -xe -o pipefail | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this script is over design somehow. Add some suggestions
|
||
export GIT_PAGER=cat | ||
|
||
# Init params | ||
WORKSPACE=$(realpath ${WORKSPACE:-"/tmp"}) | ||
CONDA_ENV=${CONDA_ENV:-"xpu-test"} | ||
PYTHON_VERSION=${PYTHON_VERSION:-"3.10"} | ||
PYTORCH_REPO=${PYTORCH_REPO:-"https://github.com/pytorch/pytorch.git"} | ||
PYTORCH_VERSION=${PYTORCH_VERSION:-"main"} | ||
for var; do | ||
eval "export $(echo ${var@Q} |sed "s/^'-*//g;s/=/='/")" | ||
done | ||
|
||
# Python env via conda | ||
. "$(conda info -e |awk '{if($1=="base"){printf("%s/etc/profile.d/conda.sh", $NF)}}')" | ||
conda create python=${PYTHON_VERSION} -y -n ${CONDA_ENV} | ||
conda activate ${CONDA_ENV} | ||
conda info -e | ||
which python && python -V && conda list | ||
python -m pip install requests pandas scipy psutil | ||
|
||
# Prepare pytorch | ||
if [ "${PYTORCH_VERSION}" == "release" ];then | ||
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpu | ||
elif [ "${PYTORCH_VERSION}" == "test" ];then | ||
python -m pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/test/xpu | ||
elif [ "${PYTORCH_VERSION}" == "nightly" ];then | ||
python -m pip install torch torchvision torchaudio --pre --index-url https://download.pytorch.org/whl/nightly/xpu | ||
else | ||
python -m pip install ${WORKSPACE}/torch*.whl | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this step include torchvision and torchaudio installation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
fi | ||
TORCH_COMMIT="$(python -c 'import torch; print(torch.version.git_version)')" | ||
rm -rf ./pytorch | ||
git clone ${PYTORCH_REPO} pytorch | ||
cd pytorch | ||
git checkout ${TORCH_COMMIT} | ||
git remote -v && git branch && git show -s | ||
|
||
# Prepare torch-xpu-ops | ||
rm -rf third_party/torch-xpu-ops | ||
if [ "${PYTORCH_VERSION}" != "main" ];then | ||
TORCH_XPU_OPS_COMMIT=$(cat third_party/xpu.txt) | ||
git clone https://github.com/intel/torch-xpu-ops.git third_party/torch-xpu-ops | ||
cd third_party/torch-xpu-ops | ||
git checkout ${TORCH_XPU_OPS_COMMIT} | ||
else | ||
cp -r ${WORKSPACE} third_party/torch-xpu-ops | ||
cd third_party/torch-xpu-ops | ||
fi | ||
git remote -v && git branch && git show -s | ||
cd ../.. | ||
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ];then | ||
python third_party/torch-xpu-ops/.github/scripts/apply_torch_pr.py -e https://github.com/pytorch/pytorch/pull/152940 | ||
else | ||
python third_party/torch-xpu-ops/.github/scripts/apply_torch_pr.py | ||
fi | ||
|
||
# Install triton | ||
if [ "${TRITON_VERSION}" == "pinned" ];then | ||
TRITON_VERSION="$(cat .ci/docker/ci_commit_pins/triton-xpu.txt)" | ||
fi | ||
if [ -n "${TRITON_VERSION}" ];then | ||
TRITON_REPO="https://github.com/intel/intel-xpu-backend-for-triton" | ||
python -m pip uninstall -y pytorch-triton-xpu | ||
python -m pip install "git+${TRITON_REPO}@${TRITON_VERSION}#subdirectory=python" | ||
fi | ||
|
||
# Install requirements | ||
python -m pip install -r .ci/docker/requirements-ci.txt | ||
python -m pip install -U pytest pytest-timeout | ||
|
||
# Collect env infos | ||
cd .. | ||
python -c "import torch; print(torch.__config__.show())" | ||
python -c "import torch; print(torch.__config__.parallel_info())" | ||
python -c "import torch; print(torch.__config__.torch.xpu.device_count())" | ||
python -c "import triton; print(triton.__version__)" | ||
python pytorch/torch/utils/collect_env.py | ||
|
||
# Clean cache | ||
rm -rf /tmp/ || sudo rm -rf /tmp/ | ||
mkdir -m 777 /tmp || sudo mkdir -m 777 /tmp | ||
rm -rf ~/.torch || sudo rm -rf ~/.torch | ||
rm -rf ~/.triton || sudo rm -rf ~/.triton | ||
rm -rf ~/.cache || sudo rm -rf ~/.cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a env var or parameter control this behavior, by default off unless the var/parameter has been set to on.
Including triton build also. For pinned triton commit, we can use
make triton
directly under pytorch root dir. For customized triton commit, we can build by ourselves or leverage the scripts directly https://github.com/pytorch/pytorch/blob/main/.github/scripts/build_triton_wheel.py and refer usage https://github.com/chuanqi129/pytorch/blob/fix_triton_version_split/.github/workflows/build-triton-wheel.yml#L158-L160. Before this step, we need replace the pined triton xpu commit file content to customized one.cc: @RUIJIEZHONG66166