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

[Disco] Propagate structlog configuration to disco workers #16618

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, structlog.configure(...) would only impact log statements generated in the main process, while workers started with disco.session.ProcessSession would 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.

@@ -40,3 +40,4 @@
)

from . import executor
from . import disco
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.
@Lunderberg Lunderberg force-pushed the disco_propagate_structlog_configuration_to_workers branch from fc2f93a to 208d444 Compare March 11, 2024 17:39
Lunderberg added a commit to octoml/mlc-llm that referenced this pull request Mar 11, 2024
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
octoml/ollm#409, and is not needed after the
MLC-serve migration.
masahi pushed a commit to octoml/mlc-llm that referenced this pull request Mar 11, 2024
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
octoml/ollm#409, and is not needed after the
MLC-serve migration.
@masahi masahi merged commit 1278c35 into apache:main Mar 12, 2024
19 checks passed
@Lunderberg Lunderberg deleted the disco_propagate_structlog_configuration_to_workers branch March 12, 2024 12:52
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Mar 13, 2024
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.
Lunderberg added a commit that referenced this pull request Mar 27, 2024
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.
thaisacs pushed a commit to thaisacs/tvm that referenced this pull request Apr 3, 2024
)

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.
thaisacs pushed a commit to thaisacs/tvm that referenced this pull request Apr 3, 2024
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.
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.

3 participants