Commit 693dec0
perf(gint): optimize 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>1 parent f09748a commit 693dec0
3 files changed
Lines changed: 171 additions & 169 deletions
File tree
- source/source_lcao/module_gint/kernel
Lines changed: 40 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
151 | 163 | | |
152 | 164 | | |
153 | 165 | | |
| |||
427 | 439 | | |
428 | 440 | | |
429 | 441 | | |
| 442 | + | |
430 | 443 | | |
431 | | - | |
| 444 | + | |
432 | 445 | | |
433 | 446 | | |
434 | 447 | | |
| |||
454 | 467 | | |
455 | 468 | | |
456 | 469 | | |
| 470 | + | |
457 | 471 | | |
458 | | - | |
| 472 | + | |
459 | 473 | | |
460 | 474 | | |
461 | 475 | | |
| |||
0 commit comments