Skip to content

Commit d79e651

Browse files
authored
[BugFix,Test] recompiles with string failure (#3338)
1 parent 3d1d8ac commit d79e651

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

test/compile/test_compile_utils.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,19 @@
2424

2525
# Check that 'capture_log_records' captures records emitted when torch
2626
# recompiles a function.
27+
#
28+
# NOTE: Starting from PyTorch 2.11.x nightlies (around 2026-01-14), PyTorch
29+
# optimized guard generation for graph-breaking functions to only guard on
30+
# type rather than value. This means the test function no longer triggers
31+
# recompilation when called with different string values, since the type
32+
# remains the same. This is an improvement in PyTorch, not a bug.
2733
@pytest.mark.skipif(
2834
TORCH_VERSION < version.parse("2.5.0"), reason="requires Torch >= 2.5.0"
2935
)
36+
@pytest.mark.skipif(
37+
TORCH_VERSION >= version.parse("2.11.0"),
38+
reason="PyTorch >= 2.11.0 optimizes guards for graph-breaking functions",
39+
)
3040
@pytest.mark.skipif(
3141
sys.version_info >= (3, 14),
3242
reason="torch.compile is not supported on Python 3.14+",
@@ -35,7 +45,7 @@ def test_capture_log_records_recompile():
3545
torch.compiler.reset()
3646

3747
# This function recompiles each time it is called with a different string
38-
# input.
48+
# input (on PyTorch < 2.11.0). The guard is on the exact value of `s`.
3949
@torch.compile
4050
def str_to_tensor(s):
4151
return bytes(s, "utf8")

0 commit comments

Comments
 (0)