Skip to content

Commit dbed750

Browse files
Only load BFloat16sExt on Apple systems (#454)
1 parent c4c0e28 commit dbed750

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ext/BFloat16sExt.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ using Metal: MPS.MPSDataType, MPS.MPSDataTypeBFloat16, MPS.jl_mps_to_typ, macos_
44
using BFloat16s
55

66
# BFloat is only supported in MPS starting in MacOS 14
7-
if macos_version() >= v"14"
8-
Base.convert(::Type{MPSDataType}, ::Type{BFloat16}) = MPSDataTypeBFloat16
9-
jl_mps_to_typ[MPSDataTypeBFloat16] = BFloat16
7+
@static if Sys.isapple()
8+
if macos_version() >= v"14"
9+
Base.convert(::Type{MPSDataType}, ::Type{BFloat16}) = MPSDataTypeBFloat16
10+
jl_mps_to_typ[MPSDataTypeBFloat16] = BFloat16
11+
end
1012
end
1113

1214
end # module

0 commit comments

Comments
 (0)