You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to register a customized GPU operator with CuPy #823
I've tried installing brainpy and also BrainX with cuda12 and cuda13 by following the instructions such as "pip install brainpy[cuda12]", but nothing worked. It seems that the cause is XLACustomOp doesn't exist any more. Please kindly shed some light on the resolutions.
Thank you.
You're correct — bm.XLACustomOp has been removed in recent versions of BrainPy. The functionality has been migrated to the separate brainevent package.
To register custom GPU operators with CuPy (or CPU operators with Numba), you should now use brainevent.XLACustomKernel directly. Here's how:
frombraineventimportXLACustomKernel, warp_kernel# Define your GPU kernel using Warpkernel=warp_kernel(...)
custom_op=XLACustomKernel(
name='my_custom_op',
gpu_kernel=kernel
)
# Use itresult=custom_op(inputs, outs=[jax.ShapeDtypeStruct(shape, dtype)])
For detailed usage with CuPy/JIT, please refer to the brainevent documentation:
brainevent.XLACustomKernel for general custom operators
brainevent.numba_kernel for Numba CPU kernels
brainevent.warp_kernel for Warp GPU kernels
brainevent.pallas_kernel for Pallas GPU kernels
The old bm.XLACustomOp API was deprecated and removed during the BrainPy 2.7+ releases when brainevent was integrated as a separate dependency.
If you need help migrating specific code from the old API, feel free to ask!
I've tried creating a warp function and it works. Before that, I've spent several hours struggling with bm.XLACustomOp and reinstallation with various brainpy versions and so on. Thank you very much for your help.
Have a nice weekend.
Thank you for the confirmation, @leonlee-1! We're sorry for the confusion caused by the outdated documentation. We'll make sure to update the docs to reflect the migration to brainevent. Glad to hear the Warp approach is working for you! Have a great weekend as well!
Activity
github-actions commentedon Mar 28, 2026
👋 Welcome to BrainPy! Thank you for opening your first issue.
We appreciate you taking the time to contribute to the project. A maintainer will review your issue and respond as soon as possible.
In the meantime, please make sure you've provided all the necessary information to help us understand and address your issue effectively.
If you're interested in contributing code, check out our Contributing Guide for more information on how to get started.
Happy coding! 🧠✨
sichaohe commentedon Mar 28, 2026
Hi @leonlee-1,
You're correct —
bm.XLACustomOphas been removed in recent versions of BrainPy. The functionality has been migrated to the separatebraineventpackage.To register custom GPU operators with CuPy (or CPU operators with Numba), you should now use
brainevent.XLACustomKerneldirectly. Here's how:For detailed usage with CuPy/JIT, please refer to the
braineventdocumentation:brainevent.XLACustomKernelfor general custom operatorsbrainevent.numba_kernelfor Numba CPU kernelsbrainevent.warp_kernelfor Warp GPU kernelsbrainevent.pallas_kernelfor Pallas GPU kernelsThe old
bm.XLACustomOpAPI was deprecated and removed during the BrainPy 2.7+ releases whenbraineventwas integrated as a separate dependency.If you need help migrating specific code from the old API, feel free to ask!
leonlee-1 commentedon Mar 28, 2026
Hi @Routhleck,
I've tried creating a warp function and it works. Before that, I've spent several hours struggling with bm.XLACustomOp and reinstallation with various brainpy versions and so on. Thank you very much for your help.
Have a nice weekend.
sichaohe commentedon Mar 29, 2026
Thank you for the confirmation, @leonlee-1! We're sorry for the confusion caused by the outdated documentation. We'll make sure to update the docs to reflect the migration to
brainevent. Glad to hear the Warp approach is working for you! Have a great weekend as well!