Skip to content

Conversation

@eschnett
Copy link

Julia 1.13 added a diag::Bool argument to copytri!. We need to mimic that so that we can match the signature when overloading for GPUArrays.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic master) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/host/linalg.jl b/src/host/linalg.jl
index 5f3b67a..fc8d200 100644
--- a/src/host/linalg.jl
+++ b/src/host/linalg.jl
@@ -116,8 +116,8 @@ if VERSION >= v"1.13-a"
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j + diag > i
-                    @inbounds _A[j,i] = conj(_A[i,j])
-              end
+                    @inbounds _A[j, i] = conj(_A[i, j])
+                end
             end
             U_conj!(get_backend(A))(A; ndrange = size(A))
         elseif uplo == 'U' && !conjugate
@@ -125,8 +125,8 @@ if VERSION >= v"1.13-a"
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j + diag > i
-                    @inbounds _A[j,i] = _A[i,j]
-              end
+                    @inbounds _A[j, i] = _A[i, j]
+                end
             end
             U_noconj!(get_backend(A))(A; ndrange = size(A))
         elseif uplo == 'L' && conjugate
@@ -134,7 +134,7 @@ if VERSION >= v"1.13-a"
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j + diag > i
-                    @inbounds _A[i,j] = conj(_A[j,i])
+                    @inbounds _A[i, j] = conj(_A[j, i])
                 end
             end
             L_conj!(get_backend(A))(A; ndrange = size(A))
@@ -143,14 +143,14 @@ if VERSION >= v"1.13-a"
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j + diag > i
-                    @inbounds _A[i,j] = _A[j,i]
+                    @inbounds _A[i, j] = _A[j, i]
                 end
             end
             L_noconj!(get_backend(A))(A; ndrange = size(A))
         else
             throw(ArgumentError("uplo argument must be 'U' (upper) or 'L' (lower), got $uplo"))
         end
-        A
+        return A
     end
 
 else
@@ -163,8 +163,8 @@ else
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j > i
-                    @inbounds _A[j,i] = conj(_A[i,j])
-              end
+                    @inbounds _A[j, i] = conj(_A[i, j])
+                end
             end
             U_conj!(get_backend(A))(A; ndrange = size(A))
         elseif uplo == 'U' && !conjugate
@@ -172,8 +172,8 @@ else
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j > i
-                    @inbounds _A[j,i] = _A[i,j]
-              end
+                    @inbounds _A[j, i] = _A[i, j]
+                end
             end
             U_noconj!(get_backend(A))(A; ndrange = size(A))
         elseif uplo == 'L' && conjugate
@@ -181,7 +181,7 @@ else
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j > i
-                    @inbounds _A[i,j] = conj(_A[j,i])
+                    @inbounds _A[i, j] = conj(_A[j, i])
                 end
             end
             L_conj!(get_backend(A))(A; ndrange = size(A))
@@ -190,14 +190,14 @@ else
                 I = @index(Global, Cartesian)
                 i, j = Tuple(I)
                 if j > i
-                    @inbounds _A[i,j] = _A[j,i]
+                    @inbounds _A[i, j] = _A[j, i]
                 end
             end
             L_noconj!(get_backend(A))(A; ndrange = size(A))
         else
             throw(ArgumentError("uplo argument must be 'U' (upper) or 'L' (lower), got $uplo"))
         end
-        A
+        return A
     end
 
 end
diff --git a/test/testsuite/linalg.jl b/test/testsuite/linalg.jl
index 8bd98c7..a1459a4 100644
--- a/test/testsuite/linalg.jl
+++ b/test/testsuite/linalg.jl
@@ -81,8 +81,8 @@
                         continue
                     end
                     n = 128
-                    areal = randn(n,n)/2
-                    aimg  = randn(n,n)/2
+                    areal = randn(n, n) / 2
+                    aimg = randn(n, n) / 2
                     a = convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal)
                     @test compare(x -> LinearAlgebra.copytri!(x, uplo, conjugate, diag), AT, a)
                 end
@@ -93,8 +93,8 @@
                         continue
                     end
                     n = 128
-                    areal = randn(n,n)/2
-                    aimg  = randn(n,n)/2
+                    areal = randn(n, n) / 2
+                    aimg = randn(n, n) / 2
                     a = convert(Matrix{eltya}, eltya <: Complex ? complex.(areal, aimg) : areal)
                     @test compare(x -> LinearAlgebra.copytri!(x, uplo, conjugate), AT, a)
                 end

@eschnett
Copy link
Author

I think runic's indentation is wrong. Look at these lines:

        I = @index(Global, Cartesian)
        i, j = Tuple(I)
            if j + diag > i
          @inbounds _A[j,i] = conj(_A[i,j])
        end

The if statement is spuriously indented too far.

@maleadt
Copy link
Member

maleadt commented Jan 20, 2026

Yeah feel free to ignore Runic...

@maleadt
Copy link
Member

maleadt commented Jan 20, 2026

Can you add 1.13-nightly to the GH:A configuration too?

Also, this seems to break CUDA.jl etc tests on <1.13:

Testing finished in 40 minutes, 23 seconds, 298 milliseconds
2026-01-19 22:24:29 CEST
	Worker 3 failed running test gpuarrays/linalg/core:
2026-01-19 22:24:29 CEST
	Some tests did not pass: 420 passed, 0 failed, 8 errored, 0 broken.
2026-01-19 22:24:29 CEST
	gpuarrays/linalg/core: Error During Test at /var/lib/buildkite-agent/builds/gpuci-17/julialang/gpuarrays-dot-jl/test/testsuite/linalg.jl:86
2026-01-19 22:24:30 CEST
	  Test threw exception
2026-01-19 22:24:30 CEST
	  Expression: compare((x->begin
2026-01-19 22:24:30 CEST
	            #= /var/lib/buildkite-agent/builds/gpuci-17/julialang/gpuarrays-dot-jl/test/testsuite/linalg.jl:86 =#
2026-01-19 22:24:30 CEST
	            LinearAlgebra.copytri!(x, uplo, conjugate, diag)
2026-01-19 22:24:30 CEST
	        end), AT, a)
2026-01-19 22:24:30 CEST
	  KernelException: exception thrown during kernel execution on device Quadro RTX 5000

@eschnett
Copy link
Author

We're going to need to ignore the Buildkite error at the moment. It fails because CUDA.jl isn't working with Julia 1.13. That's a known problem, and a prerequisite for making it work is making GPUArrays.jl work with Julia 1.13...

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.

2 participants