Skip to content

Commit f45ab42

Browse files
committed
insert allocator checkpoints/resets
1 parent 5ecad52 commit f45ab42

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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)