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

[Bug] PassContext should be inherited in tuning #11656

Closed
AndrewZhaoLuo opened this issue Jun 9, 2022 · 2 comments
Closed

[Bug] PassContext should be inherited in tuning #11656

AndrewZhaoLuo opened this issue Jun 9, 2022 · 2 comments
Labels
tune:auto_scheduler src/auto_scheduler, python/tvm/auto_scheduler type: bug

Comments

@AndrewZhaoLuo
Copy link
Contributor

Perhaps this is best described as feature request, regardless it is a little bit unintuitive.

For both autoscheduler and autotvm, POpenPool is used extensively in building and measuring. Unfortunately, these spawn new processes so some state is lost in translation.

Of particular note are PassContexts which can control how things are lowered and have instrumentation to grab useful information along the lowering process. This also makes it impossible to change the pass settings for tuning easily I believe.

Expected behavior

PassContext's should be respected for tuning. As we deal with processes, PassContexts and all their children need to be serialized. Documentation should also be improved to specify the behavior in these cases.

PassInstrumentation might be a little difficult to handle all use cases as these can be used to pass and modify state which might be difficult across process boundaries in an intuitive way.

Actual behavior

PassContext's configuration information is ignored for tuning.

Environment

This is a problem with TVM itself, the below script should do things.

Steps to reproduce

In this script we have simple pass instrumentation which prints out a bunch of '*' after a pass is called. During tuning nothing is printed because the instrument is ignored, during building the final module however it is applied.

@areusch areusch added the needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it label Oct 19, 2022
@hpanda-naut hpanda-naut added tune:auto_scheduler src/auto_scheduler, python/tvm/auto_scheduler and removed needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Nov 15, 2022
@PhilippvK
Copy link
Contributor

@AndrewZhaoLuo Thank you for raising that issue. I recently ran into the described problem that POpenPools do not properly propagate Pass contexts to the build functions running in the subprocesses.

While I am am aware of #11632, it does not seem to solve the issue when using the LocalRunner for AutoTVM and AutoScheduler. Is there any workaround that I am not aware of?

For AutoTVM I was able to just just pass the current pass context as an argument (see proof of concept: f82ad67), but I would imagine that this did only work because AutoTVM is solely based on Python. For AutoSchedule which heavily relies on C++ we would probably need to implement the serialization of the PassContext as described above.

@AndrewZhaoLuo
Copy link
Contributor Author

@PhilippvK . It has been a while since I've dealt with autotvm / autoschedule but if there is an issue, i would encourage you to make a contribution. Not sure what the POpenPool issue is exactly but perhaps it is just a matter of properly piping things through system. If you give a short script with behavior different from you'd expect i would be glad to take a quick look.

For autoschedule being c++, the nice thing is the TVM object system does allow for easy interaction between python via some decorators (and also vice versa).

@tqchen tqchen closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tune:auto_scheduler src/auto_scheduler, python/tvm/auto_scheduler type: bug
Projects
None yet
Development

No branches or pull requests

5 participants