Skip to content

Commit

Permalink
Simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Feb 3, 2025
1 parent 804a4b5 commit 3c9c87a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
11 changes: 3 additions & 8 deletions src/compiler/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,10 @@ end
foreach(free, argument_buffers)

# Check for errors
Core.println(buf.status)
# XXX: we cannot do this nicely, e.g. throwing an `error` or reporting with `@error`
# because we're not allowed to switch tasks from this contexts.
if buf.status == MTL.MTLCommandBufferStatusError
err = buf.error
if err !== nothing
code = err.code # MTLCommandBufferError enum value
description = err.localizedDescription

@error "GPU kernel execution failed" exception = (err, catch_backtrace()) kernel = nameof(kernel.f) error_code = code description = description
end
Core.println("ERROR: Failed to submit command buffer: $(buf.error.localizedDescription)")
end

end
Expand Down
11 changes: 0 additions & 11 deletions test/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,3 @@ end
@test Array(a)[] == 1
end
end


@testset "error handling" begin
function failing_kernel(arr, ptr)
x = unsafe_load(reinterpret(Ptr{Int}, ptr))
@inbounds arr[1] = x
return nothing
end

@test_logs (:error, r"GPU kernel execution failed") @metal failing_kernel(mtl([0], 0))
end

0 comments on commit 3c9c87a

Please sign in to comment.