8000 Disable dynamo when running generated opcheck tests (#111685) · xuhancn/pytorch@8393a28 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8393a28

Browse files
williamwen42xuhancn
authored andcommitted
Disable dynamo when running generated opcheck tests (pytorch#111685)
Summary: Use `TORCHDYNAMO_DISABLE=1` when running generated opcheck tests. Enable some `fbgemm::pack_segments` tests that errored out (with error `RuntimeError: expected int but got s0*s1**2`) because dynamo was being run in the opcheck tests. Test Plan: `parsh -v --build-flags mode/dev-nosan //deeplearning/fbgemm/fbgemm_gpu:sparse_ops_test` then `run_tests("test_pack_segments")` Differential Revision: D50508958 Pull Request resolved: pytorch#111685 Approved by: https://github.com/z F8F8 ou3519
1 parent a55f882 commit 8393a28

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

torch/testing/_internal/optests/generate_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,14 @@ def maybe_raise_errors_on_exit(self) -> None:
449449

450450
def __enter__(self, *args, **kwargs):
451451
self.prev_is_opcheck_mode = _is_inside_opcheck_mode.value
452+
self.prev_dynamo_disable = os.environ.get("TORCHDYNAMO_DISABLE", "")
452453
_is_inside_opcheck_mode.value = True
454+
os.environ["TORCHDYNAMO_DISABLE"] = "1"
453455
return super().__enter__(*args, **kwargs)
454456

455457
def __exit__(self, *args, **kwargs):
456458
_is_inside_opcheck_mode.value = self.prev_is_opcheck_mode
459+
os.environ["TORCHDYNAMO_DISABLE"] = self.prev_dynamo_disable
457460
try:
458461
self.maybe_raise_errors_on_exit()
459462
if should_update_failures_dict():

0 commit comments

Comments
 (0)
0