Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions docs/dev_guides/custom_device_docs/custom_runtime_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,45 @@
Device 接口
############

+------------------------+--------------------------+------+
| 接口名称 | 功能简介 | 必选 |
+========================+==========================+======+
| initialize | 初始化硬件后端。 | N |
+------------------------+--------------------------+------+
| finalize | 去初始化硬件后端。 | N |
+------------------------+--------------------------+------+
| init_device | 初始化指定硬件设备。 | N |
+------------------------+--------------------------+------+
| deinit_device | 去初始化指定硬件设备。 | N |
+------------------------+--------------------------+------+
| set_device | 设置当前使用的硬件设备。 | Y |
+------------------------+--------------------------+------+
| get_device | 获取当前使用的硬件设备。 | Y |
+------------------------+--------------------------+------+
| synchronize_device | 同步指定的硬件设备。 | Y |
+------------------------+--------------------------+------+
| get_device_count | 查询可用设备数量。 | Y |
+------------------------+--------------------------+------+
| get_device_list | 查询可用设备号。 | Y |
+------------------------+--------------------------+------+
| get_compute_capability | 查询设备算力。 | Y |
+------------------------+--------------------------+------+
| get_runtime_version | 查询运行时版本号。 | Y |
+------------------------+--------------------------+------+
| get_driver_version | 查询驱动版本号。 | Y |
+------------------------+--------------------------+------+
| get_multi_process | 获取设备上的MultiProcessor数量。 | N |
+------------------------+--------------------------+------+
| get_max_threads_per_mp | 获取设备每个MultiProcessor上的最大线程数。| N |
+------------------------+--------------------------+------+
| get_max_threads_per_block | 获取设备每个Block能够运行的最大线程数。 | N |
+------------------------+--------------------------+------+
| get_max_grid_dim_size | 获取设备最大网格维度大小。 | N |
+------------------------+--------------------------+------+
| init_eigen_device | 初始化Eigen GPU设备对象。 | N |
+------------------------+--------------------------+------+
| destroy_eigen_device | 销毁Eigen GPU设备对象。 | N |
+------------------------+--------------------------+------+
+---------------------------+--------------------------------------------+------+
| 接口名称 | 功能简介 | 必选 |
+===========================+============================================+======+
| initialize | 初始化硬件后端。 | N |
+---------------------------+--------------------------------------------+------+
| finalize | 去初始化硬件后端。 | N |
+---------------------------+--------------------------------------------+------+
| init_device | 初始化指定硬件设备。 | N |
+---------------------------+--------------------------------------------+------+
| deinit_device | 去初始化指定硬件设备。 | N |
+---------------------------+--------------------------------------------+------+
| set_device | 设置当前使用的硬件设备。 | Y |
+---------------------------+--------------------------------------------+------+
| get_device | 获取当前使用的硬件设备。 | Y |
+---------------------------+--------------------------------------------+------+
| synchronize_device | 同步指定的硬件设备。 | Y |
+---------------------------+--------------------------------------------+------+
| get_device_count | 查询可用设备数量。 | Y |
+---------------------------+--------------------------------------------+------+
| get_device_list | 查询可用设备号。 | Y |
+---------------------------+--------------------------------------------+------+
| get_compute_capability | 查询设备算力。 | Y |
+---------------------------+--------------------------------------------+------+
| get_runtime_version | 查询运行时版本号。 | Y |
+---------------------------+--------------------------------------------+------+
| get_driver_version | 查询驱动版本号。 | Y |
+---------------------------+--------------------------------------------+------+
| get_multi_process | 获取设备上的 MultiProcessor 数量。 | N |
+---------------------------+--------------------------------------------+------+
| get_max_threads_per_mp | 获取设备每个 MultiProcessor 上的最大线程数。 | N |
+---------------------------+--------------------------------------------+------+
| get_max_threads_per_block | 获取设备每个 Block 能够运行的最大线程数。 | N |
+---------------------------+--------------------------------------------+------+
| get_max_grid_dim_size | 获取设备最大网格维度大小。 | N |
+---------------------------+--------------------------------------------+------+
| init_eigen_device | 初始化 Eigen GPU 设备对象。 | N |
+---------------------------+--------------------------------------------+------+
| destroy_eigen_device | 销毁 Eigen GPU 设备对象。 | N |
+---------------------------+--------------------------------------------+------+


Memory 接口
Expand Down
66 changes: 39 additions & 27 deletions docs/dev_guides/custom_device_docs/custom_runtime_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,45 @@ Custom Runtime offers a new method to register the runtime of new devices via pl
Device APIs
############

+------------------------+----------------------------------------+----------+
| API | Function | Required |
+========================+========================================+==========+
| initialize | To initialize the device backend | N |
+------------------------+----------------------------------------+----------+
| finalize | To de-initialize the device backend | N |
+------------------------+----------------------------------------+----------+
| init_device | To initialize the designated device | N |
+------------------------+----------------------------------------+----------+
| deinit_device | To de-initialize the designated device | N |
+------------------------+----------------------------------------+----------+
| set_device | To set the current device | Y |
+------------------------+----------------------------------------+----------+
| get_device | To get the current device | Y |
+------------------------+----------------------------------------+----------+
| synchronize_device | To synchronize the desginated device | Y |
+------------------------+----------------------------------------+----------+
| get_device_count | To count available devices | Y |
+------------------------+----------------------------------------+----------+
| get_device_list | To get the list of available devices | Y |
+------------------------+----------------------------------------+----------+
| get_compute_capability | To get computing capability of devices | Y |
+------------------------+----------------------------------------+----------+
| get_runtime_version | To get the runtime version | Y |
+------------------------+----------------------------------------+----------+
| get_driver_version | To get the driver version | Y |
+------------------------+----------------------------------------+----------+
+---------------------------+----------------------------------------------------------+----------+
| API | Function | Required |
+===========================+==========================================================+==========+
| initialize | To initialize the device backend | N |
+---------------------------+----------------------------------------------------------+----------+
| finalize | To de-initialize the device backend | N |
+---------------------------+----------------------------------------------------------+----------+
| init_device | To initialize the designated device | N |
+---------------------------+----------------------------------------------------------+----------+
| deinit_device | To de-initialize the designated device | N |
+---------------------------+----------------------------------------------------------+----------+
| set_device | To set the current device | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_device | To get the current device | Y |
+---------------------------+----------------------------------------------------------+----------+
| synchronize_device | To synchronize the desginated device | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_device_count | To count available devices | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_device_list | To get the list of available devices | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_compute_capability | To get computing capability of devices | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_runtime_version | To get the runtime version | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_driver_version | To get the driver version | Y |
+---------------------------+----------------------------------------------------------+----------+
| get_multi_process | To get the number of MultiProcessors on the device | N |
+---------------------------+----------------------------------------------------------+----------+
| get_max_threads_per_mp | To get the max threads per MultiProcessor | N |
+---------------------------+----------------------------------------------------------+----------+
| get_max_threads_per_block | To get the max threads per block | N |
+---------------------------+----------------------------------------------------------+----------+
| get_max_grid_dim_size | To get the max grid dimension size | N |
+---------------------------+----------------------------------------------------------+----------+
| init_eigen_device | To initialize the Eigen GPU device object | N |
+---------------------------+----------------------------------------------------------+----------+
| destroy_eigen_device | To destroy the Eigen GPU device object | N |
+---------------------------+----------------------------------------------------------+----------+


Memory APIs
Expand Down
108 changes: 108 additions & 0 deletions docs/dev_guides/custom_device_docs/device_api_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,111 @@ It gets the driver version.
### Parameter

version - the version of the stored driver

## get_multi_process 【optional】

### Definition

```c++
C_Status (*get_multi_process)(const C_Device device, size_t* multi_process);
```

### Description

Get the number of MultiProcessors on the device.

### Parameter

device - the device to query.
multi_process - to store the number of MultiProcessors.

## get_max_threads_per_mp 【optional】

### Definition

```c++
C_Status (*get_max_threads_per_mp)(const C_Device device, size_t* threads_per_mp);
```

### Description

Get the maximum number of threads per MultiProcessor on the device.

### Parameter

device - the device to query.
threads_per_mp - to store the maximum threads per MultiProcessor.

## get_max_threads_per_block 【optional】

### Definition

```c++
C_Status (*get_max_threads_per_block)(const C_Device device, size_t* threads_per_block);
```

### Description

Get the maximum number of threads per block that can run on the device.

### Parameter

device - the device to query.
threads_per_block - to store the maximum threads per block.

## get_max_grid_dim_size 【optional】

### Definition

```c++
C_Status (*get_max_grid_dim_size)(const C_Device device, std::array<unsigned int, 3>* grid_dim_size);
```

### Description

Get the maximum grid dimension size of the device.

### Parameter

device - the device to query.
grid_dim_size - to store the maximum grid dimension size.

## init_eigen_device 【optional】

### Definition

```c++
C_Status (*init_eigen_device)(C_Place place,
C_EigenDevice* eigen_device,
C_Stream stream,
C_Allocator allocator);
```

### Description

Initialize the Eigen GPU device object.

### Parameter

place - the place object of the device to use.
eigen_device - to store the Eigen GPU device object.
stream - the stream object in Custom Context.
allocator - the allocator object in Custom Context.

## destroy_eigen_device 【optional】

### Definition

```c++
C_Status (*destroy_eigen_device)(const C_Device device,
C_EigenDevice* eigen_device);
```

### Description

Destroy the Eigen GPU device object.

### Parameter

device - the device object to use.
eigen_device - the Eigen GPU device object to be destroyed.