Skip to content

Commit 3073f78

Browse files
authored
update kernel primitive doc (PaddlePaddle#3977)
* update kernel primitive doc * update english doc
1 parent 7f9fbaf commit 3073f78

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/guides/07_new_op/kernel_primitive_api/index_cn.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
Kernel Primitive API
33
#############
44

5-
本部分为 PaddlePaddle 高级开发人员提供了用于 Kernel 开发的 CUDA Kernel Primitive API,该类 API 能够帮助开发者在提升开发效率的同时收获较好的性能。Kernel Primitive API 主要包括 IO API、Compute API以及 OpFunc,IO API 能够高效的完成全局内存与寄存器间的数据读写操作;Compute API 为通用计算函数,如ElementwiseBinary、ElementwiseUnary 等;OpFunc 用于定义 Compute API 中的计算规则,例如实现 Add 操作则需要定义 AddFunctor 用于 ElementwiseBinary 调用,开发者可以直接使用默认的 OpFunc 也可以根据需要进行自定义,具体的实现规则将在 OpFunc 小节中进行详细介绍。当前 API 均是 Block 级别的多线程 API,开发者可以直接传入当前 Block 的数据指针以及操作类型完成相应的计算,目前仅支持全局数据指针和寄存器指针。
5+
Kernel Primitive API 对算子 Kernel 实现中的底层代码进行了抽象与功能封装,提供高性能的 Block 级 IO 运算和 Compute 运算。使用 Kernel Primitive API 进行 Kernel 开发可以更加专注计算逻辑的实现,在保证性能的同时大幅减少代码量,同时实现了算子计算与硬件解耦。
6+
7+
本部分为 PaddlePaddle 高级开发人员提供了用于 Kernel 开发的 CUDA Kernel Primitive API,该类 API 能够帮助开发者在提升开发效率的同时收获较好的性能。Kernel Primitive API 主要包括 IO API、Compute API 以及 OpFunc,IO API 能够高效的完成全局内存与寄存器间的数据读写操作。Compute API 为通用计算函数,如ElementwiseBinary、ElementwiseUnary 等;OpFunc 用于定义 Compute API 中的计算规则,例如实现 Add 操作则需要定义 AddFunctor 用于 ElementwiseBinary 调用,开发者可以直接使用默认的 OpFunc 也可以根据需要进行自定义,具体的实现规则将在 OpFunc 小节中进行详细介绍。当前 API 均是 Block 级别的多线程 API,开发者可以直接传入当前 Block 的数据指针以及操作类型完成相应的计算,目前仅支持全局数据指针和寄存器指针。
68

79
API 列表
810
############

docs/guides/07_new_op/kernel_primitive_api/index_en.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Kernel Primitive API
33
#####################
44

5+
The Kernel Primitive API abstracts and encapsulates the underlying code in the implementation of operator kernel functions, providing high-performance block-level IO operation and computation operation. Using the Kernel Primitive API for Kernel development can focus more on the implementation of computing logic, greatly reduce the amount of code while ensuring performance, and realize the decoupling of operator computing and hardware.
6+
57
This part provides PaddlePaddle senior developers with CUDA Kernel Primitive API for Kernel development. This type of API can help developers gain better performance while improving development efficiency. Kernel Primitive API mainly includes IO API, Compute API and OpFunc. IO API can efficiently complete data reading and writing operations between global memory and registers; Compute API is a general calculation function, such as ElementwiseBinary, ElementwiseUnary, etc.; OpFunc is used to define Compute API. For example, to implement the Add operation, you need to define AddFunctor for ElementwiseBinary calls. Developers can directly use the default OpFunc or customize them as needed. The specific implementation rules will be described in detail in the OpFunc section. The current APIs are all block-level multi-threaded APIs. Developers can directly pass in the data pointer and operation type of the current block to complete the corresponding calculations. Currently, only global data pointers and register pointers are supported.
68

79

0 commit comments

Comments
 (0)