Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #771 +/- ##
==========================================
- Coverage 86.94% 86.81% -0.14%
==========================================
Files 55 55
Lines 5195 5135 -60
==========================================
- Hits 4517 4458 -59
+ Misses 678 677 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
KernelAbstractions' Enzyme extension calls `EnzymeCore.compiler_job_from_backend` to compile the derivatives of kernels and their tapes. Implement it for `oneAPIBackend`, compiling like `KI.kernel_function` does (with the back end's `always_inline` and the sub-group size), and mark `synchronize` inactive. Reverse mode needs SPIRVIntrinsics 1.6.2, whose work-item built-ins tell Enzyme that they return integers: oneAPI computes KernelInterface indices in 32 bits, and Enzyme can't infer the type of a built-in's result from its truncation.
|
I've reworked this onto current Your guess on JuliaGPU/OpenCL.jl#621, that the exception reporting's stores of the work-item IDs were to blame, turned out not to be it: removing oneAPI's equivalent stores made no difference. |
KernelAbstractions has its Enzyme extension back (JuliaGPU/KernelAbstractions.jl#826). That extension calls
EnzymeCore.compiler_job_from_backendto compile the derivatives of kernels and their tapes. This PR adds anEnzymeCoreExtthat:oneAPIBackend, compiling likeKI.kernel_functiondoes: with the back end'salways_inlineand the sub-group size;oneL0.synchronizeinactive, as CUDA.jl does.Reverse mode also needs SPIRVIntrinsics 1.6.2 (JuliaGPU/OpenCL.jl#642), hence the compat bump. oneAPI computes KernelInterface indices in 32 bits, so the result of a work-item built-in such as
__spirv_BuiltInWorkgroupIdreaches integer code only through a truncation. Enzyme's type analysis can't infer the type from that, so it couldn't rule out a pointer and failed to differentiate the call. SPIRVIntrinsics 1.6.2 declares the built-ins' results as integers.Testing, on an Arc A770 with SPIRVIntrinsics 1.6.2 from that PR:
test/extensions/enzyme.jl, in Float32) passes, forward and reverse. With SPIRVIntrinsics 1.6.1, forward mode passes and reverse mode fails to compile.extensions/enzymetest, which checks the compiler job's configuration, passes, as dokernelabstractionsandkernelinterface.JuliaGPU/KernelAbstractions.jl#986 adds a Buildkite job that runs KA's Enzyme tests against oneAPI.jl
main.Draft until SPIRVIntrinsics 1.6.2 is registered: CI can't resolve the environment before then.