[MPS] Add StreamContext stub (#20782)

Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
This commit is contained in:
R0CKSTAR
2026-03-25 20:59:51 -07:00
committed by GitHub
parent 02521420b3
commit abf4f1a47a
+14
View File
@@ -69,6 +69,19 @@ class Event:
return 0.0
class StreamContext:
"""Minimal stand-in for ``torch.cuda.StreamContext``."""
def __init__(self, stream: Any = None) -> None:
pass
def __enter__(self) -> "StreamContext":
return self
def __exit__(self, *args: Any) -> None:
pass
_default_stream = Stream()
@@ -235,6 +248,7 @@ def install() -> None:
# Only patch attributes that are actually missing
for name, obj in [
("Stream", Stream),
("StreamContext", StreamContext),
("Event", Event),
("current_stream", current_stream),
("stream", stream),