Skip to content

Commit f960354

Browse files
committed
fixing donated buffer issue in compile test
1 parent 06bdc7b commit f960354

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_neighbors.py

+11
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,17 @@ def test_per_batch_box(device, strategy, n_batches, use_forward):
670670
@pytest.mark.parametrize("include_transpose", [True, False])
671671
def test_torch_compile(device, dtype, loop, include_transpose):
672672
import sys
673+
import torch._functorch.config
674+
675+
# ------ Patching the test for pytorch 2.6 which throws this error -------
676+
# RuntimeError: This backward function was compiled with non-empty donated buffers
677+
# which requires create_graph=False and retain_graph=False. Please keep
678+
# backward(create_graph=False, retain_graph=False) across all backward() function calls,
679+
# or set torch._functorch.config.donated_buffer=False to disable donated buffer.
680+
# --------------------------------------------------------------------------
681+
# stefdoerr: It might be a mistake from my side to bypass the issue like this but I'm lacking
682+
# the knowledge to see if something is wrong in the neighbors code which causes this.
683+
torch._functorch.config.donated_buffer = False
673684

674685
# Skip if SKIP_TORCH_COMPILE is set to true
675686
if os.environ.get("SKIP_TORCH_COMPILE", "false") == "true":

0 commit comments

Comments
 (0)