You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9223689
Browse filesBrowse the repository at this point in the historyBrowse files
Replace TensorKit cache machinery with MemoizationKit.jl (#568)
* Replace TensorKit cache machinery with MemoizationKit.jl
Track MemoizationKit.jl main through Pkg sources and delegate cache storage, container selection, and module-wide inspection and clearing to MemoizationKit. Preserve the registry for the existing GPU transformer cache and use MemoizationKit.LRU for its container.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Use MemoizationKit keys and remove duplicated cache helpers
Use MemoizationKit.Hashed and cachekey to share sector structures across degeneracy dimensions without changing the function signature. Pass fusion-tree arguments directly to MemoizationKit, retaining the braiding result annotation needed for anyonic inference.
Remove the upstream-covered Hashed tests, add TensorKit integration checks, and document native cache configuration and optional extensions.
* Integrate MemoizationKit timers with TensorKit profiling
Enable and disable MemoizationKit instrumentation with TensorKit timers, using the shared timer and existing profiling categories.
Verify lookup and computation sections are recorded and that disabling timers stops recording.
* Measure TensorKit cached values by buffer sizes
* Switch to registered MemoizationKit.jl
Cached.jl was registered as MemoizationKit.jl under QuantumKitHub; depend on
the registered release and drop the `[sources]` entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Address review: descriptive cache names and transpose inference
- Rename `fsbraid`/`fstranspose` to `fusiontreebraid`/`fusiontreetranspose`, as these
are now user-facing through the MemoizationKit APIs and dashboard.
- Restore the return type annotation on `fusiontreetranspose`, without which the
`FusionTreePair` path infers `Any` and the cache stores untyped values.
- Update the Enzyme inactivity rule for the new three-argument `fusiontreebraid`.
- Refer to the MemoizationKit documentation for further features.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Drop the extra cache registry now that extension caches are owned by TensorKit
The GPU transformers are cached through `@cached` methods of `treebraider` and
`treetransposer`, which share TensorKit's caches. These are inspected, emptied and timed
through MemoizationKit, so the separate `GLOBAL_CACHES` registry is no longer needed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Use renamed fusiontreetranspose in Enzyme rules, unicode subscripts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Cache device transformers in separate functions
`treebraider` and `treetransposer` forward device storage types to `device_treebraider`
and `device_treetransposer`, whose methods are added by the GPU extension. These have
their own MemoizationKit cache, so their size can be configured separately from the
host transformers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Require MemoizationKit v0.1.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Ignore JET's uncorrelated union split in the tree transformer bodies
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Require MemoizationKit v0.1.2 and drop the tree transformer JET ignores
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Cache the diagonal device transformers with the other device transformers
The diagonal transformers of the GPU extension become methods of
`device_treebraider` and `device_treetransposer`, so their cache is owned by
TensorKit and handled by `empty_globalcaches!` and `global_cache_info`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Clear TensorKit's caches before each test
Workers run many test files in turn, and the caches filled by one would otherwise
stay alive for the rest of the run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Cache the device tracers and twisters in TensorKit-owned functions
`treetracer` and `treetwister` on device storage forward to `device_treetracer` and
`device_treetwister`, whose caches belong to TensorKit, are sized independently of the
host ones and are cleared by `empty_globalcaches!`. The diagonal twister shares that cache,
and `TraceTransformer`s are measured like the generic tree transformers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Address review: trim tests and changelog, show the cache dashboard
Drop the unused `LRU` import, the internal device-cache changelog entry, the CUDA test of
the separate device caches and the timer section assertions, and add a preview of the
MemoizationKit cache dashboard to the manual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Clear the caches after each space in the DiagonalTensorMap tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/src/Changelog.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ When releasing a new version, move the "Unreleased" changes to a new version sec
29
29
### Changed
30
30
31
31
-`planartrace!` precomputes and caches a `TraceTransformer` with the subblock positions and recoupling coefficients, and executes it with a kernel shared by all sectortypes, analogous to the index manipulations; `planar_trace` is now also defined for `FusionTreeBlock`s, and GPU tensors use a dedicated kernel (internal)
32
+
- Caching is provided by [MemoizationKit.jl](https://github.com/QuantumKitHub/MemoizationKit.jl), which can inspect, resize and configure TensorKit's caches, also by memory size; this replaces the internal `@cached` machinery and the LRUCache.jl dependency
Copy file name to clipboardExpand all lines: docs/src/man/fusiontrees.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -260,7 +260,49 @@ This is simply given by
260
260
261
261
The `braid` and `permute` routines for double fusion trees will be the main access point for corresponding manipulations on tensors.
262
262
As a consequence, results from these routines are memoized via a `@cached` mechanism.
263
-
The caching strategy is controlled by `CacheStyle`: for `FusionStyle(I) isa UniqueFusion` no caching is used (`NoCache()`), since the result is a single cheap scalar coefficient; for `MultipleFusion` or `GenericFusion` sectors, a global LRU cache (`GlobalLRUCache()`) is used, as computing the transformation matrix can be expensive and results are reused frequently.
263
+
The caching strategy is controlled by `MemoizationKit.CacheStyle`: for `FusionStyle(I) isa UniqueFusion` no caching is used (`NoCache()`), since the result is a single cheap scalar coefficient; for `MultipleFusion` or `GenericFusion` sectors, `GlobalCache()` uses MemoizationKit.jl's configured container (ClockCache by default), as computing the transformation matrix can be expensive and results are reused frequently.
264
+
265
+
TensorKit also uses MemoizationKit.jl for sector structures, degeneracy structures and fusion tree transformers.
266
+
Sector structures share cache entries across spaces with the same sectors, even if their degeneracy dimensions differ, through `MemoizationKit.cachekey`.
267
+
The MemoizationKit APIs can inspect, resize and configure these caches:
Preferences are saved in `LocalPreferences.toml` and apply after restarting Julia; a runtime size change applies immediately.
279
+
`MemoizationKit.uncached(f, args...)` computes a result without consulting or filling the cache.
280
+
TensorKit supplies efficient `MemoizationKit.cachesize` methods for its structure, fusion-tree and transformer results.
281
+
These estimate bytes from the fixed-size fields and live array buffers; matrix coefficients and inline sector values are not traversed individually.
282
+
Reference-containing scalar or sector arrays fall back to `Base.summarysize`.
283
+
Buffers shared between cache entries count toward each entry, while identical source and destination structure buffers within a transformer count once.
284
+
The budget excludes cache keys, container and allocation overhead, and spare array capacity; it is a cached-value estimate rather than a limit on total process memory.
285
+
Further features, such as the live cache dashboard, disk caching and the full configuration options, are described in the [MemoizationKit.jl documentation](https://quantumkithub.github.io/MemoizationKit.jl/stable/).
286
+
287
+
For example, `using Tachikoma; MemoizationKit.cache_dashboard()` shows the hit rates and sizes of TensorKit's caches live, here after a few index manipulations on tensors with different symmetries:
⇥ tab ↑↓ select ⏎ resize e empty s sort r reverse / filter g refresh q quit
305
+
```
264
306
265
307
This caching implies that potential inefficiencies in the fusion tree manipulations (which we nonetheless try to avoid) will not seriously affect performance of tensor manipulations.
Copy file name to clipboardExpand all lines: docs/src/man/profiling.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# [Profiling and timers](@id s_profiling)
2
2
3
3
TensorKit's index manipulations, tensor contractions and factorizations are instrumented with [TimerOutputs.jl](https://github.com/KristofferC/TimerOutputs.jl) sections that are compiled away by default, so they incur no runtime cost.
4
+
Enabling TensorKit's timers also enables MemoizationKit.jl's cache lookup and computation timers, recorded in the same timer tree and categories.
4
5
They can be enabled to obtain a detailed breakdown of where time is spent inside these operations, in particular the split between the different kinds of work involved in manipulating symmetric tensors:
0 commit comments