Created
September 30, 2025 23:15
-
-
Save mlazos/bcf8c946eec4786690a58c0be813447b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test_stream_enter_exit(self): | |
| def fn(x, y): | |
| s2 = torch.cuda.Stream() | |
| s1 = torch.cuda.Stream() | |
| with s2: | |
| z1 = torch.add(x, y) | |
| with s1: | |
| z = torch.add(x, y) | |
| y = z + 2 + z1 | |
| return y | |
| inp = (torch.ones(2, 2) + 1, torch.ones(2, 2)) | |
| expected = fn(*inp) | |
| fn_opt = torch.compile(fn, fullgraph=True) | |
| actual = fn_opt(*inp) | |
| self.assertEqual(expected, actual) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment