From d4cd19f0b4af46a7470f7af1424f25d928e2e0e7 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Tue, 1 Oct 2024 22:15:32 +0200 Subject: [PATCH] Simplify logic to work around hang. --- src/compiler/execution.jl | 5 +++-- src/device/intrinsics/output.jl | 6 +----- test/output.jl | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/compiler/execution.jl b/src/compiler/execution.jl index bfc9c55c..4c3afc19 100644 --- a/src/compiler/execution.jl +++ b/src/compiler/execution.jl @@ -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() diff --git a/src/device/intrinsics/output.jl b/src/device/intrinsics/output.jl index 0c76f3da..6eb39fd2 100644 --- a/src/device/intrinsics/output.jl +++ b/src/device/intrinsics/output.jl @@ -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 diff --git a/test/output.jl b/test/output.jl index 2d4b384f..c4eae0d2 100644 --- a/test/output.jl +++ b/test/output.jl @@ -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