-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Disco] Propagate structlog configuration to disco workers #16618
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
[Disco] Propagate structlog configuration to disco workers #16618
Conversation
| ) | ||
|
|
||
| from . import executor | ||
| from . import disco |
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.
Not sure if it's safe when runtime is not compiled with disco.
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.
Hmm, good point. The tvm._ffi.register_object("runtime.disco.*") calls would raise an error if disco isn't available.
This was primarily to ensure that all packaged funcs generated by tvm.runtime.disco were available within the disco sub-process. I'll try a build without disco enabled, and see what is required to make sure that the module import works either way.
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.
Looks like disco is enabled by default, and is always included in libtvm_runtime.so (CMakeLists.txt link. As a result, it should always be safe to import tvm.runtime.disco.
If we later add a cmake flag to disable disco, we should be able to gate this import behind a check on tvm.support.libinfo()[cmake_flag].
Prior to this commit, while `structlog.configure(...)` would only impact log statements generated in the main process. Any workers started with `disco.session.ProcessSession` do not inherit the `structlog` configuration. While `disco.session.ThreadedSession` would inherit the `structlog` configuration, it would also inherit process-specific CUDA variables. This commit updates `disco.session.ProcessSession` to explicitly propagate any `structlog` configuration to child processes. This implementation intentionally avoids introducing a new dependency for TVM. If the `structlog` package is not available, the config propagation is skipped.
fc2f93a to
208d444
Compare
Required for compatibility with TVM PR apache/tvm#16618. Can be removed after upstream `structlog` hynek/structlog#603 lands. This is a backport of the OLLM PR https://github.com/octoml/ollm/pull/409, and is not needed after the MLC-serve migration.
Required for compatibility with TVM PR apache/tvm#16618. Can be removed after upstream `structlog` hynek/structlog#603 lands. This is a backport of the OLLM PR https://github.com/octoml/ollm/pull/409, and is not needed after the MLC-serve migration.
This is a follow-up to apache#16618, which propagates the `structlog` configuration to disco worker processes. For configurations that use `structlog.stdlib` to integrate `structlog` with the stdlib `logging` module, this integration must also be forwarded.
This is a follow-up to #16618, which propagates the `structlog` configuration to disco worker processes. For configurations that use `structlog.stdlib` to integrate `structlog` with the stdlib `logging` module, this integration must also be forwarded.
) Prior to this commit, while `structlog.configure(...)` would only impact log statements generated in the main process. Any workers started with `disco.session.ProcessSession` do not inherit the `structlog` configuration. While `disco.session.ThreadedSession` would inherit the `structlog` configuration, it would also inherit process-specific CUDA variables. This commit updates `disco.session.ProcessSession` to explicitly propagate any `structlog` configuration to child processes. This implementation intentionally avoids introducing a new dependency for TVM. If the `structlog` package is not available, the config propagation is skipped.
This is a follow-up to apache#16618, which propagates the `structlog` configuration to disco worker processes. For configurations that use `structlog.stdlib` to integrate `structlog` with the stdlib `logging` module, this integration must also be forwarded.
Prior to this commit,
structlog.configure(...)would only impact log statements generated in the main process, while workers started withdisco.session.ProcessSessionwould not inherit thestructlogconfiguration. Whiledisco.session.ThreadedSessionwould inherit thestructlogconfiguration, it would also inherit process-specific CUDA variables.This commit updates
disco.session.ProcessSessionto explicitly propagate anystructlogconfiguration to child processes. This implementation intentionally avoids introducing a new dependency for TVM. If thestructlogpackage is not available, the config propagation is skipped.