Skip to content

Commit 4ea0848

Browse files
committed
Better version?
1 parent 231d2a1 commit 4ea0848

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Metal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ include("device/utils.jl")
2727
include("device/pointer.jl")
2828
include("device/array.jl")
2929
include("device/runtime.jl")
30+
include("device/intrinsics/version.jl")
3031
include("device/intrinsics/arguments.jl")
3132
include("device/intrinsics/math.jl")
3233
include("device/intrinsics/synchronization.jl")
3334
include("device/intrinsics/memory.jl")
3435
include("device/intrinsics/simd.jl")
35-
include("device/intrinsics/version.jl")
3636
include("device/intrinsics/atomics.jl")
3737
include("device/quirks.jl")
3838

src/device/intrinsics/math.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,19 @@ end
294294
@device_override Base.trunc(x::Float32) = ccall("extern air.trunc.f32", llvmcall, Cfloat, (Cfloat,), x)
295295
@device_override Base.trunc(x::Float16) = ccall("extern air.trunc.f16", llvmcall, Float16, (Float16,), x)
296296

297-
@static if Metal.is_macos(v"14")
298-
@device_function nextafter(x::Float32, y::Float32) = ccall("extern air.nextafter.f32", llvmcall, Cfloat, (Cfloat, Cfloat), x, y)
299-
@device_function nextafter(x::Float16, y::Float16) = ccall("extern air.nextafter.f16", llvmcall, Float16, (Float16, Float16), x, y)
297+
@device_function function nextafter(x::Float32, y::Float32)
298+
if metal_version() >= sv"3.1" # macOS 14+
299+
ccall("extern air.nextafter.f32", llvmcall, Cfloat, (Cfloat, Cfloat), x, y)
300+
else
301+
error()
302+
end
303+
end
304+
@device_function function nextafter(x::Float16, y::Float16)
305+
if metal_version() >= sv"3.1" # macOS 14+
306+
ccall("extern air.nextafter.f16", llvmcall, Float16, (Float16, Float16), x, y)
307+
else
308+
error()
309+
end
300310
end
301311

302312
# hypot without use of double

0 commit comments

Comments
 (0)