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

Support npu kernel for tile op #34606

Merged
merged 5 commits into from
Aug 10, 2021
Merged

Conversation

rainyfly
Copy link
Contributor

@rainyfly rainyfly commented Aug 4, 2021

PR types

New features

PR changes

OPs

Describe

Support npu kernel for tile op
image
tileop

@paddle-bot-old
Copy link

paddle-bot-old bot commented Aug 4, 2021

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

@CLAassistant
Copy link

CLAassistant commented Aug 4, 2021

CLA assistant check
All committers have signed the CLA.

@nepeplwu
Copy link
Contributor

nepeplwu commented Aug 5, 2021

LGTM


namespace paddle {
namespace operators {
inline std::vector<int> get_repeat_times_npu(
Copy link
Contributor

Choose a reason for hiding this comment

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

这个函数不需要重写,修改一下tile_op.h的判断,改为就可以了
if (platform::is_gpu_place(repeat_tensor->place()) || platform::is_npu_place(repeat_tensor->place())) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

收到,我之前以为不能改已有的代码呢

self.check_output_with_place(self.place)

def test_check_grad(self):
self.check_grad(['X'], 'Out')
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

self.check_output_with_place(self.place)

def test_check_grad(self):
self.check_grad(['X'], 'Out')
Copy link
Contributor

Choose a reason for hiding this comment

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

没有实现tile_grad的话,把这个函数改成 pass就好了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改

self.check_output_with_place(self.place)

def test_check_grad(self):
self.check_grad(['X'], 'Out')
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

# Test python API
class TestTileAPI(unittest.TestCase):
def test_api(self):
with fluid.dygraph.guard():
Copy link
Contributor

Choose a reason for hiding this comment

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

可以改成 fluid.dygraph.guard(paddle.NPUPlace(0)): 后面 to_tensor就不需要加NPUPlace了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

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

LGTM

"must be less than or equal to %d, but the value received is %d.",
MAX_RANK_SUPPORTED, repeat_times_size));
rank = std::max(rank, repeat_times_size);
switch (rank) { REP_TILE_TEMPLATE(MAX_RANK_SUPPORTED) }
Copy link
Contributor

Choose a reason for hiding this comment

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

这个在NPU下有编译错误,需要根据最新develop分支的代码修改一下

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

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

LGTM

@qili93 qili93 merged commit 8a6aa59 into PaddlePaddle:develop Aug 10, 2021
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.

4 participants