-
Notifications
You must be signed in to change notification settings - Fork 603
Introducing NXP Neutron runtime #10563
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
base: main
Are you sure you want to change the base?
Introducing NXP Neutron runtime #10563
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10563
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit 8a79f2d with merge base 91c9ffa ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@pytorchbot label "module: nxp" "release notes: nxp" |
@digantdesai are you the POC for reviewing this on our 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.
Is this still in progress?
At a high level looks OK to me.
/// - Initialize the Neutron Driver library, setting initial values, do memory | ||
/// allocation | ||
/// for internal data structures, do memory mapping. | ||
NeutronError neutronInit(); |
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 these functions be in a neutron
namespace?
Where are we calling this specific function to init the lib?
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.
It is called in surrounding rtos code, much like ethosu_init
|
||
// Applied on outputs. | ||
template <typename T> | ||
void transposeToChannelFirst( |
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.
OK for now, but I wonder is there another way to do this, i.e. set the dim_order on the output and let the portable or someone else take care of this?
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.
From what @jirioc explained below, I think this could be removed by inserting a transpose node instead of setting a flag
|
||
// Applied on inputs. | ||
template <typename T> | ||
void transposeToChannelLast( |
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 here.
|
||
auto* cfg = allocator->allocateInstance<NeutronConfig>(); | ||
|
||
// The following data is read from the "processed" data blob. |
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.
Nit: make this a helper function?
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, still outstanding seems to be:
- namespace for neutron backend
- consider removing NeutronDriver/NeutronErrors.h from ET repo and pull in to link separately like ARM does
/// - Initialize the Neutron Driver library, setting initial values, do memory | ||
/// allocation | ||
/// for internal data structures, do memory mapping. | ||
NeutronError neutronInit(); |
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.
It is called in surrounding rtos code, much like ethosu_init
|
||
// Applied on outputs. | ||
template <typename T> | ||
void transposeToChannelFirst( |
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.
From what @jirioc explained below, I think this could be removed by inserting a transpose node instead of setting a flag
Any update on this? |
Thanks for advice, will do
So far we don't have the NeutronDriver/NeutronErrors.h. It is part of the ExecuTorch example in the MCUXpresso SDK but I can imagine to have it distributed alongside with the Neutron Converter, Neutron Functional Simulator or as a separated part of the SDK. Let us check internally and update as we discuss it internally. |
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.
I guess transpose is the only fix pending? I am ok with checking in header file for now.
The namespace has been added. |
FWIW, it is how ARM does it currently as well. executorch/backends/arm/runtime/EthosUBackend.cpp If there are well supported tests for the runtime, this might be a good candidate for a task for new contributors interested in ET. |
Compared to Arm's approach we carry the transposition information with us in the Neutron Payload's header, as we get this by running the "tensor format inference" instead of Dim Orders. |
Not sure I fully understand the need for transposing input/output tensors in the delegate runtime unless you want to be flexible to in terms of supporting both dim_orders, but ET doesn't support that i.e. it specializes on the dim_order at PTE generation time. So you can also use the portable op for transposing through a pass instead of this. But this might also work. Also can we add at least a build test with armv8-m toolchain? |
Let's re-merge the CI PR, this PR depends on that (touches trunk.yaml), then we can merge this. Thanks. |
9534c72
to
8a79f2d
Compare
Summary
Introducing NXP Neutron runtime.
cc @digantdesai @JakeStevens @robert-kalmar