-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rearrange_ops
- Loading branch information
Showing
14 changed files
with
710 additions
and
34 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: xpu-compile | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/xpu-compile.yml" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
|
||
jobs: | ||
compile-tests: | ||
runs-on: [self-hosted, intel, xpu] | ||
container: | ||
image: intel/oneapi-basekit:2024.2.1-0-devel-ubuntu22.04 | ||
ports: | ||
- 80 | ||
options: --privileged -it --rm --device /dev/dri:/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --ipc=host --cap-add=ALL | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install prerequisite | ||
run: | | ||
apt-get update | ||
apt-get install clinfo libaio-dev python3-pip -y | ||
pip install torch==2.3.1 -f https://pytorch-extension.intel.com/release-whl/stable/xpu/us/torch/ | ||
pip install intel-extension-for-pytorch==2.3.110+xpu -f https://pytorch-extension.intel.com/release-whl/stable/xpu/us/intel-extension-for-pytorch/ | ||
pip install oneccl_bind_pt==2.3.100+xpu -f https://pytorch-extension.intel.com/release-whl/stable/xpu/us/oneccl-bind-pt/ | ||
pip install torchvision==0.18.1 -f https://pytorch-extension.intel.com/release-whl/stable/xpu/us/torchvision/ | ||
pip install https://github.com/intel/intel-xpu-backend-for-triton/releases/download/v3.0.0b2/triton_xpu-3.0.0b2-cp310-cp310-linux_x86_64.whl | ||
pip install py-cpuinfo numpy | ||
pip install .[dev,autotuning] | ||
- name: Check container state | ||
run: | | ||
ldd --version | ||
ds_report | ||
python3 -c "import torch; print('torch:', torch.__version__, torch)" | ||
python3 -c "import torch; import intel_extension_for_pytorch; print('XPU available:', torch.xpu.is_available())" | ||
python3 -c "from deepspeed.accelerator import get_accelerator; print('accelerator:', get_accelerator()._name)" | ||
pip list | ||
- name: Compile Status | ||
shell: bash | ||
run: | | ||
export FI_HMEM=system | ||
ulimit -n 1048575 | ||
cd tests/torch_compile | ||
export ZE_AFFINITY_MASK=0,1 | ||
deepspeed test_compile.py --deepspeed_config ds_config.json 2>&1 | tee log.txt | ||
cat log.txt | grep "'graph_breaks'" | sed 's/,/ /g' | awk '{print $2}' >> $GITHUB_STEP_SUMMARY |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// DeepSpeed Team | ||
|
||
#include "deepspeed_cpu_op.h" | ||
|
||
using namespace std; | ||
|
||
cpu_op_desc_t::cpu_op_desc_t(const bool read_op, | ||
const torch::Tensor& buffer, | ||
const int fd, | ||
const char* filename, | ||
const long long int file_num_bytes, | ||
const int num_threads, | ||
const bool validate) | ||
: io_op_desc_t(read_op, buffer, fd, filename, file_num_bytes, num_threads, validate), | ||
_cpu_buffer(buffer) | ||
{ | ||
// XPU don't handle buffer here. See XPU Accelerator pin_memory. | ||
_contiguous_buffer = _cpu_buffer.contiguous(); | ||
} | ||
|
||
char* cpu_op_desc_t::data_ptr() const { return (char*)_contiguous_buffer.data_ptr(); } | ||
|
||
void cpu_op_desc_t::finish() | ||
{ | ||
if (_read_op && _buffer.is_xpu()) { _buffer.copy_(_cpu_buffer.to(torch::kXPU)); } | ||
} | ||
|
||
void cpu_op_desc_t::validate() | ||
{ | ||
validate_aio_operation(_read_op, _filename.c_str(), data_ptr(), _file_num_bytes); | ||
} | ||
|
||
void cpu_op_desc_t::run(const int tid, | ||
std::unique_ptr<aio_context>& aio_ctxt, | ||
deepspeed_aio_config_t* aio_config) | ||
{ | ||
assert(tid < _num_threads); | ||
const auto base_offset = _num_bytes_per_thread * tid; | ||
|
||
std::unique_ptr<io_xfer_ctxt> xfer_ctxt( | ||
new io_xfer_ctxt(_fd, base_offset, _num_bytes_per_thread, data_ptr())); | ||
|
||
if (aio_config->_overlap_events) { | ||
do_aio_operation_overlap(_read_op, aio_ctxt, xfer_ctxt, aio_config, nullptr); | ||
} else { | ||
do_aio_operation_sequential(_read_op, aio_ctxt, xfer_ctxt, aio_config, nullptr); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.