Skip to content

Commit 0946640

Browse files
omegacolemanfacebook-github-bot
authored andcommitted
Reuse prepacked pmat for PackBMatrix if smat is nullptr (#4665)
Summary: X-link: facebookresearch/FBGEMM#1700 This patch solves the problem addressed in #427 and #542 in a more non-intrusive way: the PackBMatrix constructor now skips the actual packing and allows reuse of `pmat` if `smat == nullptr`. This feature is crucial for offline packing and caching `pmat` for better load speed. Doing so eliminates the need for a separate constructor and ensures the pack parameters are identical. Pull Request resolved: #4665 Reviewed By: cthi Differential Revision: D79940804 Pulled By: q10 fbshipit-source-id: 3fb35c18a87cc2d8ec89fdabcee32cfbdaacc4b2
1 parent 0bf8949 commit 0946640

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/PackBMatrix.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ PackBMatrix<T, accT>::PackBMatrix(
248248
64,
249249
BaseType::numGroups() * BaseType::blockRows() * BaseType::brow_ *
250250
BaseType::blockCols() * BaseType::bcol_ * sizeof(T)));
251+
} else if (!smat) {
252+
return;
251253
}
252254
pack(block, params);
253255
}

0 commit comments

Comments
 (0)