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 generic device and initial support in portBLAS #566

Merged
merged 10 commits into from
Sep 30, 2024
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ oneMKL is part of the [UXL Foundation](http://www.uxlfoundation.org).
</tr>
<tr>
<td align="center"><a href="https://github.com/codeplaysoftware/portBLAS"> portBLAS </a></td>
<td align="center">x86 CPU, Intel GPU, NVIDIA GPU, AMD GPU</td>
<td align="center">x86 CPU, Intel GPU, NVIDIA GPU, AMD GPU, Other SYCL devices (unsupported)</td>
</tr>
<tr>
<td align="center"><a href="https://github.com/codeplaysoftware/portFFT"> portFFT </a></td>
Expand Down Expand Up @@ -172,7 +172,7 @@ Supported compilers include:
</thead>
<tbody>
<tr>
<td rowspan=9 align="center">BLAS</td>
<td rowspan=10 align="center">BLAS</td>
<td rowspan=3 align="center">x86 CPU</td>
<td align="center">Intel(R) oneMKL</td>
<td align="center">Intel DPC++</br>AdaptiveCpp</td>
Expand Down Expand Up @@ -221,6 +221,12 @@ Supported compilers include:
<td align="center">Open DPC++</td>
<td align="center">Dynamic, Static</td>
</tr>
<tr>
<td rowspan=1 align="center">Other SYCL devices (unsupported)</td>
<td align="center">portBLAS</td>
<td align="center">Intel DPC++</br>Open DPC++</td>
<td align="center">Dynamic, Static</td>
</tr>
<tr>
<td rowspan=4 align="center">LAPACK</td>
<td align="center">x86 CPU</td>
Expand Down Expand Up @@ -405,6 +411,7 @@ Supported compilers include:
- Intel(R) Data Center GPU Max Series
- NVIDIA(R) A100 (Linux* only)
- AMD(R) GPUs see [here](https://github.com/RadeonOpenCompute/ROCm#hardware-and-software-support) tested on AMD Vega 20 (gfx906)
- Other SYCL devices can be used, but are not supported

---
### Supported Operating Systems
Expand Down
30 changes: 30 additions & 0 deletions docs/building_the_project_with_dpcpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@ A few often-used architectures are listed below:
For a host with ROCm installed, the device architecture can be retrieved via the
``rocminfo`` tool. The architecture will be displayed in the ``Name:`` row.

.. _build_for_other_SYCL_devices:

Building for other SYCL devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SYCL enables portable heterogeneous computing on a wide range of accelerators.
Consequently, it is possible to use oneMKL Interfaces with accelerators not
anticipated by the oneMKL Interfaces team.

For generic SYCL devices, only the portBLAS backend is enabled. The user must
set the appropriate ``-fsycl-targets`` for their device, and also any
``PORTBLAS_TUNING_TARGET`` required for performance. See
`Building for portBLAS`_. Extensive testing is strongly advised for these
unsupported configurations.

.. _build_for_portlibs_dpcpp:

Pure SYCL backends: portBLAS and portFFT
Expand Down Expand Up @@ -408,6 +423,21 @@ set, the backend libraries to enable the use of BLAS, LAPACK and RNG with MKLGPU
and MKLCPU would also be enabled. The build of examples is disabled. Since
functional testing was not disabled, tests would be built.

Build oneMKL for the BLAS domain on a generic SYCL device:

.. code-block:: bash

cmake $ONEMKL_DIR \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DENABLE_MKLCPU_BACKEND=False \
-DENABLE_MKLGPU_BACKEND=False \
-DENABLE_PORTBLAS_BACKEND=True

Note that this is not a tested configuration. This builds oneMKL Interfaces
with the portBLAS backend only, for a generic SYCL device supported by the
Open DPC++ project.

.. _project_cleanup:

Project Cleanup
Expand Down
8 changes: 7 additions & 1 deletion include/oneapi/mkl/detail/backends_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
namespace oneapi {
namespace mkl {

enum class device : uint16_t { x86cpu, intelgpu, nvidiagpu, amdgpu };
enum class device : uint16_t { x86cpu, intelgpu, nvidiagpu, amdgpu, generic_device };
enum class domain : uint16_t { blas, dft, lapack, rng, sparse_blas };

static std::map<domain, std::map<device, std::vector<const char*>>> libraries = {
Expand Down Expand Up @@ -82,6 +82,12 @@ static std::map<domain, std::map<device, std::vector<const char*>>> libraries =
#endif
#ifdef ENABLE_PORTBLAS_BACKEND_NVIDIA_GPU
LIB_NAME("blas_portblas"),
#endif
} },
{ device::generic_device,
{
#ifdef ENABLE_PORTBLAS_BACKEND
LIB_NAME("blas_portblas"),
#endif
} } } },

Expand Down
4 changes: 2 additions & 2 deletions include/oneapi/mkl/detail/get_device_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ inline oneapi::mkl::device get_device_id(sycl::queue &queue) {
else if (vendor_id == AMD_ID)
device_id = device::amdgpu;
else {
throw unsupported_device("", "", queue.get_device());
device_id = device::generic_device;
}
}
else {
throw unsupported_device("", "", queue.get_device());
device_id = device::generic_device;
}
return device_id;
}
Expand Down
Loading
Loading