From dbed7500692b8587cbcc78048386048e0e04f365 Mon Sep 17 00:00:00 2001 From: Christian Guinard <28689358+christiangnrd@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:13:10 -0300 Subject: [PATCH] Only load BFloat16sExt on Apple systems (#454) --- ext/BFloat16sExt.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/BFloat16sExt.jl b/ext/BFloat16sExt.jl index d281d306d..6f11b18fc 100644 --- a/ext/BFloat16sExt.jl +++ b/ext/BFloat16sExt.jl @@ -4,9 +4,11 @@ using Metal: MPS.MPSDataType, MPS.MPSDataTypeBFloat16, MPS.jl_mps_to_typ, macos_ using BFloat16s # BFloat is only supported in MPS starting in MacOS 14 -if macos_version() >= v"14" - Base.convert(::Type{MPSDataType}, ::Type{BFloat16}) = MPSDataTypeBFloat16 - jl_mps_to_typ[MPSDataTypeBFloat16] = BFloat16 +@static if Sys.isapple() + if macos_version() >= v"14" + Base.convert(::Type{MPSDataType}, ::Type{BFloat16}) = MPSDataTypeBFloat16 + jl_mps_to_typ[MPSDataTypeBFloat16] = BFloat16 + end end end # module