Skip to content

Conversation

@Liu-xiandong
Copy link
Member

@Liu-xiandong Liu-xiandong commented Nov 16, 2021

PR types

New features

PR changes

Others

Describe

This PR adds the source code compilation mode of XPU2, and the compilation commands are as follows:

cmake .. -DPY_VERSION=3.7 -DWITH_XPU_KP=ON -DWITH_GPU=OFF -DWITH_TESTING=ON -DCMAKE_BUILD_TYPE=Release 

Its realization mainly involves the following aspects:

1. Support source code compilation mode of XPU2 code:

Mainly related to the modification of cmake, the main files involved are: cmake/generic.cmake cmake/operators.cmake cmake/xpu_kp.cmake
The specific calling process is as follows:
image

2. Compatible operator mapping mode and source code compilation mode

After adding the source code compilation mode, there are two XPU kernels for the same OP.
In order to be compatible with the two modes, three aspects of work have been done.

  • Added a new library_type to distinguish the original mode.
    The main files involved are: paddle/fluid/framework/library_type.h

  • In order to dynamically select the kernel at runtime, the flag and the list involved in the KP mode are added.
    The main files involved are: paddle/fluid/platform/flags.cc paddle/fluid/platform/device/xpu/xpu_op_kpfirst_list.h paddle/fluid/platform/device/xpu/xpu_op_list.cc

  • Increase specific runtime control methods
    The main files involved are:
    paddle/fluid/framework/operator.cc (static graph)
    paddle/fluid/imperative/prepared_operator.cc (dynamic graph)

The control graph of runtime is as follows:
image

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot-old
Copy link

paddle-bot-old bot commented Dec 4, 2021

Sorry to inform you that d473766's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@paddle-bot-old
Copy link

Sorry to inform you that bdaa02c's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

xingfeng01
xingfeng01 previously approved these changes Jan 28, 2022
lanxianghit
lanxianghit previously approved these changes Jan 28, 2022
@Liu-xiandong Liu-xiandong dismissed stale reviews from lanxianghit and xingfeng01 via b55d391 January 28, 2022 06:46
Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for operator.h

@xingfeng01 xingfeng01 merged commit 92da505 into PaddlePaddle:develop Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants