Skip to content

GPU-friendly truncation implementations#349

Merged
lkdvos merged 30 commits into
mainfrom
ld-truncation
Jan 28, 2026
Merged

GPU-friendly truncation implementations#349
lkdvos merged 30 commits into
mainfrom
ld-truncation

Conversation

@lkdvos

@lkdvos lkdvos commented Jan 8, 2026

Copy link
Copy Markdown
Member

This is an attempt to get rid of the scalar-indexing oriented approach, and instead do more global operations.

The main point is to take all the singular/eigen values at the same time, and sort them in their entirety.

@codecov

codecov Bot commented Jan 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.26214% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/tensors/sectorvector.jl 50.00% 4 Missing ⚠️
src/factorizations/adjoint.jl 75.00% 3 Missing ⚠️
ext/TensorKitCUDAExt/truncation.jl 96.77% 1 Missing ⚠️
src/factorizations/truncation.jl 98.03% 1 Missing ⚠️
Files with missing lines Coverage Δ
ext/TensorKitCUDAExt/TensorKitCUDAExt.jl 100.00% <ø> (ø)
src/factorizations/diagonal.jl 72.72% <100.00%> (+6.06%) ⬆️
ext/TensorKitCUDAExt/truncation.jl 96.77% <96.77%> (ø)
src/factorizations/truncation.jl 94.37% <98.03%> (+6.44%) ⬆️
src/factorizations/adjoint.jl 73.07% <75.00%> (-1.35%) ⬇️
src/tensors/sectorvector.jl 40.57% <50.00%> (-7.81%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Jutho

Jutho commented Jan 12, 2026

Copy link
Copy Markdown
Member

I think that implementation is very clean. Not sure I can explain all the errors. Some seem to originate from the eigenvectors of a DiagonalTensorMap also being diagonal, which is being changed, right? But other errors I cannot directly explain without running the code locally.

@lkdvos

lkdvos commented Jan 12, 2026

Copy link
Copy Markdown
Member Author

I will have a look later, I have a local branch to fix the diagonal implementations already, we'll see what remains after.
I'll also try if it actually works on GPU, and get a similar implementation going for the truncerror version.

@kshyatt
kshyatt force-pushed the ld-truncation branch 2 times, most recently from 499360d to 77f0ffa Compare January 20, 2026 10:27
@kshyatt

kshyatt commented Jan 22, 2026

Copy link
Copy Markdown
Member

I think this one still needs a little work to get it over the finish line, but then we should be able to really try CUDA with the TNR and PEPS stuff

@github-actions

github-actions Bot commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

Your PR no longer requires formatting changes. Thank you for your contribution!

@lkdvos

lkdvos commented Jan 22, 2026

Copy link
Copy Markdown
Member Author

wait please don't I'm working on this 😆

@kshyatt

kshyatt commented Jan 22, 2026

Copy link
Copy Markdown
Member

I'll stop I just wanted to fix formatting and rebase!!!

@lkdvos

lkdvos commented Jan 22, 2026

Copy link
Copy Markdown
Member Author

Hahah but the rebase screws up the git history, now I gotta see how much git magic I know to fix my local branch

@kshyatt

kshyatt commented Jan 22, 2026

Copy link
Copy Markdown
Member

Oh no I'm sorry!

Comment thread ext/TensorKitCUDAExt/truncation.jl
Comment thread ext/TensorKitCUDAExt/truncation.jl
Comment thread src/factorizations/adjoint.jl
Comment thread src/factorizations/adjoint.jl
Comment thread src/factorizations/adjoint.jl
Comment thread src/factorizations/truncation.jl Outdated
kshyatt
kshyatt previously approved these changes Jan 27, 2026

function MatrixAlgebraKit.findtruncated(
values::CuSectorVector, strategy::MatrixAlgebraKit.TruncationByError
)

@Jutho Jutho Jan 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs to be special cased for p == Inf, if we want to support this. That in itself should be quite an easy case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked, and at least in MatrixAlgebraKit we are currently not supporting this. While I don't necessarily have any strong opinions in favor or against this, I will for now simply add a check and leave this as TBA?

Comment thread src/factorizations/truncation.jl Outdated
Comment thread src/factorizations/truncation.jl Outdated
Comment thread src/factorizations/truncation.jl Outdated
@lkdvos

lkdvos commented Jan 28, 2026

Copy link
Copy Markdown
Member Author

@kshyatt Do you have any clue why the CUDA tests could be giving segfaults? Is this something I caused or are we running into a different issue?

Otherwise I think this PR is ready to get merged, would be great to get this done.

@lkdvos
lkdvos requested review from Jutho and kshyatt January 28, 2026 16:01
@kshyatt

kshyatt commented Jan 28, 2026

Copy link
Copy Markdown
Member

CUDA 12 sometimes freaks out due to bad LLVM, I retried the build

@lkdvos
lkdvos enabled auto-merge (squash) January 28, 2026 17:42
@lkdvos
lkdvos merged commit 25372cb into main Jan 28, 2026
42 checks passed
@lkdvos
lkdvos deleted the ld-truncation branch January 28, 2026 17:49
@lkdvos lkdvos mentioned this pull request Feb 4, 2026
Jutho referenced this pull request Feb 6, 2026
* bump v0.16.1

* update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU + truncation support collation issue

3 participants