Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
lkdvos
force-pushed
the
ld-copy-subblocks
branch
from
October 4, 2026 01:05
a45e397 to
b290485
Compare
`_copy_subblocks!` looped over the fusion-tree blocks of the destination and read every nonzero block of the source with `v[f₁, f₂]`, which goes through TensorKit's lock-protected `degeneracystructure` cache on each call: (#fusion trees) × (#nonzero blocks) cache hits. It now iterates the source blocks with `subblocks(v)` and indexes a single `subblocks(tdst)` iterator by fusion-tree pair, so the structure is looked up once per tensor. The block ranges come from per-leg cumulative dimensions computed once, instead of a `blockedrange` per subblock. Bump version to v0.3.20. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lkdvos
force-pushed
the
ld-copy-subblocks
branch
from
October 4, 2026 01:23
b290485 to
0ab79d4
Compare
This branch has not been deployed
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.
_copy_subblocks!(used when converting a block tensor to a denseTensorMap, e.g. MPSKit's_fuse_envwhen preparing effective Hamiltonians) looped over every fusion-tree block of the destination and, for each, over every nonzero block of the source, reading it asv[f₁, f₂]. Each of those reads goes throughsubblockstructure→degeneracystructure, i.e. TensorKit's globalLRUCachebehind a lock, so the copy did (#fusion trees) × (#nonzero blocks) cache lookups.This PR
subblocks(v)and indexes a singlesubblocks(tdst)iterator by fusion-tree pair, so each tensor's structure is looked up once;blockedrangeper destination subblock.Benchmark: copying the left environment × MPO block tensor of an N₂/cc-pVDZ DMRG2 step (D = 300, U₁×SU₂×fℤ₂, 416 nonzero blocks, 931 fusion-tree blocks in the dense result), single-threaded BLAS, results identical:
The concurrent case is where the lock contention showed up: with several tasks preparing environments, the old version spent most of its time waiting on the cache's
SpinLock.Also bumps the version to v0.3.20. Full test suite passes locally (Julia 1.11.2).
🤖 Generated with Claude Code