-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Hexagon] Initial support for meta schedule tuning #12587
Conversation
just a quick typo fix: it's meta schedule not meta scheduler :-) meta schedule is a "meta" schedule that generate basic schedules |
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.
🎉
@pytest.mark.skip(reason="xgboost not installed on CI") | ||
@tvm.testing.requires_hexagon | ||
def test_vrmpy_dense(hexagon_launcher): | ||
if hexagon_launcher._serial_number == "simulator": |
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 would be really great for this to be tested pre-commit on the simulator so future changes don't regress on the ability to tune. @kparzysz-quic do you think we could remove the use of a local x86 rpc server for targeting the hexagon simulator? Goal would be to make HexagonLauncherSimulator pickleable.
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'm not sure I understand the goal. What exactly do you want to make pickleable? Where would it be unpickled?
Right now the simulator fits in the general RPC infrastructure, with the RPC tracker and all. I guess it would be possible to change this, but I'm concerned that it would make Hexagon a "special case", plus I'm really not sure what we gain by doing 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.
The issue is that meta schedule RPCRunner uses PopenPoolExuecutor
which requires everything that's passed to it be pickle-able:
tvm/python/tvm/contrib/hexagon/meta_schedule.py
Lines 88 to 96 in 9331d9e
future=self.pool.submit( | |
_worker_func, | |
self.hexagon_launcher, | |
self.evaluator_config, | |
self.alloc_repeat, | |
str(runner_input.artifact_path), | |
tuple(arg_info.as_json() for arg_info in runner_input.args_info), | |
), | |
timeout_sec=100, |
If we try to pass HexagonLauncherSimulator
, we get this error https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/PR-12587/3/pipeline/ , Pickling an AuthenticationString object is disallowed for security reasons
. Apparently this is coming from trying to pickle
tvm/python/tvm/contrib/hexagon/build.py
Line 614 in c97895e
self._server_process = mp.Process(target=lambda *a: _start(self, *a)) |
The question is, can we remove _server_process
from HexagonLauncherSimulator
?
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 @masahi @kparzysz-quic - By the way also, not using a local RPC server is not making Hexagon a special case. For example, the CUDA target can be used locally without an x86 RPC server if it is attached to the machine being compiled. For the simulator there may be a similar solution, though it would end up testing a different codepath than runs with HW, so it is worth considering carefully.
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, that makes sense. Could we keep the current setup with the x86 server, and add another way to execute the simulator? I think there is value in being able to test the HW code path via simulator (and tests wouldn't need to be changed---right now they are set up to only depend on the device serial to decide whether they should run on HW or sim).
The new image has xgboost installed, which I need for #12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline
The new image has xgboost installed, which I need for apache#12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline
The new image has xgboost installed, which I need for apache#12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline
The new image has xgboost installed, which I need for apache#12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline
[CI] Update Hexagon image to install boost (#12613) The new image has xgboost installed, which I need for #12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline Co-authored-by: masahi <masahi129@gmail.com>
Enables AutoTVM-style, template-based tuning for Hexagon. To run compiled code on Hexagon, we need to use Hexagon `Session` object https://github.com/apache/tvm/blob/dc522a6ff65b68532cd1bba43827cd981114df2c/python/tvm/contrib/hexagon/session.py#L35 in the metaschedule `RPCRunner`. But for RPC "session", `RPCRunner` expects an instance of `RPCSession`, https://github.com/apache/tvm/blob/53fe5966823eee4e011d7228bceab3c82c1d9caa/python/tvm/rpc/client.py#L32, to be created and used by various customizable functions. Since `RPCSession` and Hexagon `Session` have slightly different API, we cannot use `RPCRunner` with customizable functions directly. So I introduced an alternative implementation of `RPCRunner` for Hexagon. The test is disabled for simulator since `HexagonLauncherSimulator` is not pickle-able due to its `multiprocessing.Process` attribute: https://github.com/apache/tvm/blob/c97895e0ffb512e73c89de7cdee9846f052244fc/python/tvm/contrib/hexagon/build.py#L614 Output log from tuning `vrmpy` dense (included in the test) ``` ID | Name | FLOP | Weight | Speed (GFLOPS) | Latency (us) | Weighted Latency (us) | Trials | Terminated -------------------------------------------------------------------------------------------------------------- 0 | main | 150994944 | 1 | 380.3399 | 397.0000 | 397.0000 | 32 | -------------------------------------------------------------------------------------------------------------- ```
The new image has xgboost installed, which I need for apache#12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline
[CI] Update Hexagon image to install boost (apache#12613) The new image has xgboost installed, which I need for apache#12587 Validated in https://ci.tlcpack.ai/blue/organizations/jenkins/tvm/detail/ci-docker-staging/279/pipeline Co-authored-by: masahi <masahi129@gmail.com>
Enables AutoTVM-style, template-based tuning for Hexagon.
To run compiled code on Hexagon, we need to use Hexagon
Session
objecttvm/python/tvm/contrib/hexagon/session.py
Line 35 in dc522a6
RPCRunner
. But for RPC "session",RPCRunner
expects an instance ofRPCSession
,tvm/python/tvm/rpc/client.py
Line 32 in 53fe596
Since
RPCSession
and HexagonSession
have slightly different API, we cannot useRPCRunner
with customizable functions directly. So I introduced an alternative implementation ofRPCRunner
for Hexagon.The test is disabled for simulator since
HexagonLauncherSimulator
is not pickle-able due to itsmultiprocessing.Process
attribute:tvm/python/tvm/contrib/hexagon/build.py
Line 614 in c97895e
Output log from tuning
vrmpy
dense (included in the test)cc @mehrdadh @csullivan @kparzysz-quic @junrushao @zxybazh