Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets DSP-specific correctness in the PW nonlocal pseudopotential path by fixing (1) DSP memory initialization ops and (2) ensuring DSP-allocated z_vkb is properly released.
Changes:
- Add DSP-only cleanup for
z_vkbinpseudopot_cell_vnl::release_memory(). - Introduce
set_memory_op_mtfor DSP builds and wire it into the Nonlocal PW operator. - Minor formatting/whitespace adjustments in
vnl_pw.cpp.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
source/source_pw/module_pwdft/vnl_pw.cpp |
DSP-only z_vkb allocation label tweak and explicit DSP deallocation in release_memory() |
source/source_pw/module_pwdft/op_pw_nl.h |
Switch DSP builds to use mt memory ops for complex buffer memset/alloc/free |
source/source_base/module_device/memory_op.h |
Add declaration for set_memory_op_mt under __DSP |
source/source_base/module_device/memory_op.cpp |
Implement set_memory_op_mt (CPU specialization) and explicit template instantiations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+91
to
+99
| #ifdef __DSP | ||
| using setmem_complex_op = base_device::memory::set_memory_op_mt<T, Device>; | ||
| using resmem_complex_op = base_device::memory::resize_memory_op_mt<T, Device>; | ||
| using delmem_complex_op = base_device::memory::delete_memory_op_mt<T, Device>; | ||
| #else | ||
| #else | ||
| using setmem_complex_op = base_device::memory::set_memory_op<T, Device>; | ||
| using resmem_complex_op = base_device::memory::resize_memory_op<T, Device>; | ||
| using delmem_complex_op = base_device::memory::delete_memory_op<T, Device>; | ||
| #endif | ||
| #endif |
Comment on lines
+283
to
+289
| #ifdef __DSP | ||
| base_device::memory::resize_memory_op_mt<std::complex<double>, base_device::DEVICE_CPU>() | ||
| (this->z_vkb, this->vkb.size, "Nonlocal<PW>::ps"); | ||
| memcpy(this->z_vkb,this->vkb.c,this->vkb.size*16); | ||
| #else | ||
| (this->z_vkb, this->vkb.size, "VNL::z_vkb"); | ||
| // memcpy(this->z_vkb,this->vkb.c,this->vkb.size*16); | ||
| #else | ||
| this->z_vkb = this->vkb.c; | ||
| #endif | ||
| #endif |
mohanchen
approved these changes
Mar 19, 2026
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.
What's changed?
z_vkbthat is not released for DSP.