Skip to content

Conversation

@kshyatt
Copy link
Member

@kshyatt kshyatt commented Oct 9, 2025

This is causing CUDA nightly to fail because we don't have a specialized method to copy triangular types on GPU to CPU matrices. This is a work around that hopefully avoids the fail while still test appropriately.

@maleadt
Copy link
Member

maleadt commented Oct 9, 2025

we don't have a specialized method to copy triangular types on GPU to CPU matrices

Wouldn't it be more reasonable to add that? And what about

## copy a triangular part of a matrix to another matrix
if isdefined(LinearAlgebra, :copytrito!)
function LinearAlgebra.copytrito!(B::AbstractGPUMatrix{T}, A::AbstractGPUMatrix{T}, uplo::AbstractChar) where {T}
LinearAlgebra.BLAS.chkuplo(uplo)
m,n = size(A)
m1,n1 = size(B)
if uplo == 'U'
if n < m
(m1 < n || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($n,$n)"))
else
(m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)"))
end
@kernel function U_kernel!(_A, _B)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j >= i
@inbounds _B[i,j] = _A[i,j]
end
end
U_kernel!(get_backend(B))(A, B; ndrange = size(A))
else # uplo == 'L'
if m < n
(m1 < m || n1 < m) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$m)"))
else
(m1 < m || n1 < n) && throw(DimensionMismatch("B of size ($m1,$n1) should have at least size ($m,$n)"))
end
@kernel function L_kernel!(_A, _B)
I = @index(Global, Cartesian)
i, j = Tuple(I)
if j <= i
@inbounds _B[i,j] = _A[i,j]
end
end
L_kernel!(get_backend(A))(A, B; ndrange = size(A))
end
return B
end
end

@christiangnrd
Copy link
Member

@maleadt JuliaLang/LinearAlgebra.jl#1263 and JuliaLang/LinearAlgebra.jl#1282 have made it so that copytrito! functions are bypassed.

Since I don't believe the broken code is actually what's being tested, imo this PR makes the testsuite more robust.

Unless you think it'll get forgotten unless fixed by this PR, I think we should merge this and then open an issue for supporting and testingMatrix{T}(U::UpperOrLowerTriangular{T, S<:AbstractGPUMatrix).

Broken since JuliaLang/julia#58180 or JuliaLang/julia#58396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants