From 3c269367e690bd69ad4aa0f12dcc7c3303a2f690 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Mon, 22 Jun 2026 14:40:28 -0500 Subject: [PATCH 1/2] fixed issue with possible zero-sized gemm call --- src/QMCWaveFunctions/TWFFastDerivWrapper.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp b/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp index ee8d1ee5b4..c11cf7ec4e 100644 --- a/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp +++ b/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp @@ -830,8 +830,9 @@ void TWFFastDerivWrapper::buildIntermediates(const std::vector& Min // n: all orbs (o+v) // Minv_Mv = Minv[o,e].M[e,v] - BLAS::gemm('n', 'n', nvirt, ptclnum, ptclnum, 1.0, M[id].data() + ptclnum, M[id].cols(), Minv[id].data(), - Minv[id].cols(), 0.0, Minv_Mv[id].data(), Minv_Mv[id].cols()); + if (nvirt > 0) // avoid gemm call with LDC == 0 + BLAS::gemm('n', 'n', nvirt, ptclnum, ptclnum, 1.0, M[id].data() + ptclnum, M[id].cols(), Minv[id].data(), + Minv[id].cols(), 0.0, Minv_Mv[id].data(), Minv_Mv[id].cols()); // Minv_B = Minv[o,e].B[e,n] BLAS::gemm('n', 'n', norb, ptclnum, ptclnum, 1.0, B[id].data(), B[id].cols(), Minv[id].data(), Minv[id].cols(), 0.0, From 6a186febe6d704166ea31d89af543fe0a116e403 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Mon, 22 Jun 2026 14:57:16 -0500 Subject: [PATCH 2/2] fix corner cases for MD wfs with nvirt==0 --- src/QMCWaveFunctions/TWFFastDerivWrapper.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp b/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp index c11cf7ec4e..3307ffa63e 100644 --- a/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp +++ b/src/QMCWaveFunctions/TWFFastDerivWrapper.cpp @@ -336,8 +336,9 @@ void TWFFastDerivWrapper::computeMDDerivatives_Obs(const std::vector 0) + BLAS::gemm('n', 'n', nvirt, nocc, nocc, -1.0, Minv_Mv[sid].data(), Minv_Mv[sid].cols(), Minv_B[sid].data(), + Minv_B[sid].cols(), 0.0, s_hv.data(), s_hv.cols()); // s[h,v] = Minv_B[h,v] - Minv_B[h,o].Minv_Mv[o,v] for (size_t i = 0; i < s_hv.rows(); i++) @@ -428,6 +429,9 @@ void TWFFastDerivWrapper::computeMDDerivatives_Obs(const std::vector 0) + BLAS::gemm('n', 'n', nvirt, nocc, nocc, -1.0, X3b_ov.data(), X3b_ov.cols(), Minv_dM[sid].data(), + Minv_dM[sid].cols(), 1.0, X432b_hv.data(), X432b_hv.cols()); // compute difference from ref here and add that term back later