Skip to content

Fix: dsp memory op#7056

Open
Cstandardlib wants to merge 3 commits intodeepmodeling:developfrom
Cstandardlib:fix/dsp-op
Open

Fix: dsp memory op#7056
Cstandardlib wants to merge 3 commits intodeepmodeling:developfrom
Cstandardlib:fix/dsp-op

Conversation

@Cstandardlib
Copy link
Collaborator

What's changed?

  • Fix DSP set memory op.
  • Fix z_vkb that is not released for DSP.

Copilot AI review requested due to automatic review settings March 19, 2026 03:34
@Cstandardlib Cstandardlib changed the title Fix/dsp op Fix: dsp memory op Mar 19, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_vkb in pseudopot_cell_vnl::release_memory().
  • Introduce set_memory_op_mt for 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
@Cstandardlib Cstandardlib marked this pull request as draft March 19, 2026 06:48
@Cstandardlib Cstandardlib marked this pull request as ready for review March 19, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants