-
Notifications
You must be signed in to change notification settings - Fork 722
Milestone 1: Added Fusion G3 NN library with kernels related to add, mul, quantize… #6738
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
Conversation
…, dequantize, cat, layer norm, softmax to backends/cadence folder. Added operators to backends/cadence folder
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6738
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 92b58ef with merge base 43555d2 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @ckmadhira! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Fusion G3 NN library is added with kernels related to add, mul, quantize, dequantize, cat, layernorm and softmax. Operators which use these kernels are also added to backends/cadence folder |
zonglinpeng
left a comment
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.
Thanks for the change! Had one comment on the op namespace
|
|
||
| namespace impl { | ||
| namespace FusionG3 { | ||
| namespace native { |
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.
Can the name spaces of all the G3 ops build as
namespace cadence {
namespace impl {
namespace G3 {
namespace native {
To align with other ops? HiFi example: https://github.com/pytorch/executorch/blob/main/backends/cadence/hifi/operators/op_add.cpp#L25
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.
Updated as per review comment
| - op: _softmax.out | ||
| kernels: | ||
| - arg_meta: null | ||
| kernel_name: impl::FusionG3::softmax_out |
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.
Same comment on the namespace
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.
Per @hsharma35 's comment above, please use cadence::impl::G3::native::<OP_NAME> namespace
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.
Updated the operator name as cadence::impl::G3::<OP_NAME>. native is not explicitly mentioned. As per kernel-library-custom-aten-kernel.md, native is automatically appended to the operators.
| @@ -0,0 +1,119 @@ | |||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |||
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.
Please change the kernel_name here to match cadence::impl::G3::native::OP_NAME. For example: cadence::impl::G3::native::add_out
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.
Updated the operator name as cadence::impl::G3::add_out. native is not explicitly mentioned.
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.
With the change to operator namespace, I think this would now fail to compile. Can you please check on your end?
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.
We are able to compile and verify the operator with toy model. Are you having any issue with this name space?
|
Nit: Can we rename the folder FuG3 to FusionG3 instead? |
|
@zonglinpeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
please make nnlib a standalone repository @ckmadhira |
zonglinpeng
left a comment
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.
comment as above
The decision is not to make the Fusion G3 NN library opensource. We are looking for a space where we can put the repo and provide exclusive access to Meta |
|
@ckmadhira thanks for driving nnlib to a public repo! Can you remake this PR with just the kernel updates (i.e. everything except thirdparty nnlib) so that I can import as a clean change? Thank you |
Updated Fusion G3 NN library as a submodule from opensource. |
hsharma35
left a comment
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.
LGTM, just needs one change:
Please make the operators in op_*.cpp consistent with the operators in functions_fusion_g3.yaml.
Thanks!
| - op: add.out | ||
| kernels: | ||
| - arg_meta: null | ||
| kernel_name: cadence::impl::G3::add_out |
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.
@ckmadhira the name used here (kernel_name: cadence::impl::G3::add_out) does not match the actual kernel in op_add.cpp (cadence::impl::G3::native::add_out). Is this compiling on your end?
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.
This got compiled for us and we are able to test it. We should not add "native" in the functions_fusion_g3.yaml file. The word "native" implicitly gets appended. If we try to add "native", we get build errors saying, native is added twice.
| @@ -0,0 +1,119 @@ | |||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |||
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.
With the change to operator namespace, I think this would now fail to compile. Can you please check on your end?
|
Please resolve the merge conflict in .gitmodules, and update the PR summary |
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.
Nice this is awesome!
|
@zonglinpeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This is done |
|
@ckmadhira there are a lot of linter errors, see https://github.com/pytorch/executorch/actions/runs/11950614633/job/33350989488?pr=6738. @zonglinpeng can you share instructions on how to run the linter? |
https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#lintrunner @ckmadhira |
|
@zonglinpeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Signed-off-by: [email protected] <[email protected]>
zonglinpeng
left a comment
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.
there are still some lint errors, please try lintrunner -a
https://github.com/pytorch/executorch/actions/runs/12009466002/job/33489114504?pr=6738
Ok to merge, we can likely fix issues on our end
|
@zonglinpeng has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| - op: native_layer_norm.out | ||
| kernels: | ||
| - arg_meta: null | ||
| kernel_name: cadence::impl::G3::native_layer_norm_out No newline at end of file |
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.
missing quant dequant per tensor func definition. fixed in #7061
| - op: _softmax.out | ||
| kernels: | ||
| - arg_meta: null | ||
| kernel_name: cadence::impl::G3::softmax_out |
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.
need to be _softmax to be consistent, fixed in #7061
| namespace G3 { | ||
| namespace native { | ||
|
|
||
| Tensor& softmax_out( |
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.
same comment, _softmax, fixed in #7061
| */ | ||
| namespace cadence { | ||
| namespace impl { | ||
| namespace FusionG3 { |
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.
namespace needs to be G3. fixed in #7061
|
|
||
|
|
||
| /* Local function which calls the kernels based on the input datatype */ | ||
| void Dequantize_impl(Tensor& out, |
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.
please use all lower case fixed in #7061
…, dequantize, cat, layer norm, softmax to backends/cadence folder. Added operators to backends/cadence folder
Summary
Added kernels and operators related to
to Fusion G3. The Kernels part of Fusion G3 NN library which is a submodule.