Skip to content

Commit 91d72d0

Browse files
authored
Skip profiling tests on macOS 14.4/M1. (#310)
1 parent c556832 commit 91d72d0

File tree

5 files changed

+49
-26
lines changed

5 files changed

+49
-26
lines changed

lib/mtl/MTL.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ include("command_enc/blit.jl")
3333
include("command_enc/compute.jl")
3434
include("binary_archive.jl")
3535
include("capture.jl")
36-
include("family.jl")
3736
include("texture.jl")
3837

3938
end # module

lib/mtl/device.jl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,40 @@ end
8585
Get a handle to a compute device.
8686
"""
8787
MTLDevice(i::Integer) = devices()[i]
88+
89+
90+
#
91+
# family
92+
#
93+
94+
export supports_family, is_m3, is_m2, is_m1
95+
96+
@cenum MTLGPUFamily::NSUInteger begin
97+
MTLGPUFamilyMetal3 = 5001 # Metal 3 support
98+
99+
MTLGPUFamilyApple9 = 1009 # M3 & A17
100+
MTLGPUFamilyApple8 = 1008 # M2 & A15, A16
101+
MTLGPUFamilyApple7 = 1007 # M1 & A14
102+
MTLGPUFamilyApple6 = 1006 # A13
103+
MTLGPUFamilyApple5 = 1005 # A12
104+
MTLGPUFamilyApple4 = 1004 # A11
105+
MTLGPUFamilyApple3 = 1003 # A9, A10
106+
MTLGPUFamilyApple2 = 1002 # A8
107+
MTLGPUFamilyApple1 = 1001 # A7
108+
109+
MTLGPUFamilyCommon3 = 3003
110+
MTLGPUFamilyCommon2 = 3002
111+
MTLGPUFamilyCommon1 = 3001
112+
113+
MTLGPUFamilyMac2 = 2002 # Mac family 2 GPU features
114+
end
115+
116+
function supports_family(device::MTLDevice, gpufamily::MTLGPUFamily)
117+
@objc [device::MTLDevice supportsFamily:gpufamily::MTLGPUFamily]::Bool
118+
end
119+
120+
is_m1(dev::MTLDevice) = supports_family(dev, MTLGPUFamilyApple7) &&
121+
!supports_family(dev, MTLGPUFamilyApple8)
122+
is_m2(dev::MTLDevice) = supports_family(dev, MTLGPUFamilyApple8) &&
123+
!supports_family(dev, MTLGPUFamilyApple9)
124+
is_m3(dev::MTLDevice) = supports_family(dev, MTLGPUFamilyApple9)

lib/mtl/family.jl

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/state.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ function current_device()
1717
get!(task_local_storage(), :MTLDevice) do
1818
dev = MTLDevice(1)
1919
if !supports_family(dev, MTL.MTLGPUFamilyApple7)
20-
@warn """Metal.jl is only supported on M-series Macs, you may run into issues.
20+
@warn """Metal.jl is only supported on Apple Silicon, you may run into issues.
21+
See https://github.com/JuliaGPU/Metal.jl/issues/22 for more details.""" maxlog=1
22+
end
23+
if !supports_family(dev, MTL.MTLGPUFamilyMetal3)
24+
@warn """Metal.jl is only supported on Metal 3-capable devices, you may run into issues.
2125
See https://github.com/JuliaGPU/Metal.jl/issues/22 for more details.""" maxlog=1
2226
end
2327
return dev

test/profiling.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
@testset "profiling" begin
2+
3+
if MTL.is_m1(current_device()) && macos_version() >= v"14.4"
4+
@warn "Skipping profiling tests because of an M1-related bug on macOS 14.4"
5+
else
6+
27
mktempdir() do tmpdir
38
cd(tmpdir) do
49

@@ -13,6 +18,8 @@ end
1318

1419
end
1520

21+
end
22+
1623
end
1724
end
1825
end

0 commit comments

Comments
 (0)