Skip to content

Add integration test for MatrixAlgebraKit#2935

Open
kshyatt wants to merge 15 commits into
mainfrom
ksh/mak_int
Open

Add integration test for MatrixAlgebraKit#2935
kshyatt wants to merge 15 commits into
mainfrom
ksh/mak_int

Conversation

@kshyatt
Copy link
Copy Markdown
Collaborator

@kshyatt kshyatt commented Jan 27, 2026

We have a bunch of Enzyme rules over there that absolutely love to break and generate weird errors

@giordano
Copy link
Copy Markdown
Member

Missed to push some files?

@kshyatt
Copy link
Copy Markdown
Collaborator Author

kshyatt commented Jan 27, 2026

Yep working on it now

@wsmoses
Copy link
Copy Markdown
Member

wsmoses commented Jan 31, 2026

its still missing?

@kshyatt
Copy link
Copy Markdown
Collaborator Author

kshyatt commented Jan 31, 2026

Sorry yes will push soon! Got distracted with another thing I'm working on 😓

@wsmoses
Copy link
Copy Markdown
Member

wsmoses commented May 9, 2026

bump @kshyatt

@kshyatt
Copy link
Copy Markdown
Collaborator Author

kshyatt commented May 27, 2026

We just had all our tests at MAK break (hmm...) so I'll try this again. Is there a way we could somehow use the existing ParallelTestRunner setup for MAK in these integration tests (e.g. dev MAK and just run its Enzyme tests)?

@kshyatt
Copy link
Copy Markdown
Collaborator Author

kshyatt commented May 28, 2026

@wsmoses Look ok now?

EnzymeCore = {path = "../../../lib/EnzymeCore"}

[compat]
FiniteDifferences = "0.12.32"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should pin the exact version of matrix algebra kit

@@ -0,0 +1,4 @@
using Test, Pkg

Pkg.develop("MatrixAlgebraKit")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is possible, but really not desirable here since it isn't in any way actinoable from our side to debug/test if it fails -- what would be better is having some code which ideally directly calls enzyme

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I didn't do that right out of the gate is we have a LOT of code which directly calls enzyme and which various parts of have failed in the past 😅. But I'll see if I can whittle something down to start

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, imo here the reason is a maintainability/actionability thing -- such that if the test fails, can an enzyme person who has no idea what your code is, figure it out. Because if they can't and we let the test fail [and merge], the integration test isn't as useful

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I'll try to bring over stuff that doesn't require all our setup logic for the input derivatives

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

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

Click here to view the suggested changes.
diff --git a/test/integration/MatrixAlgebraKit/runtests.jl b/test/integration/MatrixAlgebraKit/runtests.jl
index 81568730..47f5eb15 100644
--- a/test/integration/MatrixAlgebraKit/runtests.jl
+++ b/test/integration/MatrixAlgebraKit/runtests.jl
@@ -17,7 +17,7 @@ structured_randn!(A::Diagonal) = (randn!(diagview(A)); return A)
 instantiate_matrix(::Type{T}, size) where {T <: Number} = randn(rng, T, size)
 instantiate_matrix(::Type{AT}, size) where {AT <: Diagonal} = Diagonal(randn(rng, eltype(AT), size))
 
-@testset "lq" for T in (Float64, ComplexF64), sz in ((19, 17), (19, 19), (19, 23)) 
+@testset "lq" for T in (Float64, ComplexF64), sz in ((19, 17), (19, 19), (19, 23))
     A = instantiate_matrix(T, sz)
     m, n = sz
     atol = m * n * precision(T)
@@ -40,7 +40,7 @@ instantiate_matrix(::Type{AT}, size) where {AT <: Diagonal} = Diagonal(randn(rng
     end
 end
 
-@testset "qr" for T in (Float64, ComplexF64), sz in ((19, 17), (19, 19), (19, 23)) 
+@testset "qr" for T in (Float64, ComplexF64), sz in ((19, 17), (19, 19), (19, 23))
     A = instantiate_matrix(T, sz)
     alg = MatrixAlgebraKit.select_algorithm(qr_compact, A)
     m, n = sz
@@ -51,7 +51,7 @@ end
     MatrixAlgebraKit.remove_lq_gauge_dependence!(ΔQR..., A, QR...)
     test_reverse(qr_compact, Duplicated, (A, Duplicated), (alg, Const); atol, rtol, output_tangent = ΔQR)
     test_reverse(call_and_zero!, Duplicated, (qr_compact!, Const), (A, Duplicated), (alg, Const); atol, rtol, output_tangent = ΔQR)
-    
+
     if sz[1] == sz[2]
         A = instantiate_matrix(Diagonal{T}, sz)
         alg = MatrixAlgebraKit.select_algorithm(qr_compact, A)
@@ -63,7 +63,7 @@ end
     end
 end
 
-@testset "svd" for T in (Float64, ComplexF64), sz in ((19, 17), (19, 19), (19, 23)) 
+@testset "svd" for T in (Float64, ComplexF64), sz in ((19, 17), (19, 19), (19, 23))
     A = instantiate_matrix(T, sz)
     m, n = sz
     atol = m * n * precision(T)

@wsmoses
Copy link
Copy Markdown
Member

wsmoses commented Jun 4, 2026

svd: Error During Test at /__w/Enzyme.jl/Enzyme.jl/test/integration/MatrixAlgebraKit/runtests.jl:66
  Got exception outside of a @test
  UndefVarError: `U` not defined
  Stacktrace:
   [1] macro expansion
     @ /__w/Enzyme.jl/Enzyme.jl/test/integration/MatrixAlgebraKit/runtests.jl:73 [inlined]
   [2] macro expansion
     @ /__w/_tool/julia/1.10.11/x64/share/julia/stdlib/v1.10/Test/src/Test.jl:1674 [inlined]
   [3] top-level scope
     @ /__w/Enzyme.jl/Enzyme.jl/test/integration/MatrixAlgebraKit/runtests.jl:1697
Test Summary: | Error  Total  Time
svd           |     1      1  0.9s
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /__w/Enzyme.jl/Enzyme.jl/test/integration/MatrixAlgebraKit/runtests.jl:66

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants