Revert "[dynamo] context manager/decorator for dynamo config patching during tracing (#150586)"

This reverts commit 40ce4fb24a536d175348df876f61956d4945778e.

Reverted https://github.com/pytorch/pytorch/pull/150586 on behalf of https://github.com/clee2000 due to broke some inductor tests? inductor/test_fuzzer.py::TestConfigFuzzer::test_config_fuzzer_dynamo_bisect [GH job link](https://github.com/pytorch/pytorch/actions/runs/14486513628/job/40635178179) [HUD commit link](40ce4fb24a), bad TD ([comment](https://github.com/pytorch/pytorch/pull/150586#issuecomment-2810064322))
This commit is contained in:
PyTorch MergeBot
2025-04-16 16:13:47 +00:00
parent 0c77af3576
commit 6a3a6d22dc
18 changed files with 37 additions and 463 deletions

View File

@ -667,15 +667,12 @@ class ConfigModule(ModuleType):
config = self
class ConfigPatch(ContextDecorator):
def __init__(self) -> None:
self.changes = changes
def __enter__(self) -> None:
assert not prior
for key in self.changes.keys():
for key in changes.keys():
# KeyError on invalid entry
prior[key] = config.__getattr__(key)
for k, v in self.changes.items():
for k, v in changes.items():
config.__setattr__(k, v)
def __exit__(self, exc_type, exc_val, exc_tb): # type: ignore[no-untyped-def]