Repository navigation
perf(pw): accelerate GPU projector and DeltaSpin workloads (by OutisLi and dyzheng) - #8461
Conversation
Split from deepmodeling#8306. Add grouped projector products, batched complex GEMMs, fixed-overlap response solves, and device constraint/moment kernels.
…jector-deltaspin-gpu # Conflicts: # source/source_lcao/module_deltaspin/cal_mw_from_lambda.cpp # source/source_lcao/module_deltaspin/deltaspin_pw_mi.cpp # source/source_pw/module_proj/onsite_proj_tools.h # source/source_pw/module_pwdft/kernels/onsite_op.h # source/source_pw/module_pwdft/nonlocal_workspace.cpp # source/source_pw/module_pwdft/nonlocal_workspace.h # source/source_pw/module_pwdft/op_pw_nl.cpp
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e49b1ab52e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| if (projector_fold_) | ||
| { | ||
| folded = projector_fold_->project(bands, nbasis / npol, |
There was a problem hiding this comment.
Add focused tests for the folded CUDA projector path
When CUDA complex-double runs with an eligible single-rank, grid-aligned cell, this branch replaces the ordinary P^H psi GEMM with ProjectorFold::project, but a repo-wide search finds no focused test for ProjectorFold or its companion add path. A phase, grouping, or scatter error would alter nonlocal Hamiltonian applications without a test comparing these operations to the reference GEMMs. Add CUDA comparisons for both operations before enabling the optimization.
AGENTS.md reference: AGENTS.md:L26-L27
Useful? React with 👍 / 👎.
| release(); | ||
| return; | ||
| } | ||
| host_work_.resize(host_bytes_); |
There was a problem hiding this comment.
Fall back when host batch workspace allocation fails
If the optional batch path is selected and host_bytes_ exceeds available host memory, host_work_.resize() throws during Batch construction; prepare_batch() does not catch it, so the DeltaSpin update exits instead of returning false and using the serial response solve. Handle this host allocation failure like the device-allocation failures so batching remains optional.
Useful? React with 👍 / 👎.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The optional response cache can consume memory required by later GPU scratch; please preserve the fallback for those cases. Two nonblocking notes cover focused tests and the new CUDA code style.
Static review only; no builds or runtime tests were run.
| bool batch_response = false; | ||
| if (fixed_overlap && nk > 1) { batch_response = fixed_overlap->prepare_batch(); } |
There was a problem hiding this comment.
[P2] Reserve required response scratch before optional caches
prepare_batch() runs before becp_pointer is allocated, and the first cal_hs_subspace() plus later calculate_delta_hcc() also allocate required GPU scratch. If the optional cache fits but consumes that headroom, those resize_memory_op calls exit instead of taking the fallback. Please reserve the required peak workspace first, or release the optional caches and retry before a fatal allocation path.
…-gpu' into split/pr8306-projector-deltaspin-gpu
Summary
Split from #8306 as an independent GPU projector/DeltaSpin optimization.
No INPUT parameter or input-file behavior is changed.
Performance
Measured against the same pre-synchronization baseline on dual RTX 4090 GPUs. These are end-to-end SCF wall times, not kernel-only timings.
The branch was subsequently merged with upstream/develop at 5064965; performance was not re-measured after that synchronization.
Verification
cmake --build build -j 16passed at c8eb4de.OMP_NUM_THREADS=1 ctest --test-dir build --output-on-failure -R '^(MODULE_LCAO_deltaspin_template_helpers|MODULE_BASE_KERNELS_Unittests)$': 2/2 passed.git diff --check upstream/develop...HEAD: passed.python3 tools/03_code_analysis/agent_governance_check.py --base upstream/develop --head HEAD --format text: no blocking findings.Review notes