Conversation
Yggdrasil replaced the `llc`, `lld` and `llvm-downgrade` executables in the GPU LLVM JLLs with shared libraries exposing a small C API, moving the back-ends to LLVM 23 at the same time. GPUCompiler 2.7 calls those libraries in-process and bumps its compat to the new JLL majors. We pin the same JLL (for `versioninfo`), so its compat has to move in lockstep. Follows JuliaGPU/OpenCL.jl#480. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019X2CqtAxNnxqTxgXvz19pJ
POCL kernels can now report failures to the host as `KernelException`s. A faulting work-item returns, and the error is raised when the host synchronizes. Because POCL launches are synchronous, that is normally the launch itself; a kernel started through `@opencl` (which does not wait for its event) reports at the next `KernelAbstractions.synchronize`. The report is consumed before throwing, so subsequent kernels can run normally. ```julia using KernelAbstractions @kernel function oob(a) i = @index(Global, Linear) a[i + 1] = 1.0f0 end a = KernelAbstractions.zeros(POCLBackend(), Float32, 1) oob(POCLBackend())(a; ndrange = 1) # KernelException with BoundsError details ``` The new `debug_level` compiler keyword defaults to Julia's `-g` setting. Level 0 records only that an exception occurred; level 1 adds names and reasons for common runtime errors; level 2 also records work-item coordinates and a bounded device-side backtrace. Each device in a context has a mailbox shared by its queues. Synchronizing may therefore wait for and report an error from another queue on that device. Device atomics select one writer, identified by its launch and work-item coordinates, so later kernels cannot overwrite its diagnostics. POCL's CPU device shares the host address space, so the mailbox is an ordinary host allocation reached by pointer; it is retained for the lifetime of the process. Failed kernels may leave incomplete results, and work-group barriers must still obey convergence rules. Requires GPUCompiler 2.7 for SPIR-V exception lowering, failed-boxing handling, and the correct address space for diagnostic strings. Follows JuliaGPU/OpenCL.jl#478. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019X2CqtAxNnxqTxgXvz19pJ
Contributor
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
christiangnrd
force-pushed
the
pocl/spirv-backend-jll-23
branch
from
September 11, 2026 19:58
0fa7d1c to
fc80276
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POCL kernels can now report failures to the host as
KernelExceptions. A faulting work-item returns, and the error is raised when the host synchronizes. Because POCL launches are synchronous, that is normally the launch itself; a kernel started through@opencl(which does not wait for its event) reports at the nextKernelAbstractions.synchronize. The report is consumed before throwing, so subsequent kernels can run normally.The new
debug_levelcompiler keyword defaults to Julia's-gsetting. Level 0 records only that an exception occurred; level 1 adds names and reasons for common runtime errors; level 2 also records work-item coordinates and a bounded device-side backtrace:Each device in a context has a mailbox shared by its queues. Synchronizing may therefore wait for and report an error from another queue on that device. Device-scoped atomics select one writer, identified by its launch id and work-item coordinates, so later kernels cannot overwrite its diagnostics.
Differences from upstream
Ports JuliaGPU/OpenCL.jl#478. The device-side half (mailbox layout, atomic claim protocol,
@gputhrow, thereport_*runtime hooks, quirks) is a direct port. Two things are simpler here:Libc.mallocallocation the kernel reaches by pointer — no backend selection, no mapping, and no "device cannot report exceptions" warning path.cl.finishand blocking copies, and needs a non-throwing variant for finalizers. The POCL back-end's arrays areBase.Arrayand every launch already waits on its event, so the check lives at the end of the two launch paths inbackend.jl, plusKernelInterface.synchronize(previously a no-op) for kernels launched via@opencl. There is no finalizer-driven synchronization to work around.Also unlike upstream,
KernelExceptionis not exported; it is reachable asKernelAbstractions.POCL.KernelException.Requires GPUCompiler 2.7 for SPIR-V exception lowering, failed-boxing handling, and the correct address space for diagnostic strings — so this is stacked on 761 and targets that branch.
Validation
Julia 1.12.7, POCL 7.2,
cpu-haswelldevice. Full test suite green (2424 pass, 4 pre-existing broken, 0 failures) with all three ports applied together. New tests cover debug levels 0/1/2 in the emitted IR, a KA@kernelthat goes out of bounds, mailbox reset and device reuse afterwards, the@opencldeferred-report path, a boxed exception whose throw path must survive the optimizer, and the recorded name/reason. Manually checked-g0,-g1and-g2sessions end to end.🤖 Generated with Claude Code
https://claude.ai/code/session_019X2CqtAxNnxqTxgXvz19pJ