Skip to content

perf(gint): optimize phi_operator kernels (Useful Information for some special optimization commands that have not been used in ABACUS before)#7366

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
dzzz2001:gint-kernel-opt
May 21, 2026
Merged

perf(gint): optimize phi_operator kernels (Useful Information for some special optimization commands that have not been used in ABACUS before)#7366
mohanchen merged 1 commit into
deepmodeling:developfrom
dzzz2001:gint-kernel-opt

Conversation

@dzzz2001
Copy link
Copy Markdown
Collaborator

@dzzz2001 dzzz2001 commented May 19, 2026

Summary

  • Optimize phi_operator_gpu.cu and phi_operator_kernel.cu/.cuh to improve performance of the gint phi operator kernels.

- set_phi_dphi_kernel: add WantPhi non-type template parameter and
  dispatch from the launch site. The dphi-only callers (gint_tau)
  pass phi=nullptr; with WantPhi==false the compiler drops the
  phi[] stores and the per-iw `phi != nullptr` branch entirely.
- phi_dot_dphi_kernel / phi_dot_dphi_r_kernel: replace the shared-
  memory tree reduce with a single-warp warpReduceSum and drop the
  dynamic shared-memory allocation at the launch sites. Launch
  configuration is pinned at blockDim.x == 32; a comment guards the
  invariant.
- Plain `if` (not `if constexpr`) on WantPhi keeps the code
  C++11-compliant — ABACUS targets C++11 and nvcc otherwise emits
  warning deepmodeling#2912-D. WantPhi is still a non-type template parameter,
  so the compiler folds the constant and eliminates the dead branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mohanchen mohanchen added Refactor Refactor ABACUS codes Useful Information Useful information for others to learn/study labels May 21, 2026
@mohanchen mohanchen changed the title perf(gint): optimize phi_operator kernels perf(gint): optimize phi_operator kernels (Useful Information for some special optimization commands that have not been used in ABACUS before) May 21, 2026
@mohanchen mohanchen merged commit e943b0f into deepmodeling:develop May 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes Useful Information Useful information for others to learn/study

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants