8000 inductor_config_logging: Don't drop keys (#144700) · pytorch/pytorch@c116195 · GitHub
[go: up one dir, main page]

Skip to content

Commit c116195

Browse files
c00wpytorchmergebot
authored andcommitted
inductor_config_logging: Don't drop keys (#144700)
This bit me while I was trying to debug some trace issues. In general this config is already quite large when dumping, so adding more fields doesn't make it significantly worse. Also a number of the items we are type checking for (except the test configs), don't even show up. Primarily this will help us when debugging rocm, halide, and trace configs. Pull Request resolved: #144700 Approved by: https://github.com/ezyang
1 parent 7d01f6e commit c116195

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

test/dynamo/test_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ def test_inductor_config_jsonify(self):
390390

391391
inductor_config_json = utils._scrubbed_inductor_config_for_logging()
392392
self.assertTrue(isinstance(inductor_config_json, str))
393+
self.assertIn('trace"', inductor_config_json)
393394

394395
@mock.patch("torch._dynamo.utils.torch._inductor.config")
395396
def test_inductor_config_parsing_non_conforming_items(self, mocked_inductor_config):

torch/_dynamo/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
Generic,
4545
Optional,
4646
overload,
47+
Set,
4748
TypeVar,
4849
Union,
4950
)
@@ -1332,16 +1333,15 @@ def default(self, o):
13321333
except Exception:
13331334
return "Value is not JSON serializable"
13341335

1335-
configs_to_scrub_re = r"((^TYPE_CHECKING$)|(.*_progress$)|(.*TESTING.*)|(.*(rocm|halide).*)|(^trace\..*)|(^_))"
1336-
keys_to_scrub = set()
1336+
keys_to_scrub: Set[Any] = set()
13371337
inductor_conf_str = None
13381338
inductor_config_copy = (
13391339
torch._inductor.config.get_config_copy() if torch._inductor.config else None
13401340
)
13411341
if inductor_config_copy is not None:
13421342
try:
13431343
for key, val in inductor_config_copy.items():
1344-
if not isinstance(key, str) or re.search(configs_to_scrub_re, key):
1344+
if not isinstance(key, str):
13451345
keys_to_scrub.add(key)
13461346
# Convert set() to list for json.dumps()
13471347
if isinstance(val, set):

0 commit comments

Comments
 (0)
0