Skip to content

Commit

Permalink
Don't export macos_version
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Jul 18, 2024
1 parent 53be9fe commit 880f21b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/src/api/essentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Versions and Support
```@docs
macos_version
Metal.macos_version
Metal.darwin_version
Metal.metal_support
Metal.metallib_support
Expand Down
2 changes: 1 addition & 1 deletion lib/mtl/library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end

function MTLLibraryFromFile(dev::MTLDevice, path::String)
err = Ref{id{NSError}}(nil)
handle = if macos_version() >= v"13"
handle = if Metal.macos_version() >= v"13"
url = NSFileURL(path)
@objc [dev::id{MTLDevice} newLibraryWithURL:url::id{NSURL}
error:err::Ptr{id{NSError}}]::id{MTLLibrary}
Expand Down
6 changes: 2 additions & 4 deletions src/version.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# version and support queries

export macos_version

@noinline function _syscall_version(name)
size = Ref{Csize_t}()
err = @ccall sysctlbyname(name::Cstring, C_NULL::Ptr{Cvoid}, size::Ptr{Csize_t},
Expand All @@ -23,7 +21,7 @@ const _darwin_version = Ref{VersionNumber}()
Returns the host Darwin kernel version.
See also [`macos_version`](@ref).
See also [`Metal.macos_version`](@ref).
"""
function darwin_version()
if !isassigned(_darwin_version)
Expand All @@ -34,7 +32,7 @@ end

const _macos_version = Ref{VersionNumber}()
"""
macos_version() -> VersionNumber
Metal.macos_version() -> VersionNumber
Returns the host macOS version.
Expand Down
6 changes: 3 additions & 3 deletions test/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ end
Metal.code_typed(dummy, Tuple{})
Metal.code_warntype(devnull, dummy, Tuple{})
Metal.code_llvm(devnull, dummy, Tuple{})
if macos_version() >= v"13"
if Metal.macos_version() >= v"13"
Metal.code_agx(devnull, dummy, Tuple{})
end

@device_code_lowered @metal dummy()
@device_code_typed @metal dummy()
@device_code_warntype io=devnull @metal dummy()
@device_code_llvm io=devnull @metal dummy()
if macos_version() >= v"13"
if Metal.macos_version() >= v"13"
@device_code_agx io=devnull @metal dummy()
end

Expand All @@ -73,7 +73,7 @@ end
# make sure kernel name aliases are preserved in the generated code
@test occursin("dummy", sprint(io->(@device_code_llvm io=io optimize=false @metal dummy())))
@test occursin("dummy", sprint(io->(@device_code_llvm io=io @metal dummy())))
if macos_version() >= v"13"
if Metal.macos_version() >= v"13"
@test occursin("dummy", sprint(io->(@device_code_agx io=io @metal dummy())))
end

Expand Down
3 changes: 1 addition & 2 deletions test/profiling.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Metal: macos_version
@testset "profiling" begin

# determine if we can even run these tests
Expand All @@ -14,7 +13,7 @@ else
error("Could not parse xctrace version output:\n$version_output")
else
xcode_version = VersionNumber(parse(Int, m.captures[1]), parse(Int, m.captures[2]))
if MTL.is_m1(device()) && macos_version() >= v"14.4" && xcode_version < v"15.3"
if MTL.is_m1(device()) && Metal.macos_version() >= v"14.4" && xcode_version < v"15.3"
@warn "Skipping profiling tests because of an M1-related bug on macOS 14.4 and Xcode < 15.3; please upgrade Xcode first"
else
run_tests = true
Expand Down

0 comments on commit 880f21b

Please sign in to comment.