Skip to content

Comments

Mooncake testsuite refactor#175

Open
lkdvos wants to merge 22 commits intomainfrom
ld-mooncaketests
Open

Mooncake testsuite refactor#175
lkdvos wants to merge 22 commits intomainfrom
ld-mooncaketests

Conversation

@lkdvos
Copy link
Member

@lkdvos lkdvos commented Feb 19, 2026

This is a somewhat large refactor of the Mooncake test suite that hinges on the idea to wrap the in-place functions in such a way that they become admissible to the internal Mooncake testing framework. (Based on ideas suggested by @Jutho, thanks!)

The basic idea is that for a function f!(A, input, alg) we need to:

  1. scratch the A space to not count finite-differences results
  2. avoid generating random tangents for the input variables

I also somewhat reorganized the tests to get a slightly better overview of the mooncake tests.
Finally, this also allowed me to find some small mistakes in the mutating rules, which I have here fixed.
This is also relevant for #174 and #173.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pullbacks/qr.jl 81.81% 2 Missing ⚠️
Files with missing lines Coverage Δ
...gebraKitMooncakeExt/MatrixAlgebraKitMooncakeExt.jl 62.57% <100.00%> (+1.81%) ⬆️
src/pullbacks/qr.jl 94.80% <81.81%> (-1.09%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


# compute pullbacks
$f_pullback!(dA, Ac, DVc, dDVtrunc, ind)
$f_pullback!(dA, Ac, DV, dDVtrunc, ind)
Copy link
Member

Choose a reason for hiding this comment

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

How did this escape previous testing?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not entirely sure, but it seems like the test_pullback_match functions had some holes in the testing functionality

# compute pullbacks
svd_pullback!(dA, Ac, USVᴴc, dUSVᴴtrunc, ind)
zero!.(dUSVᴴtrunc) # since this is allocated in this function this is probably not required
svd_pullback!(dA, Ac, USVᴴ, dUSVᴴtrunc, ind)
Copy link
Member

Choose a reason for hiding this comment

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

Same question here; was this not tested before? This could not have worked.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same reply here, because the in-place functions weren't really tested very well, this slipped through the cracks

Co-authored-by: Jutho <Jutho@users.noreply.github.com>
@kshyatt
Copy link
Member

kshyatt commented Feb 23, 2026

I guess I really don't see the point of removing all the ad_*_setup functions given we'll need something similar to add support for Enzyme? Why not just keep them but allow alg to be passed?

@lkdvos
Copy link
Member Author

lkdvos commented Feb 23, 2026

@kshyatt I think all your comments are now addressed, although I think this did make me have to touch a bit more of the files 🙃

I have some remaining questions with the rank-deficient QR/LQ tests, since it seems like I don't actually have to "gauge-fix" the R or L tangents in that case. The current tests pass, even if the warnings definitely fire

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.

3 participants