Conversation
treebraider and treetransposer for AdjointTensorMaptreebraider for AdjointTensorMap
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
lkdvos
added a commit
that referenced
this pull request
Sep 9, 2026
Index manipulations now run through a single kernel that operates on subblocks addressed by position: `StridedSubblocks` (sector-independent views into the flat data of a `TensorMap`) or `TreeSubblocks` (any `AbstractTensorMap`, through `subblock`), both carrying an optional lazy conjugation. `TreeTransformer`s store only the mapping between subblock positions and recoupling coefficients, alongside the subblock structures, and are cached for every tensor type. Adjoint sources and destinations, as well as `conj` in `tensoradd!`, are folded into a conjugation flag, relabeled permutation and levels, and conjugated scalars, so that `AdjointTensorMap` wrappers no longer force the uncached generic path (fixes #516, supersedes #519 and #520). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Member
|
Closing this in favor of #526 |
lkdvos
added a commit
that referenced
this pull request
Sep 9, 2026
Index manipulations now run through a single kernel that operates on subblocks addressed by position: `StridedSubblocks` (sector-independent views into the flat data of a `TensorMap`) or `TreeSubblocks` (any `AbstractTensorMap`, through `subblock`), both carrying an optional lazy conjugation. `TreeTransformer`s store only the mapping between subblock positions and recoupling coefficients, alongside the subblock structures, and are cached for every tensor type. Adjoint sources and destinations, as well as `conj` in `tensoradd!`, are folded into a conjugation flag, relabeled permutation and levels, and conjugated scalars, so that `AdjointTensorMap` wrappers no longer force the uncached generic path (fixes #516, supersedes #519 and #520). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lkdvos
added a commit
that referenced
this pull request
Sep 15, 2026
Index manipulations now run through a single kernel that operates on subblocks addressed by position: `StridedSubblocks` (sector-independent views into the flat data of a `TensorMap`) or `TreeSubblocks` (any `AbstractTensorMap`, through `subblock`), both carrying an optional lazy conjugation. `TreeTransformer`s store only the mapping between subblock positions and recoupling coefficients, alongside the subblock structures, and are cached for every tensor type. Adjoint sources and destinations, as well as `conj` in `tensoradd!`, are folded into a conjugation flag, relabeled permutation and levels, and conjugated scalars, so that `AdjointTensorMap` wrappers no longer force the uncached generic path (fixes #516, supersedes #519 and #520). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lkdvos
added a commit
that referenced
this pull request
Sep 16, 2026
Index manipulations now run through a single kernel that operates on subblocks addressed by position: `StridedSubblocks` (sector-independent views into the flat data of a `TensorMap`) or `TreeSubblocks` (any `AbstractTensorMap`, through `subblock`), both carrying an optional lazy conjugation. `TreeTransformer`s store only the mapping between subblock positions and recoupling coefficients, alongside the subblock structures, and are cached for every tensor type. Adjoint sources and destinations, as well as `conj` in `tensoradd!`, are folded into a conjugation flag, relabeled permutation and levels, and conjugated scalars, so that `AdjointTensorMap` wrappers no longer force the uncached generic path (fixes #516, supersedes #519 and #520). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lkdvos
added a commit
that referenced
this pull request
Sep 17, 2026
Index manipulations now run through a single kernel that operates on subblocks addressed by position: `StridedSubblocks` (sector-independent views into the flat data of a `TensorMap`) or `TreeSubblocks` (any `AbstractTensorMap`, through `subblock`), both carrying an optional lazy conjugation. `TreeTransformer`s store only the mapping between subblock positions and recoupling coefficients, alongside the subblock structures, and are cached for every tensor type. Adjoint sources and destinations, as well as `conj` in `tensoradd!`, are folded into a conjugation flag, relabeled permutation and levels, and conjugated scalars, so that `AdjointTensorMap` wrappers no longer force the uncached generic path (fixes #516, supersedes #519 and #520). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lkdvos
added a commit
that referenced
this pull request
Sep 20, 2026
…#526) * Refactor index manipulation kernels around position-indexed subblocks Index manipulations now run through a single kernel that operates on subblocks addressed by position: `StridedSubblocks` (sector-independent views into the flat data of a `TensorMap`) or `TreeSubblocks` (any `AbstractTensorMap`, through `subblock`), both carrying an optional lazy conjugation. `TreeTransformer`s store only the mapping between subblock positions and recoupling coefficients, alongside the subblock structures, and are cached for every tensor type. Adjoint sources and destinations, as well as `conj` in `tensoradd!`, are folded into a conjugation flag, relabeled permutation and levels, and conjugated scalars, so that `AdjointTensorMap` wrappers no longer force the uncached generic path (fixes #516, supersedes #519 and #520). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * blockiterator->blockiterators * clean up trivial symmetry bypassing overhead * Address review: normalize subblock parent, prime conjsrc `StridedSubblocks` now stores its data the way `StridedView` parents it (an `Array` becomes its underlying `Memory` on Julia >= 1.11), asking `StridedView` itself rather than reproducing that rule. This makes the view type a direct function of the type parameters, so `eltype` can be written out instead of going through `Core.Compiler.return_type`. As a consequence `storagetype` reports the normalized type, which is not an `Array`, so the CPU branch of `_adapt_recoupling` is keyed on a `CPUStorage` alias to keep the recoupling matrices off the `Adapt` path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Test fix: pick a multifusion-compatible space for the isometry test `V1 ⊗ V2 ← V3 ⊗ V4` does not close the unit cycle that `GenericUnit` sectors require, so constructing it threw a `SpaceMismatch` for the `IsingBimodule` space lists. The sibling `Permutations: adjoint operands` testset never hit this because it sits behind `symmetricbraiding`, which is false for multifusion; this one builds its space unconditionally. `V1 ⊗ V5 ← V2 ⊗ V4` does close the cycle, and is equally general for the other sectors, so use that rather than skipping multifusion: the transpose half of the test then covers them too, while the braid half stays behind `hasbraiding` (multifusion is `NoBraiding`). Only Windows and macOS saw this, since `default_spacelist` hands out different space lists per OS on CI and only those two include the multifusion entries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * reorganize to fix docstring * simplify getting number of transformer_threads * mark `add_transform` as non-public * fix (unrelated) docstring sentence * all has_array_view * clamp -> min * docstring improvements * simplify treetransformer implementations * Rename `AbelianTreeTransformer` to `UniqueTreeTransformer` "Abelian" is ambiguous for sectors: it can refer either to the fusion of two sectors having a unique result, or to the commutativity of the fusion rules. The transformer is selected on `FusionStyle(I) == UniqueFusion()`, so name it after that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Pass conjugation as a flag instead of a subblock view op `StridedSubblocks` and `TreeSubblocks` no longer apply `identity`/`conj` to every view. Instead `conjsrc` is threaded through `add_transform_kernel!` into `_add_transform_block!`, where it is handed to `TO.tensoradd!` as its `conjA` argument, at the single-tree call and when packing a multi-tree block. This drops a type parameter from both collections, so the kernel compiles to one instance per (storage, numind) rather than one per conjugation. The runtime flag is free: `flag2op` is union-split, and `conj` of a real-eltype `StridedView` is a type-level no-op, which also makes the previous `scalartype(t) <: Real` guard redundant. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * remove TreeSubblocks and route through StridedSubblocks --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One option for a proper fix for #516, adding a dedicated cached
conj_treebraiderto handle permutations and transposes ofAdjointTensorMaps with a plainTensorMapparent using the same infrastructure as the pureTensorMappath.Some timings based on the reproducer of #516:
permute!— adjoint source vs plainTensorMap:Allocations for the adjoint path drop to exactly the plain path's: 794→310, 662→310, 26 883→2840, 42 653→645.