Reduce CUDA memory use in non-local SKALA layers - #101
Open
Dynamics of Condensed Matter (DCM-Uni-Paderborn) wants to merge 3 commits into
Open
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
|
cool, thanks for the PR. We will have a look |
Contributor
|
thanks Dynamics of Condensed Matter (@DCM-Uni-Paderborn) for the PR. There are two changes in this PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Motivation
CUDA profiles of native-grid SKALA in CP2K show that temporary fine-grid tensors contribute substantially to peak device memory. In particular, the skip-connection concatenation creates a large short-lived allocation and an associated copy kernel. The double-precision CUDA reduction and geometry intermediates also add work without improving the float32 model evaluation.
The split projection is mathematically equivalent to the existing concatenated linear layer:
W [features, update] + b = W_features features + b + W_update updateIt therefore reuses the existing weights and does not change checkpoint compatibility.
Validation
pytest -q --ignore=tests/test_pyscf_gradients.py: 179 passed, 1 skippedpytest -q tests/test_pyscf_gradients.py: 36 passedruff check .andruff format --check .Small-system CP2K checks found maximum candidate-to-reference differences of approximately
1.2e-8 Hain energy,3e-9 Ha/bohrin forces, and0.0014 barin stress.For a 96-atom CP2K SKALA workload, using three-run medians:
33.648 -> 30.997 s(-7.9%), SKALA time22.418 -> 19.833 s(-11.5%), and peak GPU memory11416 -> 10016 MiB(-12.3%) relative to the current Rev1 CUDA model10224/8896 -> 8864/7414 MiB(about 13-17% lower per GPU) and CP2K time25.086 -> 24.918 s(-0.7%)Model artifact
The source changes take effect after scripting/tracing a new CUDA
.funartifact. Existing published artifacts are not modified by this PR. A new CUDA model revision can be uploaded and added to the version mapping after this code is accepted; the CPU artifact can remain unchanged.Related to cp2k/cp2k#5439.