Add aten::topk and its variants #1900
Workflow file for this run
This file contains 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: pull | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- converted_to_draft | |
- ready_for_review | |
branches: | |
- main | |
- release/* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
preci-ut: | |
# Don't run on forked repos and draft PRs | |
if: ${{ (github.repository_owner == 'intel') && (github.event.pull_request.draft == false) }} | |
name: preci-ut | |
runs-on: linux.idc.xpu | |
timeout-minutes: 240 | |
steps: | |
- name: Checkout torch-xpu-ops | |
uses: actions/checkout@v3 | |
- name: Prepare Stock Pytorch | |
run: | | |
pwd | |
cd ../ && rm -rf pytorch | |
git clone -b main https://github.com/pytorch/pytorch | |
cd pytorch && git log -n 1 && git submodule sync && git submodule update --init --recursive | |
rm -rf third_party/torch-xpu-ops && cp -r ../torch-xpu-ops third_party/ | |
# Workaround for torch-xpu-ops ci test | |
sed -i "s/checkout --quiet \${TORCH_XPU_OPS_COMMIT}/log -n 1/g" caffe2/CMakeLists.txt | |
- name: Build Pytorch XPU | |
run: | | |
which conda && conda clean -ay | |
conda remove --all -y -n xpu_op_${ZE_AFFINITY_MASK} || \ | |
rm -rf $(dirname ${CONDA_EXE})/../envs/xpu_op_${ZE_AFFINITY_MASK} | |
conda create -n xpu_op_${ZE_AFFINITY_MASK} python=3.10 cmake ninja -y | |
source activate xpu_op_${ZE_AFFINITY_MASK} | |
conda install -c intel mkl-static mkl-include -y | |
cd ../pytorch | |
pip install -r requirements.txt | |
export USE_XPU=1 | |
source /opt/intel/oneapi/compiler/latest/env/vars.sh | |
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"} | |
python setup.py bdist_wheel | |
pip install --force-reinstall dist/*.whl | |
git clone https://github.com/pytorch/vision && cd vision && python setup.py install && cd .. | |
pip install -r .ci/docker/requirements-ci.txt | |
- name: Run XPU OP Examples | |
if: ${{ hashFiles('examples/') != '' }} | |
run: | | |
xpu-smi discovery | |
source /opt/intel/oneapi/compiler/latest/env/vars.sh | |
source activate xpu_op_${ZE_AFFINITY_MASK} | |
cd examples | |
pip install pytest | |
timeout 8000 pytest -v | |
- name: Run XPU OP Extended UT | |
if: ${{ hashFiles('test/xpu/') != '' }} | |
run: | | |
source /opt/intel/oneapi/compiler/latest/env/vars.sh | |
source activate xpu_op_${ZE_AFFINITY_MASK} | |
export PYTORCH_TEST_WITH_SLOW=1 | |
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/ | |
timeout 10000 python run_test_with_skip.py | |
- name: Run XPU OP UT | |
if: ${{ hashFiles('test/xpu/') != '' }} | |
run: | | |
source /opt/intel/oneapi/compiler/latest/env/vars.sh | |
source activate xpu_op_${ZE_AFFINITY_MASK} | |
export PYTORCH_ENABLE_XPU_FALLBACK=1 | |
export PYTORCH_TEST_WITH_SLOW=1 | |
cd ../pytorch/third_party/torch-xpu-ops/test/xpu | |
timeout 10000 python run_test_with_skip.py | |
# Cases run with a on-demand white list, since some suites are too | |
# slow to go through all operators on CPU. So add cases on-demand | |
# when XPU implementatoin is done. | |
# test_foreach, test_decomp | |
timeout 10000 python run_test_with_only.py | |
- name: Run Torch XPU UT | |
run: | | |
source /opt/intel/oneapi/compiler/latest/env/vars.sh | |
source activate xpu_op_${ZE_AFFINITY_MASK} | |
cd ../pytorch | |
TEST_REPORTS_DIR=$(pwd)/test/test-reports | |
rm -rf "$TEST_REPORTS_DIR" && mkdir -p "$TEST_REPORTS_DIR" | |
# Run Pytorch XPU binary UT | |
for xpu_case in build/bin/*{xpu,sycl}*; do | |
if [[ "$xpu_case" != *"*"* && "$xpu_case" != *.so && "$xpu_case" != *.a ]]; then | |
case_name=$(basename "$xpu_case") | |
echo "Testing ${case_name} ..." | |
"$xpu_case" --gtest_output=xml:"$TEST_REPORTS_DIR"/"$case_name".xml | |
fi | |
done | |
# Run Pytorch XPU python UT | |
export PYTORCH_ENABLE_XPU_FALLBACK=1 | |
sed -i 's/selected_tests = exclude_tests(XPU_BLOCKLIST.*/selected_tests = XPU_TEST/g' ./test/run_test.py | |
python test/run_test.py --xpu |