Skip to content
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

Add support inference on SYCL devices #9800

Merged
merged 23 commits into from
Dec 4, 2023

Conversation

razdoburdin
Copy link
Contributor

@razdoburdin razdoburdin commented Nov 21, 2023

In continuation of #9691
This PR adds experimental support of prediction with SYCL devices.

The key changes are:

  • Added the new predictor: sycl_predictor, which is calling if SYCL device parameter is specified.
  • Currently only the PredictBatch method has a native SYCL implementation.
  • For building with SYCL support, user should specify the key -DPLUGIN_SYCL=ON for cmake.
  • C++ unit tests for SYCL were rewrited for better unification with another tests in the repo.
  • Python tests for SYCL prediction were added.
  • CI configuration files were renewed, SYCL tests were added.

- conda-forge
- intel
dependencies:
- python=3.8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be it 3.8 or higher?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have used the same config, as is already used for cpu

plugin/sycl/README.md Outdated Show resolved Hide resolved
Co-authored-by: Nikolay Petrov <[email protected]>
.github/workflows/main.yml Outdated Show resolved Hide resolved
.github/workflows/python_tests.yml Outdated Show resolved Hide resolved
include/xgboost/context.h Outdated Show resolved Hide resolved
@@ -262,7 +269,6 @@ struct Context : public XGBoostParameter<Context> {
*/
template <typename CPUFn, typename CUDAFn, typename SYCLFn>
decltype(auto) DispatchDevice(CPUFn&& cpu_fn, CUDAFn&& cuda_fn, SYCLFn&& sycl_fn) const {
static_assert(std::is_same_v<std::invoke_result_t<CPUFn>, std::invoke_result_t<CUDAFn>>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of non-sycl device, the DispatchDevice with this assert will be called. So, it was just a duplicated assert.

tests/python-sycl/test_sycl_prediction.py Outdated Show resolved Hide resolved
tests/python-sycl/test_sycl_prediction.py Show resolved Hide resolved
plugin/sycl/device_manager.h Outdated Show resolved Hide resolved
plugin/sycl/device_manager.h Outdated Show resolved Hide resolved
#include "xgboost/context.h"

namespace xgboost {
namespace sycl {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you want to use sycl namespace in the first PR? In the future, you will have to keep doing ::sycl for the global sycl namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This option is not perfect, but looks like the best one.

plugin/sycl/README.md Outdated Show resolved Hide resolved
plugin/sycl/README.md Outdated Show resolved Hide resolved
plugin/sycl/README.md Outdated Show resolved Hide resolved
plugin/sycl/device_manager.cc Outdated Show resolved Hide resolved
plugin/sycl/README.md Show resolved Hide resolved
plugin/sycl/device_manager.h Outdated Show resolved Hide resolved
tests/cpp/plugin/test_sycl_predictor.cc Outdated Show resolved Hide resolved
```

## Dependencies
To build the plugin, install [Intel® oneAPI DPC++/C++ Compiler](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also should mention that once build - for running plugin you have to resolve DPC compiler runtime + drivers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@trivialfis
Copy link
Member

Hi, could you please help take a look into the CI errors?

@razdoburdin
Copy link
Contributor Author

Hi, could you please help take a look into the CI errors?

working on it right now. Will fix it asap.

@trivialfis
Copy link
Member

no worries, we trigger AWS workers for the CI manually. It was just a friendly reminder that the CI has been triggered.

@razdoburdin
Copy link
Contributor Author

no worries, we trigger AWS workers for the CI manually. It was just a friendly reminder that the CI has been triggered.
Fixed it for my local machine. Please try to launch CI again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants