mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fixes https://github.com/pytorch/torchtitan/issues/1185 It looks like inductor's logic to include inductor configs in the cache key skips configs with a leading underscore by default. This came up in torchtitan - there's an asyncTP pipelining pass in inductor gated by a private config, and by not caching on the config we were attempting to use asyncTP when we shouldn't be. I'm not sure how worried we should be on the blast radius of this change. On the one hand: (1) it technically fixes any silent correctness issues in the cache around any other private inductor configs (it looks like there are a few) (2) there is some risk that there are some "harmless" configs that we are now including in the key, which may increase false negatives. I do see that there is an explicit list for "configs we want to ignore for caching" (`_save_config_ignore`), so my hope is that all harmless configs are already encapsulated there. Pull Request resolved: https://github.com/pytorch/pytorch/pull/153672 Approved by: https://github.com/oulgen
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
# mypy: allow-untyped-defs
|
|
from typing import Any, TYPE_CHECKING
|
|
|
|
"""
|
|
This was semi-automatically generated by running
|
|
|
|
stubgen torch.utils._config_module.py
|
|
|
|
And then manually extracting the methods of ConfigModule and converting them into top-level functions.
|
|
|
|
This file should be imported into any file that uses install_config_module like so:
|
|
|
|
if TYPE_CHECKING:
|
|
from torch.utils._config_typing import * # noqa: F401, F403
|
|
|
|
from torch.utils._config_module import install_config_module
|
|
|
|
# adds patch, save_config, etc
|
|
install_config_module(sys.modules[__name__])
|
|
|
|
Note that the import should happen before the call to install_config_module(), otherwise runtime errors may occur.
|
|
"""
|
|
|
|
assert TYPE_CHECKING, "Do not use at runtime"
|
|
|
|
def save_config() -> bytes: ...
|
|
def save_config_portable(*, ignore_private_configs: bool = True) -> dict[str, Any]: ...
|
|
def codegen_config() -> str: ...
|
|
def get_hash() -> bytes: ...
|
|
def to_dict() -> dict[str, Any]: ...
|
|
def shallow_copy_dict() -> dict[str, Any]: ...
|
|
def load_config(config: bytes | dict[str, Any]) -> None: ...
|
|
def get_config_copy() -> dict[str, Any]: ...
|
|
def patch(arg1: str | dict[str, Any] | None = None, arg2: Any = None, **kwargs): ...
|