-
Notifications
You must be signed in to change notification settings - Fork 6k
[API Compatibility] Implement paddle.addcmul API -part #77333
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
Open
Manfredss
wants to merge
35
commits into
PaddlePaddle:develop
Choose a base branch
from
Manfredss:ApiEnhance354
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
ace4713
Add addcmul operator for PaddlePaddle - Implement forward/backward ke…
Manfredss b7f40a1
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss 285af67
cpp sink for addcmul
Manfredss ca45edd
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss 8e8d4e4
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss 45b967f
fix for linux
Manfredss 8773dc9
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss a20a003
add converage for addcmul
Manfredss 6919d31
del commented code and refine tests for addcmul
Manfredss b82d790
fix test
Manfredss 5736202
fix
Manfredss 6f3b32c
fix
Manfredss a582a5a
improve
Manfredss 7e24908
coverage test
Manfredss a3ebc16
remove comment in ops.yaml and adjust testing code
Manfredss 5ddba29
align with torch
Manfredss a1dcd98
Revert "align with torch"
Manfredss 49bb3f2
signature align with torch and add unit test
Manfredss ed74700
use meaningful name and optimise mem alloc
Manfredss 4a1f343
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss fbaeb1b
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss fdf3c92
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss 7ea3681
improve coverage
Manfredss 4137182
skip test on XPU
Manfredss 56d800b
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss eb8b50a
skip XPU
Manfredss 8144956
fix
Manfredss 55f8f54
fix
Manfredss d530867
fix
Manfredss 6c67637
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss 954ceec
fix
Manfredss b331c0d
fix
Manfredss 5ce27ed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
Manfredss d82eb97
align api
Manfredss a733490
fix tests
Manfredss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "paddle/phi/common/scalar.h" | ||
| #include "paddle/phi/core/dense_tensor.h" | ||
|
|
||
| namespace phi { | ||
|
|
||
| template <typename T, typename Context> | ||
| void AddcmulGradKernel(const Context& dev_ctx, | ||
| const DenseTensor& input, | ||
| const DenseTensor& tensor1, | ||
| const DenseTensor& tensor2, | ||
| const DenseTensor& out_grad, | ||
| const Scalar& value, | ||
| DenseTensor* input_grad, | ||
| DenseTensor* tensor1_grad, | ||
| DenseTensor* tensor2_grad); | ||
|
|
||
| } // namespace phi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "paddle/phi/common/scalar.h" | ||
| #include "paddle/phi/core/dense_tensor.h" | ||
|
|
||
| namespace phi { | ||
|
|
||
| template <typename T, typename Context> | ||
| void AddcmulKernel(const Context& dev_ctx, | ||
| const DenseTensor& input, | ||
| const DenseTensor& tensor1, | ||
| const DenseTensor& tensor2, | ||
| const Scalar& value, | ||
| DenseTensor* out); | ||
|
|
||
| } // namespace phi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include "paddle/phi/kernels/addcmul_grad_kernel.h" | ||
|
|
||
| #include "paddle/phi/backends/cpu/cpu_context.h" | ||
| #include "paddle/phi/core/kernel_registry.h" | ||
| #include "paddle/phi/kernels/impl/addcmul_grad_kernel_impl.h" | ||
|
|
||
| PD_REGISTER_KERNEL( | ||
| addcmul_grad, CPU, ALL_LAYOUT, phi::AddcmulGradKernel, float, double) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include "paddle/phi/kernels/addcmul_kernel.h" | ||
|
|
||
| #include "paddle/phi/backends/cpu/cpu_context.h" | ||
| #include "paddle/phi/core/kernel_registry.h" | ||
| #include "paddle/phi/kernels/impl/addcmul_kernel_impl.h" | ||
|
|
||
| PD_REGISTER_KERNEL( | ||
| addcmul, CPU, ALL_LAYOUT, phi::AddcmulKernel, float, double, int, int64_t) { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include "paddle/phi/kernels/addcmul_grad_kernel.h" | ||
|
|
||
| #include "paddle/phi/backends/gpu/gpu_context.h" | ||
| #include "paddle/phi/core/kernel_registry.h" | ||
| #include "paddle/phi/kernels/impl/addcmul_grad_kernel_impl.h" | ||
|
|
||
| PD_REGISTER_KERNEL(addcmul_grad, | ||
| GPU, | ||
| ALL_LAYOUT, | ||
| phi::AddcmulGradKernel, | ||
| float, | ||
| double, | ||
| phi::dtype::float16, | ||
| phi::dtype::bfloat16) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include "paddle/phi/kernels/addcmul_kernel.h" | ||
|
|
||
| #include "paddle/phi/backends/gpu/gpu_context.h" | ||
| #include "paddle/phi/core/kernel_registry.h" | ||
| #include "paddle/phi/kernels/impl/addcmul_kernel_impl.h" | ||
|
|
||
| PD_REGISTER_KERNEL(addcmul, | ||
| GPU, | ||
| ALL_LAYOUT, | ||
| phi::AddcmulKernel, | ||
| float, | ||
| double, | ||
| phi::dtype::float16, | ||
| phi::dtype::bfloat16, | ||
| int, | ||
| int64_t) {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个逻辑在单测里测试到了没,这个需要开CINN才能测到:check_cinn=True