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

[geometric]Add paddle.geometric.send_ue_recv API #43174

Merged
merged 58 commits into from
Aug 12, 2022

Conversation

DesmonDay
Copy link
Contributor

@DesmonDay DesmonDay commented Jun 2, 2022

PR types

New features

PR changes

APIs

Describe

Add paddle.geometric.send_ue_recv API, mainly used in graph learning domain.

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jun 2, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@DesmonDay DesmonDay marked this pull request as draft June 2, 2022 07:40
@paddle-bot-old
Copy link

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

python/paddle/geometric/message_passing/send_ue_recv.py Outdated Show resolved Hide resolved
src_index (Tensor): An 1-D tensor, and the available data type is int32, int64.
dst_index (Tensor): An 1-D tensor, and should have the same shape as `src_index`.
The available data type is int32, int64.
compute_type (str): Different compute types for x and e, including `add`, `sub`, `mul`, `div`.
Copy link
Contributor

Choose a reason for hiding this comment

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

compute_type、pool_type 的名字有参考其他开源repo相关API的名字吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

目前只有dgl 有相关 API,但起对应名字更加模糊,包括比如 op 对应 compute_type, reduce_op 对应 pool_type。感觉不具备参考意义。

python/paddle/geometric/message_passing/send_ue_recv.py Outdated Show resolved Hide resolved
python/paddle/geometric/message_passing/send_ue_recv.py Outdated Show resolved Hide resolved

x_shape = paddle.shape(x)
y_shape = paddle.shape(y)
if len(x.shape) != len(y.shape):
Copy link
Contributor

Choose a reason for hiding this comment

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

这块的动转静要验证一下

Copy link
Contributor Author

Choose a reason for hiding this comment

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

测试了,可以正常导出静态图模型。

python/paddle/geometric/message_passing/send_ue_recv.py Outdated Show resolved Hide resolved
paddle/fluid/operators/graph_send_ue_recv_op.cc Outdated Show resolved Hide resolved
AddOutput("Dst_count",
"Count tensor of Dst_index, mainly for MEAN pool_type.")
.AsIntermediate();
AddAttr<std::string>("compute_type",
Copy link
Contributor

Choose a reason for hiding this comment

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

这块的type再确认一下

paddle/fluid/platform/device/gpu/gpu_primitives.h Outdated Show resolved Hide resolved
0,
phi::errors::PreconditionNotMet(
"Required dim >= 0, but received dim = %d", dim));
if (dim == 0) return 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Thread num 应该是warp的倍数,即32的倍数,这里取1不太合适,以及后续也有可能取到32以下的thread

}

int64_t out_len = bcast_info.out_len;
const int ntx = FindNumThreads(out_len); // 一个block包含的Thread数
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的cuda的thread最大是1024,建议还是通过函数获取设备能支持的max thread num

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改为通过函数设备获取。


int64_t out_len = bcast_info.out_len;
const int ntx = FindNumThreads(out_len);
const int nty = CUDA_MAX_NUM_THREADS / ntx;
Copy link
Contributor

Choose a reason for hiding this comment

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

同上,CUDA_MAX_NUM_THREADS 变量控制

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@DesmonDay DesmonDay changed the title Add paddle.geometric.send_ue_recv API [geometric]Add paddle.geometric.send_ue_recv API Aug 8, 2022
wawltor
wawltor previously approved these changes Aug 11, 2022
Copy link
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

@ZeyuChen ZeyuChen merged commit 615b15a into PaddlePaddle:develop Aug 12, 2022
DesmonDay added a commit to DesmonDay/Paddle that referenced this pull request Oct 13, 2022
* add init file

* add op definition and infermeta

* add kernel definition funcs

* add broadcast infer shape

* add gpu forward kernel

* delete SUB and DIV

* add x_grad

* add template

* add e_grad for min and max

* fix small bug

* temp commit

* temp commit

* add e_grad for sum and mean

* fix some compile bug

* fix compile bugs

* fix compile problem

* add sum forward unittest

* fix broadcast error, add kernel sig, register e_grad, change unit test

* fix grad

* add temp grad fix

* temp commit

* add min max unittest

* add max, min unittest, fix mul bug

* add cpu forward sum and mean

* add forward min max, fix mean unittest

* add cpu backward min max

* fix code-style

* add backward sum mean

* fix rocm ci

* set uniitest timeout

* fix bug of x broadcast to e, gpu grad

* fix bug of x broadcast to e, cpu grad

* rename BOOST_GET_CONST macro

* fix rocm ci

* mv graph_send_e_recv to graph_send_ue_recv

* move out_size to IntArray

* add eager op test

* fix max pool type bug, add unittest for api

* revise api doc

* add fp16 for atomic min and max, add unittest

* add unittest

* add fp16 support for graph_send_recv

* fix unittest fp16 bug

* change OutSizeTensor to Out_size

* move E to Y

* add copyright, fix comment

* review code

* fix thread block size

* fix thread block size

* change api attribute name: pool_type to reduce_op, compute_type to message_op

* change api attribute name, move pool_type to reduce_op, move compute_type to message_op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants