Skip to content

Reverse/forward Enzyme rules, refactoring, and tests for planar ops - #474

Merged
kshyatt merged 6 commits into
mainfrom
ksh/enz_planar
Jul 29, 2026
Merged

kshyatt merged 6 commits into
mainfrom
ksh/enz_planar

Conversation

@kshyatt

@kshyatt kshyatt commented Jul 6, 2026

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 29.41176% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ext/TensorKitEnzymeExt/utility.jl 7.69% 12 Missing ⚠️
Files with missing lines Coverage Δ
ext/TensorKitEnzymeExt/linalg.jl 74.01% <100.00%> (+0.88%) ⬆️
ext/TensorKitMooncakeExt/TensorKitMooncakeExt.jl 100.00% <ø> (ø)
ext/TensorKitMooncakeExt/utility.jl 100.00% <ø> (ø)
src/TensorKit.jl 17.24% <ø> (ø)
ext/TensorKitEnzymeExt/utility.jl 20.93% <7.69%> (-0.70%) ⬇️

... and 1 file 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 force-pushed the ksh/enz_planar branch 2 times, most recently from 2559062 to 239ac56 Compare July 13, 2026 11:12
@kshyatt

kshyatt commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Marking FusionTreeDict inactive seems to have helped, now the errors are all in the situation of the more complex braidings. Time to investigate more 🤓

@kshyatt kshyatt changed the title Reverse Enzyme rules, refactoring, and tests for planar ops Reverse/forward Enzyme rules, refactoring, and tests for planar ops Jul 27, 2026
@kshyatt

kshyatt commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

OK so some digging seems to show the error for VfHubbard and VRepA4Twistedℤ₄ is arising from the coefficient * alpha going into tensortrace!, a path that is only reached for these more complicated spaces. I've tried a bunch of things -- caching doesn't seem to be the culprit -- but still pretty mystified. Basically, it seems one subblock is getting the wrong coefficient on the reverse pass. If anyone has any ideas, chime in!

@kshyatt
kshyatt force-pushed the ksh/enz_planar branch 2 times, most recently from b55b70f to b61bcaf Compare July 28, 2026 13:23
@kshyatt
kshyatt requested a review from lkdvos July 28, 2026 13:23
@kshyatt
kshyatt marked this pull request as ready for review July 29, 2026 09:27

@lkdvos lkdvos left a comment

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.

Some minor comments, but otherwise this looks llike a nice cleanup!

Comment thread ext/TensorKitEnzymeExt/linalg.jl Resolved
Comment thread ext/TensorKitEnzymeExt/linalg.jl Resolved
Comment thread ext/TensorKitEnzymeExt/utility.jl Resolved
Comment thread ext/TensorKitEnzymeExt/utility.jl Resolved
Comment thread ext/TensorKitEnzymeExt/linalg.jl Resolved

@lkdvos lkdvos left a comment

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.

Will already approve, but have 1 final comment left

@kshyatt
kshyatt enabled auto-merge (squash) July 29, 2026 17:05
@kshyatt
kshyatt merged commit e852e6a into main Jul 29, 2026
98 of 99 checks passed
@kshyatt
kshyatt deleted the ksh/enz_planar branch July 29, 2026 19:52
@lkdvos lkdvos mentioned this pull request Sep 20, 2026
lkdvos referenced this pull request Sep 21, 2026
* Draft changelog for v0.17.2

Consolidates the Unreleased section (which already included the real
entries added by #526/#532 on merge) with entries for the remaining
PRs merged since v0.17.1 (#487-#535), and retitles it as 0.17.2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Bump version to v0.17.2

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix confirmed small bugs from the pre-release audit

- isunitspace: require dim(V) == 1 for GenericUnit sectors (#537)
- GradedSpace ⊕/supremum: check unit homogeneity of the result (#538)
- isconj(::ComplexSpace): return isdual(V) instead of always true (#539)
- multi_associator: return a vector, not a scalar, on early-exit for
  GenericFusion (#540)
- split(f, 0): use leftunit(f.coupled) instead of indexing an empty
  uncoupled tuple (#541)
- repartition: return a Pair in the identity branch, matching every
  other branch (#542)
- Mooncake scalar_pullback: accumulate into the tangent instead of
  overwriting it (#543)
- rand/randn/randexp/randisometry(rng, T, space): fix one(domain) typo (#544)
- pinv(::DiagonalTensorMap): fix inverted atol/rtol defaulting and
  empty-tensor throw (#545)
- t1 / t2: promote to a float scalartype, matching t1 \ t2 (#546)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add changelog entry for the audit bugfixes

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address fable review findings on the audit bugfixes

- split(f, 0): also guard innerlines_extended construction, which
  still indexed the empty uncoupled tuple for a 0-leg tree
- pinv(::DiagonalTensorMap): use eps (not sqrt(eps)) for the default
  rtol, matching _default_rtol's convention and dense LinearAlgebra.pinv

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address tuicr review comments on the audit bugfixes

- pinv(::DiagonalTensorMap): reuse _default_rtol instead of
  duplicating its formula
- Add regression tests for split(f, 0) on a genuine 0-leg tree and
  for multi_associator's early-exit branch on a GenericFusion sector

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix planar issues after MPSKit test rerun

* harden Mooncake scalar pullback

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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