-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'drm-accel-2022-11-22' of https://git.kernel.org/pub/scm/li…
…nux/kernel/git/ogabbay/accel into drm-next This tag contains the patches that add the new compute acceleration subsystem, which is part of the DRM subsystem. The patches: - Add a new directory at drivers/accel. - Add a new major (261) for compute accelerators. - Add a new DRM minor type for compute accelerators. - Integrate the accel core code with DRM core code. - Add documentation for the accel subsystem. Signed-off-by: Dave Airlie <airlied@redhat.com> some acks from the list (some are in the patch series): Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Sonal Santan <sonal.santan@amd.com> Acked-by: Maxime Ripard <maxime@cerno.tech> Acked-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Tested-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> From: Oded Gabbay <ogabbay@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20221122112222.GA352082@ogabbay-vm-u20.habana-labs.com
- Loading branch information
Showing
16 changed files
with
711 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.. SPDX-License-Identifier: GPL-2.0 | ||
==================== | ||
Compute Accelerators | ||
==================== | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
introduction | ||
|
||
.. only:: subproject and html | ||
|
||
Indices | ||
======= | ||
|
||
* :ref:`genindex` |
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,110 @@ | ||
.. SPDX-License-Identifier: GPL-2.0 | ||
============ | ||
Introduction | ||
============ | ||
|
||
The Linux compute accelerators subsystem is designed to expose compute | ||
accelerators in a common way to user-space and provide a common set of | ||
functionality. | ||
|
||
These devices can be either stand-alone ASICs or IP blocks inside an SoC/GPU. | ||
Although these devices are typically designed to accelerate | ||
Machine-Learning (ML) and/or Deep-Learning (DL) computations, the accel layer | ||
is not limited to handling these types of accelerators. | ||
|
||
Typically, a compute accelerator will belong to one of the following | ||
categories: | ||
|
||
- Edge AI - doing inference at an edge device. It can be an embedded ASIC/FPGA, | ||
or an IP inside a SoC (e.g. laptop web camera). These devices | ||
are typically configured using registers and can work with or without DMA. | ||
|
||
- Inference data-center - single/multi user devices in a large server. This | ||
type of device can be stand-alone or an IP inside a SoC or a GPU. It will | ||
have on-board DRAM (to hold the DL topology), DMA engines and | ||
command submission queues (either kernel or user-space queues). | ||
It might also have an MMU to manage multiple users and might also enable | ||
virtualization (SR-IOV) to support multiple VMs on the same device. In | ||
addition, these devices will usually have some tools, such as profiler and | ||
debugger. | ||
|
||
- Training data-center - Similar to Inference data-center cards, but typically | ||
have more computational power and memory b/w (e.g. HBM) and will likely have | ||
a method of scaling-up/out, i.e. connecting to other training cards inside | ||
the server or in other servers, respectively. | ||
|
||
All these devices typically have different runtime user-space software stacks, | ||
that are tailored-made to their h/w. In addition, they will also probably | ||
include a compiler to generate programs to their custom-made computational | ||
engines. Typically, the common layer in user-space will be the DL frameworks, | ||
such as PyTorch and TensorFlow. | ||
|
||
Sharing code with DRM | ||
===================== | ||
|
||
Because this type of devices can be an IP inside GPUs or have similar | ||
characteristics as those of GPUs, the accel subsystem will use the | ||
DRM subsystem's code and functionality. i.e. the accel core code will | ||
be part of the DRM subsystem and an accel device will be a new type of DRM | ||
device. | ||
|
||
This will allow us to leverage the extensive DRM code-base and | ||
collaborate with DRM developers that have experience with this type of | ||
devices. In addition, new features that will be added for the accelerator | ||
drivers can be of use to GPU drivers as well. | ||
|
||
Differentiation from GPUs | ||
========================= | ||
|
||
Because we want to prevent the extensive user-space graphic software stack | ||
from trying to use an accelerator as a GPU, the compute accelerators will be | ||
differentiated from GPUs by using a new major number and new device char files. | ||
|
||
Furthermore, the drivers will be located in a separate place in the kernel | ||
tree - drivers/accel/. | ||
|
||
The accelerator devices will be exposed to the user space with the dedicated | ||
261 major number and will have the following convention: | ||
|
||
- device char files - /dev/accel/accel* | ||
- sysfs - /sys/class/accel/accel*/ | ||
- debugfs - /sys/kernel/debug/accel/accel*/ | ||
|
||
Getting Started | ||
=============== | ||
|
||
First, read the DRM documentation at Documentation/gpu/index.rst. | ||
Not only it will explain how to write a new DRM driver but it will also | ||
contain all the information on how to contribute, the Code Of Conduct and | ||
what is the coding style/documentation. All of that is the same for the | ||
accel subsystem. | ||
|
||
Second, make sure the kernel is configured with CONFIG_DRM_ACCEL. | ||
|
||
To expose your device as an accelerator, two changes are needed to | ||
be done in your driver (as opposed to a standard DRM driver): | ||
|
||
- Add the DRIVER_COMPUTE_ACCEL feature flag in your drm_driver's | ||
driver_features field. It is important to note that this driver feature is | ||
mutually exclusive with DRIVER_RENDER and DRIVER_MODESET. Devices that want | ||
to expose both graphics and compute device char files should be handled by | ||
two drivers that are connected using the auxiliary bus framework. | ||
|
||
- Change the open callback in your driver fops structure to accel_open(). | ||
Alternatively, your driver can use DEFINE_DRM_ACCEL_FOPS macro to easily | ||
set the correct function operations pointers structure. | ||
|
||
External References | ||
=================== | ||
|
||
email threads | ||
------------- | ||
|
||
* `Initial discussion on the New subsystem for acceleration devices <https://lkml.org/lkml/2022/7/31/83>`_ - Oded Gabbay (2022) | ||
* `patch-set to add the new subsystem <https://lkml.org/lkml/2022/10/22/544>`_ - Oded Gabbay (2022) | ||
|
||
Conference talks | ||
---------------- | ||
|
||
* `LPC 2022 Accelerators BOF outcomes summary <https://airlied.blogspot.com/2022/09/accelerators-bof-outcomes-summary.html>`_ - Dave Airlie (2022) |
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 |
---|---|---|
|
@@ -43,6 +43,7 @@ needed). | |
input/index | ||
hwmon/index | ||
gpu/index | ||
accel/index | ||
security/index | ||
sound/index | ||
crypto/index | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# | ||
# Compute Acceleration device configuration | ||
# | ||
# This framework provides support for compute acceleration devices, such | ||
# as, but not limited to, Machine-Learning and Deep-Learning acceleration | ||
# devices | ||
# | ||
menuconfig DRM_ACCEL | ||
bool "Compute Acceleration Framework" | ||
depends on DRM | ||
help | ||
Framework for device drivers of compute acceleration devices, such | ||
as, but not limited to, Machine-Learning and Deep-Learning | ||
acceleration devices. | ||
If you say Y here, you need to select the module that's right for | ||
your acceleration device from the list below. | ||
This framework is integrated with the DRM subsystem as compute | ||
accelerators and GPUs share a lot in common and can use almost the | ||
same infrastructure code. | ||
Having said that, acceleration devices will have a different | ||
major number than GPUs, and will be exposed to user-space using | ||
different device files, called accel/accel* (in /dev, sysfs | ||
and debugfs). |
Oops, something went wrong.