Skip to content

Redo add_transform! for GPU backed Tensors to be much, much faster - #509

Open
kshyatt wants to merge 2 commits into
mainfrom
ksh/add_transform
Open

Redo add_transform! for GPU backed Tensors to be much, much faster #509
kshyatt wants to merge 2 commits into
mainfrom
ksh/add_transform

Conversation

@kshyatt

@kshyatt kshyatt commented Aug 18, 2026

Copy link
Copy Markdown
Member

Should close #508

The short version of what I've done here is rework add_transform! into two kernels with associated helper structures, one for the Abelian case (which is quite simple) and one for the more generic case. Instead of parallelizing over the blocks, which are of pretty different sizes, I parallelize over the output data in data_dst. This means a lot more annoying bookkeeping but also a much more uniform workload across the GPU and better usage of the large number of available threads. There are still probably some performance optimizations to be done but I thought this was a) already hard enough to understand and b) pretty compelling!

Here are the results for the sample script I linked in the issue above, on an AMD MI210:

GPU permute time (ms)

case trees elems bytes main ksh/add_transform speedup
SU2 iPEPO tensor 42 329 2.6 KiB 1.915 0.033 58×
trivial symmetry 1 9604 75.0 KiB 0.022 0.020 1.1×
SU2 jmax=1 42 672 5.3 KiB 1.964 0.033 60×
SU2 jmax=2 323 5168 40.4 KiB 13.818 0.034 406×
SU2 jmax=3 1364 21824 170.5 KiB 53.537 0.046 1164×
U1 70 2226 17.4 KiB 1.064 0.020 53×

Cost per fusion tree (GPU, µs/tree)

case trees main ksh/add_transform
SU2 iPEPO tensor 42 45.6 0.79
SU2 jmax=1 42 46.8 0.79
SU2 jmax=2 323 42.8 0.105
SU2 jmax=3 1364 39.2 0.034
U1 70 15.2 0.29

So this should hopefully finally let people doing complicated stuff (e.g. anything involving SU(2)) really benefit from the GPU. All the tests passed for me locally.

I still have some lingering questions about where stuff should live. I added some new caches of GPU objects as well to avoid sending things back to the GPU that don't need to go, but maybe those should live in the main package?

@kshyatt
kshyatt requested a review from lkdvos August 18, 2026 12:29
@kshyatt

kshyatt commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

I'm also running the GPU branch of PEPSKit.jl against this to see how much/if it helps

@kshyatt

kshyatt commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

Well, the short story for now is it doesn't help much because nearly all the time in our PEPSKit runs is spent on the CPU (GPU utilization is quite low). I'll look into that separately but I still think this is a nice bit of progress :)

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-backed TensorMap permute! braid is extremely inefficient

1 participant