Skip to content

Commit 5416dff

Browse files
authored
[Release/2.7][MPS] Warn that torch.compile is a prototype (pytorch#150550)
And reference pytorch#150121
1 parent 7912651 commit 5416dff

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

torch/_inductor/codegen/mps.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Just an early prototype that shows that one can compile elementwise ops into a Metal shader
33
from __future__ import annotations
44

5+
import functools
56
import itertools
67
from typing import Any, Optional, TYPE_CHECKING
78

@@ -701,11 +702,23 @@ def check_bounds(
701702
self.cse.generate(self.compute, line, assignment=False)
702703

703704

705+
@functools.cache
706+
def _warn_prototype() -> None:
707+
import warnings
708+
709+
warnings.warn(
710+
"torch.compile for Metal is an early protoype and might not work as expected."
711+
" For details see https://github.com/pytorch/pytorch/issues/150121",
712+
stacklevel=2,
713+
)
714+
715+
704716
class MetalScheduling(SIMDScheduling):
705717
kernel_type = MetalKernel # type: ignore[assignment]
706718

707719
def __init__(self, scheduler: Optional[Scheduler]) -> None:
708720
super().__init__(scheduler)
721+
_warn_prototype()
709722
wrapper = V.graph.wrapper_code
710723
if wrapper is not None:
711724
wrapper.header.splice(

0 commit comments

Comments
 (0)