Skip to content

Commit

Permalink
gpu: nvidia, amd: switch a default internal stream to in-order
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarukin committed Sep 12, 2023
1 parent b782f8a commit 615236c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
12 changes: 5 additions & 7 deletions src/gpu/amd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

## General information

Support for AMD backend is implemented via SYCL HIP backend. The feature is disabled
by default. Users must enable it at build time with a CMake option `DNNL_GPU_VENDOR=AMD`.
The AMD GPUs can be used via oneDNN engine abstraction. The engine should be created using
`dnnl::engine::kind::gpu` engine kind or the user can provide a `sycl::device` objects that
corresponds to AMD GPUs. The stream in AMD backend defines an out-of-order SYCL queue by default.
Similar to the existing oneDNN API, user can specify an in-order queue when creating
a stream if needed.
Support for AMD backend is implemented via SYCL HIP backend. The feature is
disabled by default. Users must enable it at build time with a CMake option
`DNNL_GPU_VENDOR=AMD`. The AMD GPUs can be used via oneDNN engine abstraction.
The engine should be created using `dnnl::engine::kind::gpu` engine kind or the
user can provide a `sycl::device` objects that corresponds to AMD GPUs.

## Pre-requisites
* [oneAPI DPC++ Compiler with support for HIP AMD](https://github.com/intel/llvm/blob/sycl/sycl/doc/GetStartedGuide.md#build-dpc-toolchain-with-support-for-hip-amd), version [2022-12](https://github.com/intel/llvm/releases/tag/2022-12)
Expand Down
5 changes: 4 additions & 1 deletion src/gpu/amd/sycl_hip_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ status_t sycl_hip_stream_t::init() {
if (!queue_) {
auto &sycl_ctx = sycl_engine.context();
auto &sycl_dev = sycl_engine.device();
queue_.reset(new ::sycl::queue(sycl_ctx, sycl_dev));
::sycl::property_list prop_list;
if (flags() & stream_flags::in_order)
prop_list = {::sycl::property::queue::in_order {}};
queue_.reset(new ::sycl::queue(sycl_ctx, sycl_dev, prop_list));
} else {
// We need to check that the given queue is associated with
// the device and context of the engine.
Expand Down
17 changes: 6 additions & 11 deletions src/gpu/nvidia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@

## General information

The Nvidia backend for oneDNN can be exposed to the user via the
`dnnl::engine::kind::gpu` engine kind. Currently, for the case when user's
system has both Intel and Nvidia GPUs, `DNNL_GPU_VENDOR=NVIDIA` flag is used in
CMake, since the devices are clustered based on the device vendor ID and index
pattern can not be used to distinguish between Intel GPU and Nvidia GPU.
However, Intel is working on restructuring the engine creation, so that it would
be possible to choose engine kind and vendor kind at runtime. Also, it is
possible to create oneDNN engines using `sycl::device` objects corresponding to
Nvidia GPUs. The stream in Nvidia backend for oneDNN defines an out-of-order
SYCL queue by default. Similar to the existing oneDNN API, user can specify an
in-order queue when creating a stream if needed.
Support for Nvidia backend is implemented via SYCL CUDA backend. The feature is
disabled by default. Users must enable it at build time with a CMake option
`DNNL_GPU_VENDOR=NVIDIA`. The Nvidia GPUs can be used via oneDNN engine
abstraction. The engine should be created using `dnnl::engine::kind::gpu` engine
kind or the user can provide a `sycl::device` objects that corresponds to Nvidia
GPUs.

## Pre-requisites
* [oneAPI DPC++ Compiler with support for CUDA](https://github.com/intel/llvm/blob/sycl/sycl/doc/GetStartedGuide.md#build-dpc-toolchain-with-support-for-nvidia-cuda)
Expand Down
8 changes: 4 additions & 4 deletions src/gpu/nvidia/sycl_cuda_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ status_t sycl_cuda_stream_t::init() {
if (!queue_) {
auto &sycl_ctx = sycl_engine.context();
auto &sycl_dev = sycl_engine.device();
// Use `::sycl::property_list {::sycl::property::queue::in_order {}}` as
// third argument in `::sycl::queue` ctor to convert a queue into
// in-order one.
queue_.reset(new ::sycl::queue(sycl_ctx, sycl_dev));
::sycl::property_list prop_list;
if (flags() & stream_flags::in_order)
prop_list = {::sycl::property::queue::in_order {}};
queue_.reset(new ::sycl::queue(sycl_ctx, sycl_dev, prop_list));
} else {
auto sycl_dev = queue().get_device();
bool args_ok
Expand Down

0 comments on commit 615236c

Please sign in to comment.