mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[Inductor][WIndows] Fix Windows test case failure. (#161497)
Fixes windows test case failures: - TritonCodeGenTests.test_inductor_sequence_nr - TritonCodeGenTests.test_indirect_device_assert - CompiledOptimizerTests.test_static_address_finalizer Pull Request resolved: https://github.com/pytorch/pytorch/pull/161497 Approved by: https://github.com/jansel
This commit is contained in:
committed by
PyTorch MergeBot
parent
3519969e4f
commit
07f76517e7
@ -73,7 +73,10 @@ if __name__ == "__main__":
|
||||
shape = (y.numel(),) + x.shape[2:]
|
||||
z = torch.randn(shape, device=GPU_TYPE)
|
||||
fn(x, y, z)
|
||||
# On Windows, Python will optimize away a function call if its updated value is not used.
|
||||
# Touch the memory of x so that the fn(x, y, z) will not be optimized away
|
||||
print(x)
|
||||
elif fn_name in ("upper1", "upper2", "lower1", "lower2"):
|
||||
fn(x)
|
||||
print(fn(x))
|
||||
else:
|
||||
fn(x, y)
|
||||
print(fn(x, y))
|
||||
|
@ -58,7 +58,7 @@ from torch.testing._internal.common_optimizers import (
|
||||
optim_db,
|
||||
optims,
|
||||
)
|
||||
from torch.testing._internal.common_utils import parametrize
|
||||
from torch.testing._internal.common_utils import parametrize, skipIfWindows
|
||||
from torch.testing._internal.inductor_utils import (
|
||||
GPU_TYPE,
|
||||
HAS_CPU,
|
||||
@ -731,6 +731,7 @@ class CompiledOptimizerTests(TestCase):
|
||||
SGD, kernel_count=1, lr=0.01, foreach=True
|
||||
)
|
||||
|
||||
@skipIfWindows
|
||||
@requires_gpu
|
||||
def test_static_address_finalizer(self):
|
||||
import gc
|
||||
|
@ -611,6 +611,9 @@ class BaseSchedulerNode:
|
||||
+ stack_trace_last_line.replace("{", "{{")
|
||||
.replace("}", "}}")
|
||||
.replace("\n", "\\")
|
||||
.replace(
|
||||
"\\", "\\\\"
|
||||
) # For windows safe path, avoid for example \x, \U.
|
||||
)
|
||||
out_lines.append("#pragma CMT END ORIGIN")
|
||||
out_lines.append("")
|
||||
|
Reference in New Issue
Block a user