Skip to content

Enzyme reverse mode rules and test for index manipulations#466

Merged
kshyatt merged 6 commits into
mainfrom
ksh/enz_ind
Jun 30, 2026
Merged

Enzyme reverse mode rules and test for index manipulations#466
kshyatt merged 6 commits into
mainfrom
ksh/enz_ind

Conversation

@kshyatt

@kshyatt kshyatt commented Jun 26, 2026

Copy link
Copy Markdown
Member

Also consolidated the pullbacks for Enzyme and Mooncake

@kshyatt kshyatt requested a review from lkdvos June 26, 2026 17:40
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.69697% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ext/TensorKitEnzymeExt/indexmanipulations.jl 93.57% 7 Missing ⚠️
Files with missing lines Coverage Δ
ext/TensorKitEnzymeExt/TensorKitEnzymeExt.jl 100.00% <ø> (ø)
ext/TensorKitMooncakeExt/indexmanipulations.jl 95.75% <100.00%> (-0.36%) ⬇️
src/TensorKit.jl 13.79% <ø> (ø)
src/pullbacks/indexmanipulations.jl 100.00% <100.00%> (ø)
ext/TensorKitEnzymeExt/indexmanipulations.jl 93.57% <93.57%> (ø)

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kshyatt

kshyatt commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

The permute fail I really cannot reproduce locally on Ubuntu and 1.10 at all... how frustrating!

@Jutho

Jutho commented Jun 30, 2026

Copy link
Copy Markdown
Member

General question: separating all these tests over different folders now causes a large number of CI jobs, some of which only take in the order of one minute. If I open one of them, the actual tests took 0.7 seconds, so that is one minute of overhead I guess to launch the CI job and set up the environment etc. Is that still efficient?

It seems useful to bundle CI jobs such that the actual launching overhead is perhaps in the order of 5 - 10 %, so jobs of about 10 - 20 minutes? Or am I overlooking something?

@kshyatt

kshyatt commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

I think now that we fixed the "reinstalling and precompiling all the packages" issue by properly using the caches, these can indeed be consolidated (previously they were each taking 30mins+). I'll do that today.

Comment thread ext/TensorKitEnzymeExt/indexmanipulations.jl Outdated
Comment thread ext/TensorKitEnzymeExt/indexmanipulations.jl Outdated
@Jutho

Jutho commented Jun 30, 2026

Copy link
Copy Markdown
Member

I think now that we fixed the "reinstalling and precompiling all the packages" issue by properly using the caches, these can indeed be consolidated (previously they were each taking 30mins+). I'll do that today.

But I guess that now the overhead is indeed "only 1 minute"; before that I assume it would have been much worse even to split up all these jobs.

@Jutho

Jutho commented Jun 30, 2026

Copy link
Copy Markdown
Member

This looks good, but I am still surprised that we even need to define rules for flip and insert/remove unit, which are not difficult but also not entirely straightforward with the copy kwarg etc. I would think this is exactly where Mooncake and Enzyme would have made our life easier.

@kshyatt

kshyatt commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

I think Enzyme must have made some internal fixes too. Previously they had to be split up because even after the package compilation was done, the tests themselves took 45+ mins each which exceeded the timeout.

@kshyatt

kshyatt commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

This looks good, but I am still surprised that we even need to define rules for flip and insert/remove unit, which are not difficult but also not entirely straightforward with the copy kwarg etc. I would think this is exactly where Mooncake and Enzyme would have made our life easier.

I agree... I would like to try pruning these down after this goes in and seeing what minimal rule set we can get away with.

Comment thread ext/TensorKitEnzymeExt/indexmanipulations.jl
Comment thread ext/TensorKitEnzymeExt/indexmanipulations.jl Outdated
@kshyatt

kshyatt commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

As discussed on Zulip, I'm going to merge this once CI passes and then take another run at getting Enzyme and Mooncake to generate good rules themselves.

@kshyatt kshyatt enabled auto-merge (squash) June 30, 2026 20:09
@kshyatt

kshyatt commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

AMD fail can't be related, going to merge!

@kshyatt kshyatt disabled auto-merge June 30, 2026 20:52
@kshyatt kshyatt merged commit 0988e79 into main Jun 30, 2026
59 of 60 checks passed
@kshyatt kshyatt deleted the ksh/enz_ind branch June 30, 2026 20:52
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