Repository navigation
Complete early symmetry screening for staged GPU callbacks - #1
Merged
Merged
Conversation
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.
PR abacusmodeling#24's latest commit (
39c953b) already restores correct final-output screening: the split callback names stop the old intermediateAa2pair check from being dispatched, whilefor32still screens the actual output pair. The independent 31,104-combination final-output mask check passes for that version.This follow-up completes earlier screening, rather than fixing another numerical error. The old two-argument rule is still under
for21(TA,TAC), but the matching label family callsfor21(TAC,TAC)in stage 1; stage-2/stage-3 callbacks otherwise inherit no-op behavior. Route useful checks to their actual positions:for12: check left-output atom membership whenAa01is an output, and defer when it is intermediate.for13: check left-output atom membership in the third stage ofa01b2_a2b01.for22: check(Aa01,Ab01)only fora01b01_a2b2; leave(Aa01,Aa2)unrestricted ina01b2_a2b01.for23: check the final(Aa01,Ab01)pair ina01b2_a2b01.for21override;for21andfor31retain base no-op behavior. Keepfor32as the complete output-pair check.The contraction loops, callback argument order, generator and CPU symmetry implementation are unchanged.
Validation and performance status:
39c953ba1b1_a2b2, callback 12); final-output mask still passesThe submitted GPU regression also runs the new callback test. Its source, script and completed logs are in
df1:~/work/lr-grad/pr24-output-filter-20261121/. The completed Si64 material/performance comparison is documented below.The per-callback test derives final output indices from each label's uncontracted a/b indices and independently masks atom pairs and centered relative cells. It tests unrestricted, off-diagonal/restricted and empty-output sectors, including intermediate cells outside the sector when the final pair is accepted. It calls each callback separately through
Filter_Atom, so a latefor32rejection cannot hide a missing early-stage check.GPU staged callback behavior
The first digit in
filter_GPU_forXYis the loop depth, the second is theoccurrence/stage. The loop call sites and their argument order are unchanged.
F: return false (do not screen at this position).L: reject atoms absent from the sector's left/output atom identities (Aa01).R: reject atoms absent from the sector's right/output atom identities (Ab01).P: reject only if the final output pair/cell is outside the sector.—: no such call for this label. Bold entries gain screening in this change.a0b0_a1b1(Aa2, Ab2)a0b1_a1b0(Aa2, Ab2)a0b0_a1b2(Aa2, Ab01)a0b1_a1b2(Aa2, Ab01)a0b2_a1b0(Aa2, Ab01)a0b2_a1b1(Aa2, Ab01)a0b0_a2b1(Aa01, Ab2)a0b1_a2b0(Aa01, Ab2)a1b0_a2b1(Aa01, Ab2)a1b1_a2b0(Aa01, Ab2)a0b0_a2b2(Aa01, Ab01)a0b1_a2b2(Aa01, Ab01)a1b0_a2b2(Aa01, Ab01)a1b1_a2b2(Aa01, Ab01)a1b2_a2b1(Aa01, Ab01)a0b2_a2b0(Aa01, Ab01)a0b2_a2b1(Aa01, Ab01)a1b2_a2b0(Aa01, Ab01)for21andfor31remain no-ops. In particular,for22(Aa01,Aa2)ina01b2_a2b01must not screen its intermediateAa2; its final pair is checkedby
for32(Aa01,Aa2,Ab01)andfor23(Aa01,Ab01). By contrast,for22(Aa01,Ab01)ina01b01_a2b2already has both output atoms and can screen.The
for32arguments and selected pair are:a01b01_a01b01Aa01, Aa2, Ab2Aa2, Ab2a01b01_a01b2Aa01, Ab01, Aa2Aa2, Ab01a01b01_a2b01Aa01, Ab01, Ab2Aa01, Ab2a01b01_a2b2Aa01, Ab01, Ab2Aa01, Ab01a01b2_a2b01Aa01, Aa2, Ab01Aa01, Ab01For cell-bearing left outputs, use the relative translation
(Rb-Ra) % period;for origin-based
Aa01, useRb % period. Empty sector means unrestrictedoutput, matching the existing API.
The CPU-host
gpu_symmetry_filterstest invokes all GPU callback positionsthrough
Filter_Atom, checking 31,104 label/sector/atom/cell combinations againstindependent output-index and sector membership expectations. It needs no DDLA or
GPU. It checks intermediate cells that are outside the sector while the final
output is inside, off-diagonal pairs, periodic translations and empty output.
Completed DDLA diagnosis and Si64 performance results
Confirmed cause of the original failure
The initial performance attempt (4098235) failed in baseline
39c953bat the first EXX update. The diagnostic rerun captured CUDA status 9 with:The third grid dimension exceeds the 65,535 launch limit. Ordinary DDLA variable-batched GEMM already sub-batches at that limit, while
gemm_template_vbatched_2spreviously used an entire memory segment asgrid.z. Memory capacity and kernel-launch capacity are separate constraints. A direct boundary test confirmed the old backend succeeds at 65,535 but fails at 65,536 withgrid=(1,1,65536).The independent DDLA 0.0.6 patch sub-batches within each original memory segment, completing stage 0 and dependent stage 1 for a sub-batch before advancing. Thus 66,182 entries become 65,535 + 647 without losing entries or breaking temporary-storage reuse. This confirms a DDLA launch-size defect, not an ABACUS calculation or ABI/version mismatch.
The public API and the original baseline/optimized ABACUS binaries are unchanged. Both variants load the same private patched DDLA, verified by
lddand hashes; the original shared DDLA installation is untouched. The backend patch is a common test prerequisite and is not part of this LibRI PR.Backend and numerical validation
C0_leftvalues. The 131,073 case spans two memory segments (65,536 + 65,537) and reuses temporary storage across them.Si64 comparison setup and numerical agreement
Baseline
39c953bversus27daefe; the library snapshots differ only inFilter_Atom_Symmetry_GPU.h. Use the repositoryP102_si64_lcao64-atom Si structure, HSE, LCAO DZP (Si_gga_8au_100Ry_2s2p1d), 1×1×1 Gamma mesh, real RI tensors, real-space EXX symmetry, SCF threshold1e-7, and final force/stress evaluation.All six calculations used the same V100-SXM2-32GB allocation, one MPI rank, six OpenMP threads, single-threaded MKL/OpenBLAS, identical input hashes and the same common patched DDLA. The frozen ABACUS source and test-only C/V-residency compatibility patch are common to both variants. Run order was baseline/optimized/optimized/baseline/baseline/optimized. All six runs converged, returned zero and logged GPU EXX execution.
Measured timings and limits of interpretation
The observed end-to-end wall median is 10.23% lower (1.114×) in this sample. It includes MPI/process startup, input reading, SCF, forces/stress and I/O; it is not an isolated timing of the GPU contractions.
Exx_LRI::cal_exx_elec, total of 3 callsExx_LRI::cal_exx_forceExx_LRI::cal_exx_stressThe combined EXX timer median is only 0.96% lower, with overlapping per-run ranges (baseline 163.01–165.06 s; earlier screening 161.63–163.60 s). Startup/input-reading times vary considerably as well. Therefore this experiment establishes numerical agreement and successful large-batch execution, but does not establish a stable 10% screening/kernel speedup. The three-repetition result suggests, at most, a small EXX timing benefit requiring more controlled profiling/repeats to distinguish from variability. The stress timer does not improve in the median.
Reproducibility records
df1:~/work/lr-grad/pr24-ddla-retry-20261121/completed-evidence.tar.gz: raw six-run logs, summary/records, hardware, binary/linkage records, original launch diagnostics, boundary and numerical test logs, patch, manifest and scripts.df1:~/work/lr-grad/pr24-ddla-retry-20261121/ddla-chunk.patch: independent DDLA fix.~/work/lr-grad/pr24-si64-performance-20261121/result-evidence.tar.gzand~/work/lr-grad/pr24-output-filter-20261121/result-evidence.tar.gz.Relative to master
a385ac9, the checks restored atfor12/for13andfor23existed under the shared legacy callback names; thea01b01_a2b2output-pair check atfor22is additionally new. The benchmark baseline here is39c953b, not master.