Skip to content

Keep normalizations of GPUTensorMaps from synchronizing - #615

Open
kshyatt wants to merge 1 commit into
mainfrom
ksh/gpu_norm
Open

kshyatt wants to merge 1 commit into
mainfrom
ksh/gpu_norm

Conversation

@kshyatt

@kshyatt kshyatt commented Nov 6, 2026

Copy link
Copy Markdown
Member

Right now we're doing a roundtrip when we normalize a tensor backed by a GPU array, because norm returns a host scalar which is then copied back to the GPU for the actual normalization. This is synchronizing also. I added some generic fallbacks as well as a hook for the 2-norm since some benchmarking showed that cuBLAS.nrm2 is ~6x as fast as my fallback and avoids overflows. Once a new AMDGPU is out we can support rocBLAS.nrm2 also.

@kshyatt
kshyatt requested a review from lkdvos November 6, 2026 12:46
@kshyatt
kshyatt marked this pull request as ready for review November 6, 2026 17:27
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ext/TensorKitGPUArraysExt.jl 96.29% 1 Missing ⚠️
Files with missing lines Coverage Δ
ext/TensorKitCUDAExt/TensorKitCUDAExt.jl 100.00% <100.00%> (ø)
src/tensors/linalg.jl 83.82% <ø> (+0.29%) ⬆️
ext/TensorKitGPUArraysExt.jl 95.39% <96.29%> (+0.07%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant