Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c4918d5
Working on implementing the wrapper for the new blocksparse cutensor …
kmp5VT Jan 22, 2026
c15fea2
Revert to cutensor_jll.libcutensor as this has the blocksparse cutens…
kmp5VT Jan 23, 2026
82752ad
Remove redudant convert function
kmp5VT Jan 23, 2026
9678ecf
Merge branch 'JuliaGPU:master' into kmp5/feature/wrap_blocksparse_cut…
kmp5VT Mar 6, 2026
affc3d4
Make blocksparse code more generic (generic case). Would it be better…
kmp5VT Mar 16, 2026
a3a3f07
Merge branch 'master' into kmp5/feature/wrap_blocksparse_cutensor
kmp5VT Mar 16, 2026
67013c8
Merge branch 'kmp5/feature/wrap_blocksparse_cutensor' of github.com:k…
kmp5VT Mar 16, 2026
f6f5c5f
Merge branch 'JuliaGPU:master' into kmp5/feature/wrap_blocksparse_cut…
kmp5VT Mar 19, 2026
1ec69cf
Working on simplyfying and making accessors
kmp5VT Mar 19, 2026
8f5ef88
Fix problem with stride
kmp5VT Mar 19, 2026
9285b07
Small comment reminder
kmp5VT Mar 19, 2026
cda4a4e
Add a contraction test for the blocksparse system (not comprehensive …
kmp5VT Mar 19, 2026
94b8152
Merge branch 'master' into kmp5/feature/wrap_blocksparse_cutensor
kmp5VT Mar 24, 2026
138edaf
Closer to clang.jl construction
kmp5VT Mar 24, 2026
ce2eeec
Merge branch 'kmp5/feature/wrap_blocksparse_cutensor' of github.com:k…
kmp5VT Mar 24, 2026
3c11bec
Merge branch 'master' into kmp5/feature/wrap_blocksparse_cutensor
kmp5VT Mar 25, 2026
cc4b826
Update cutensor.toml for block sparse contraction
kshyatt Mar 26, 2026
3316f63
Merge branch 'master' into kmp5/feature/wrap_blocksparse_cutensor
kmp5VT Mar 26, 2026
c493659
Apply suggestion from @lkdvos
kmp5VT Mar 27, 2026
f6fb806
Merge branch 'JuliaGPU:master' into kmp5/feature/wrap_blocksparse_cut…
kmp5VT Apr 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions lib/cutensor/src/blocksparse/interfaces.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# interfacing with other packages

## Base

# function Base.:(+)(A::CuTensor, B::CuTensor)
# α = convert(eltype(A), 1.0)
# γ = convert(eltype(B), 1.0)
# C = similar(B)
# elementwise_binary_execute!(α, A.data, A.inds, CUTENSOR_OP_IDENTITY,
# γ, B.data, B.inds, CUTENSOR_OP_IDENTITY,
# C.data, C.inds, CUTENSOR_OP_ADD)
# C
# end

# function Base.:(-)(A::CuTensor, B::CuTensor)
# α = convert(eltype(A), 1.0)
# γ = convert(eltype(B), -1.0)
# C = similar(B)
# elementwise_binary_execute!(α, A.data, A.inds, CUTENSOR_OP_IDENTITY,
# γ, B.data, B.inds, CUTENSOR_OP_IDENTITY,
# C.data, C.inds, CUTENSOR_OP_ADD)
# C
# end

## For now call contract in ITensor and rely on UnallocatedArrays to make
## C in a dry-run of the contraction.
# function Base.:(*)(A::CuTensorBS, B::CuTensorBs)
# tC = promote_type(eltype(A), eltype(B))
# A_uniqs = [(idx, i) for (idx, i) in enumerate(A.inds) if !(i in B.inds)]
# B_uniqs = [(idx, i) for (idx, i) in enumerate(B.inds) if !(i in A.inds)]
# A_sizes = map(x->size(A,x[1]), A_uniqs)
# B_sizes = map(x->size(B,x[1]), B_uniqs)
# A_inds = map(x->x[2], A_uniqs)
# B_inds = map(x->x[2], B_uniqs)
# C = CuTensor(CUDA.zeros(tC, Dims(vcat(A_sizes, B_sizes))), vcat(A_inds, B_inds))
# return mul!(C, A, B)
# end


## LinearAlgebra

using LinearAlgebra

# function LinearAlgebra.axpy!(a, X::CuTensor, Y::CuTensor)
# elementwise_binary_execute!(a, X.data, X.inds, CUTENSOR_OP_IDENTITY,
# one(eltype(Y)), Y.data, Y.inds, CUTENSOR_OP_IDENTITY,
# Y.data, Y.inds, CUTENSOR_OP_ADD)
# return Y
# end

# function LinearAlgebra.axpby!(a, X::CuTensor, b, Y::CuTensor)
# elementwise_binary_execute!(a, X.data, X.inds, CUTENSOR_OP_IDENTITY,
# b, Y.data, Y.inds, CUTENSOR_OP_IDENTITY,
# Y.data, Y.inds, CUTENSOR_OP_ADD)
# return Y
# end

function LinearAlgebra.mul!(C::CuTensorBS, A::CuTensorBS, B::CuTensorBS, α::Number, β::Number)
contract!(α,
A, A.inds, CUTENSOR_OP_IDENTITY,
B, B.inds, CUTENSOR_OP_IDENTITY,
β,
C, C.inds, CUTENSOR_OP_IDENTITY,
CUTENSOR_OP_IDENTITY; jit=CUTENSOR_JIT_MODE_DEFAULT)
return C
end
Loading
Loading