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

[rpc] Implemented rpc logging #11232

Merged
merged 3 commits into from
May 12, 2022
Merged

[rpc] Implemented rpc logging #11232

merged 3 commits into from
May 12, 2022

Conversation

mkatanbaf
Copy link
Contributor

This adds logging to rpc communications, by adding a wrapper around "RPCChannel". The wrapper, "RPCChannelLogging", has a "NanoRPCListener" that only listens to ongoing communication and log them in a human readable way. "NanoRPCListener" uses a "MinRPCSniffer" to decode the rpc commands. "MinRPCSniffer" is based on "MinRPCServer" and shares the same code to decode the packets, but replaces the execution and return handling with no-operation functions. The log is disabled by default for backward compatibility, and a test case ("test_rpc_simple_wlog") is added to the "test_runtime_rpc.py" with logging enabled.

@mkatanbaf
Copy link
Contributor Author

mkatanbaf commented May 9, 2022

This PR fixes windows build issue with PR#10967
@areusch, @mehrdadh, @alanmacd

@mkatanbaf mkatanbaf marked this pull request as ready for review May 9, 2022 14:53
Copy link
Member

@mehrdadh mehrdadh left a comment

Choose a reason for hiding this comment

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

Before we merge this, let's test this changes on Hexagon. We use minRPC server on hexagon and would like to confirm it. Thanks!

@mkatanbaf
Copy link
Contributor Author

@mehrdadh, is there any specific Hexagon test I should run? the CI tests are passed.

@mehrdadh
Copy link
Member

mehrdadh commented May 9, 2022

@mkatanbaf Nothing on your end, I'm gonna test it locally and get back to you.

@mehrdadh
Copy link
Member

mehrdadh commented May 9, 2022

I tested hexagon_launcher and looks good.

@mkatanbaf mkatanbaf force-pushed the rpc_logger branch 2 times, most recently from a2e7a45 to 86f58a8 Compare May 10, 2022 16:56
@mkatanbaf mkatanbaf requested a review from mehrdadh May 12, 2022 16:46
Copy link
Member

@mehrdadh mehrdadh left a comment

Choose a reason for hiding this comment

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

I can't test it right now on Hexagon since we have issue with the CI. I tested it once before and I think the change is minimal.

@areusch
Copy link
Contributor

areusch commented May 12, 2022

@mkatanbaf i think this fix makes sense to me, but that we should propagate tvm_ssize_t to most of the other ssize_t mentions in the codebase. in particular, in src/support/socket.h we still have a competing definition using ssize_t = int; for Windows builds, and i think we should get rid of that in favor of this.

@mkatanbaf
Copy link
Contributor Author

@areusch I believe the conclusion was to propagate the tvm_ssize_t in a separate PR, to keep this one mergeable.

@areusch
Copy link
Contributor

areusch commented May 12, 2022

okay that's fine by me so long as that's our intent

@areusch areusch merged commit 53fe596 into apache:main May 12, 2022
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request May 16, 2022
* Implemented rpc logging

* fixing windows build issue

* trigger

Co-authored-by: Mohamad <[email protected]>
shtinsa pushed a commit to Deelvin/tvm that referenced this pull request May 17, 2022
* Implemented rpc logging

* fixing windows build issue

* trigger

Co-authored-by: Mohamad <[email protected]>
shingjan pushed a commit to shingjan/tvm that referenced this pull request May 17, 2022
* Implemented rpc logging

* fixing windows build issue

* trigger

Co-authored-by: Mohamad <[email protected]>
@@ -76,6 +76,18 @@ extern "C" {
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

@mkatanbaf @mehrdadh @areusch why is this header needed ?
Is it just because to use the type ssize_t ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also do we want this added to c_runtime_api ?
(As this is affecting bare metal deployments)

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I forgot about that. I believe this was needed on Windows to define tvm_ssize_t properly. @mkatanbaf could you confirm that? If so, perhaps we can place this #include behind #ifdef _MSC_VER

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@manupa-arm @areusch The <stdio.h> is needed to define ssize_t (not on windows, for windows we directly used int64_t and int32_t instead of ssize_t). The <sys/type.h> was needed on hexagon.
We discussed the proper place to add this definition and landed on the c_runtime_api. @manupa-arm please lmk if you have another suggestion.

Copy link
Contributor

@manupak manupak May 19, 2022

Choose a reason for hiding this comment

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

From a naive look at the PR, It seems it is being used in rpc related sources (that uses PosixWrite and already assumes the presense of the OS). How about somewhere that is specific to rpc ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@manupa-arm thanks. there was an issue with ssize_t being defined in other parts of the code which caused a redefinition error. our plan was to unify the different definitions in a subsequent PR soon. I'll check if I can find a better place for the definition in order to minimize the effect on bare metal deployments.

Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we can move this to e.g. tvm/support/types.h or something of that nature.

argrento added a commit to argrento/tvm that referenced this pull request May 20, 2022
argrento added a commit to argrento/tvm that referenced this pull request May 20, 2022
argrento added a commit to argrento/tvm that referenced this pull request May 20, 2022
masahi pushed a commit that referenced this pull request May 25, 2022
… modification to auto-build Android apps and upload artifacts (#11241)

* Update gradle version in android_rpc app

* Support latest gradle, bump versions, replace ndk build script with gradle tasks

* [android_rpc] Fix linter errors, disable weird ones

* [android_deploy] Support latest gradle, bump versions, fix linter errors, disable some of them

* [android_camera] Support latest gradle, bump versions, rewrite readme

* [android_camera] Fix linter errors

* Fix sanity check errors

* Add Android jobs for Github Actions

* Add python requirements for TVM and android_camera, use preinstalled NDK

* Revert to build with make

* Add minrpc include (PR #11232)

* Remove relative paths
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.

5 participants