Skip to content

Commit

Permalink
Simplify logic to work around hang.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored and tgymnich committed Oct 27, 2024
1 parent 08a9e00 commit d4cd19f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/compiler/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,13 @@ end
throw(ArgumentError("Number of threads in group ($(threads.width * threads.height * threads.depth)) should not exceed $(kernel.pipeline.maxTotalThreadsPerThreadgroup)"))

cmdbuf = if kernel.loggingEnabled
# TODO: make this a dynamic error, i.e., from the kernel (JuliaGPU/Metal.jl#433)
if macos_version() < v"15"
@error "Logging is only supported on macOS 15 or higher"
error("Logging is only supported on macOS 15 or higher")
end

if MTLCaptureManager().isCapturing
@error "Logging is not supported while GPU frame capturing"
error("Logging is not supported while GPU frame capturing")
end

log_state_descriptor = MTLLogStateDescriptor()
Expand Down
6 changes: 1 addition & 5 deletions src/device/intrinsics/output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ macro mtlprintf(fmt::String, args...)
fmt_val = Val(Symbol(fmt))

quote
if metal_version() < sv"3.2"
@print_and_throw "@mtlprintf requires Metal 3.2 (macOS 15) or higher"
else
_mtlprintf($fmt_val, $(map(arg -> :(promote_c_argument($arg)), esc.(args))...))
end
_mtlprintf($fmt_val, $(map(arg -> :(promote_c_argument($arg)), esc.(args))...))
end
end

Expand Down
6 changes: 6 additions & 0 deletions test/output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ if Metal.macos_version() < v"15"

@warn "Skipping output tests in macOS 14 and below"

function kernel()
@mtlprint("Hello, World\n")
return
end
@test_throws "Logging is only supported on macOS 15 or higher" @metal kernel()

else

@testset "formatted output" begin
Expand Down

0 comments on commit d4cd19f

Please sign in to comment.