Skip to content

Commit 4911dc4

Browse files
committed
insert allocator checkpoints/resets
1 parent 8b82dac commit 4911dc4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎Project.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Random = "1"
5555
ScopedValues = "1.3.0"
5656
Strided = "2"
5757
TensorKitSectors = "0.3.7"
58-
TensorOperations = "5.1"
58+
TensorOperations = "5.5"
5959
TupleTools = "1.5"
6060
VectorInterface = "0.4.8, 0.5"
6161
cuTENSOR = "2"

‎src/tensors/indexmanipulations.jl‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ function add_transform_kernel!(
589589
)
590590
end
591591
else
592+
cp = TO.allocator_checkpoint!(allocator)
592593
# Non-Abelian fusion: trees sharing the same set of uncoupled (external) sectors
593594
# form a *fusion block* and mix under the transformation via a recoupling matrix U
594595
# (rows = destination trees, columns = source trees). We iterate over blocks.
@@ -633,6 +634,7 @@ function add_transform_kernel!(
633634
TO.tensorfree!(buffer, allocator)
634635
end
635636
end
637+
TO.allocator_reset!(allocator, cp)
636638
end
637639
return nothing
638640
end
@@ -663,6 +665,7 @@ function add_transform_kernel!(
663665
# U — recoupling matrix (rows = dst trees, cols = src trees)
664666
# sz_{dst,src} — array shape of each block (same for all trees in the block)
665667
# structs_{dst,src}[i] — (offset, strides) into the flat data vector for tree i
668+
cp = TO.allocator_checkpoint!(allocator)
666669
tforeach(transformer.data; scheduler) do (U, (sz_dst, structs_dst), (sz_src, structs_src))
667670
if length(U) == 1
668671
# Degenerate block with a single tree: no matmul needed.
@@ -706,5 +709,6 @@ function add_transform_kernel!(
706709
TO.tensorfree!(buffer, allocator)
707710
end
708711
end
712+
TO.allocator_reset!(allocator, cp)
709713
return nothing
710714
end

0 commit comments

Comments
 (0)