Fix(pw): correct atom index in non-collinear non-local stress on GPU - #7819
Open
dyzheng wants to merge 1 commit into
Open
Fix(pw): correct atom index in non-collinear non-local stress on GPU#7819dyzheng wants to merge 1 commit into
dyzheng wants to merge 1 commit into
Conversation
In the nspin=4 cal_stress_nl CUDA/ROCm kernels, deeq_nc was indexed
with `iat + ia` while `iat` was also incremented inside the atom
loop, so the atom offset was counted twice. For element types with
more than one atom (e.g. Fe2 or HEAs), the second atom onwards read
deeq_nc at wrong indices (aliasing another npol block, or out of
bounds for the ps3 term), producing a wrong non-local stress with
spurious off-diagonal components.
Use `iat` alone, consistent with the collinear stress kernel and the
non-collinear force kernel, in both the CUDA and ROCm kernels.
Add CPU/GPU parity tests for the deeq_nc (nspin=4) overload of
cal_stress_nl_op with ntype=1 and atom_na={2}, which fail on the
buggy GPU kernel and pass after the fix. Existing tests only covered
the real/collinear overload and could not catch this.
(cherry picked from commit 97cb313, adapted to the LTS source tree
layout and memory-op API)
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.
In the nspin=4 cal_stress_nl CUDA/ROCm kernels, deeq_nc was indexed with
iat + iawhileiatwas also incremented inside the atom loop, so the atom offset was counted twice. For element types with more than one atom (e.g. Fe2 or HEAs), the second atom onwards read deeq_nc at wrong indices (aliasing another npol block, or out of bounds for the ps3 term), producing a wrong non-local stress with spurious off-diagonal components.Use
iatalone, consistent with the collinear stress kernel and the non-collinear force kernel, in both the CUDA and ROCm kernels.Add CPU/GPU parity tests for the deeq_nc (nspin=4) overload of cal_stress_nl_op with ntype=1 and atom_na={2}, which fail on the buggy GPU kernel and pass after the fix. Existing tests only covered the real/collinear overload and could not catch this.
(cherry picked from commit 97cb313, adapted to the LTS source tree layout and memory-op API)
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
Fix #
Unit Tests and/or Case Tests for my changes
What's changed?
Governance Notes