[Fix] Register triton.runtime.cache.triton_key in the MPS stub so torch.compile keeps working (#37937)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alex Nails
2026-09-03 22:56:14 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent 06b8749803
commit ebae8ee21e
2 changed files with 28 additions and 1 deletions
@@ -40,6 +40,25 @@ assert _KernelType is not None
msg=f"stdout={completed.stdout}\nstderr={completed.stderr}",
)
def test_torch_compile_works_after_sglang_installs_stub(self):
script = """
import sglang
import torch
torch.compile(lambda x: x * 2 + 1)(torch.randn(8))
"""
completed = subprocess.run(
[sys.executable, "-c", script],
capture_output=True,
text=True,
timeout=60,
check=False,
)
self.assertEqual(
completed.returncode,
0,
msg=f"stdout={completed.stdout}\nstderr={completed.stderr}",
)
if __name__ == "__main__":
unittest.main()