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
I have recently noticed that the new version of TensorKit supports running on CUDA, and I got a massive speed up when I tried. It's wonderful!
However, when combining GPU-backed TensorMaps with AD (Zygote), the backward pass fails because several pullback functions assume CPU arrays due to scalar indexing.
using TensorKit
using Zygote
using CUDA
using cuTENSOR
using Adapt
V = Rep[U₁](1//2 => 2, -1//2 => 2)
A = randn(ComplexF64, V ← V)
A_gpu = adapt(CuArray, A)
# Forward works
D, U = eigh_trunc((A_gpu + A_gpu') / 2; trunc = truncrank(2))
@show D
# Backward fails
Zygote.gradient(A_gpu) do a
D, U = eigh_trunc((a + a') / 2; trunc = truncrank(2))
return real(tr(D))
end
And the essentially same issue occurs in many of functions for tensor manipulation, such as flip() and twist().
Maybe the scalar indexing is the best way to go on CPU with help of Strided.jl, so we may need to implement special pullbacks for CUDA extensions? It'd be annoying...
Hi Ryo, as you have noticed this is definitely something that is under active development right now. We are working on combining many of these new and upcoming features (shout-out to @kshyatt for a lot of this amazing work!), but unfortunately we are not entirely there yet, which is exactly why this has not been widely advertised just about yet.
However, do feel free to keep reporting the missing parts, it is very helpful to have a list of things that we need to verify, as the problem space is quite large
Cool. I'm really looking forward to see working.
Yes, I know you all are enthusiastic on development AD functions especially in moving forward to Mooncake.jl at the moment.
I wonder what's actual advantage of Mooncake.jl ? I looked into this library, but I can only understand it's good to support primitive manipulations more than Zygote. More crucially, it looks having issues on CUDA support so far!
I'd also recommend here trying to use Reactant for high performance GPU usage (with or without AD). At least for ML, climate science, and astrophysics applications the speedup has been quite dramatic
I did see the JuliaCon talk, and while it looks amazing I was not entirely sure if it would apply to the typical workflows we have, which are usually dominated by calls to either BLAS gemm or LAPACK SVD. Do you know if we should be expecting differences there too? (Also note that we has our own LAPACK wrappers, so I'm not sure if that's relevant ?)
Activity
lkdvos commentedon Feb 18, 2026
Hi Ryo, as you have noticed this is definitely something that is under active development right now. We are working on combining many of these new and upcoming features (shout-out to @kshyatt for a lot of this amazing work!), but unfortunately we are not entirely there yet, which is exactly why this has not been widely advertised just about yet.
However, do feel free to keep reporting the missing parts, it is very helpful to have a list of things that we need to verify, as the problem space is quite large
Ryo-wtnb11 commentedon Feb 19, 2026
Cool. I'm really looking forward to see working.
Yes, I know you all are enthusiastic on development AD functions especially in moving forward to Mooncake.jl at the moment.
I wonder what's actual advantage of Mooncake.jl ? I looked into this library, but I can only understand it's good to support primitive manipulations more than Zygote. More crucially, it looks having issues on CUDA support so far!
kshyatt commentedon Feb 19, 2026
We are also planning to add support for Enzyme (which has more robust CUDA support) and the Mooncake CUDA effort is also ongoing :)
wsmoses commentedon Feb 20, 2026
I'd also recommend here trying to use Reactant for high performance GPU usage (with or without AD). At least for ML, climate science, and astrophysics applications the speedup has been quite dramatic
lkdvos commentedon Feb 20, 2026
I did see the JuliaCon talk, and while it looks amazing I was not entirely sure if it would apply to the typical workflows we have, which are usually dominated by calls to either BLAS gemm or LAPACK SVD. Do you know if we should be expecting differences there too? (Also note that we has our own LAPACK wrappers, so I'm not sure if that's relevant ?)
wsmoses commentedon Feb 22, 2026
I would actually expect more of an impact on code with multiple calls to linear algebra libraries [as we can potentially optimize usage thereof]