Skip to content

Commit b959eb1

Browse files
cyyeverfacebook-github-bot
authored andcommitted
Fix some bugs (#4467)
Summary: X-link: facebookresearch/FBGEMM#1529 They were found by clang-tidy and code review. Pull Request resolved: #4467 Reviewed By: gchalump, spcyppt Differential Revision: D78102806 Pulled By: q10 fbshipit-source-id: 1c95a344e619a7577390afb2836c5945a37bfd2f
1 parent f22a3d4 commit b959eb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Utils.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ void* fbgemmAlignedAlloc(
448448
ret = posix_memalign(&aligned_mem, align, size);
449449
#endif
450450
// Throw std::bad_alloc in the case of memory allocation failure.
451-
if (raiseException || ret || aligned_mem == nullptr) {
451+
if (raiseException && (ret || aligned_mem == nullptr)) {
452452
throw std::bad_alloc();
453453
}
454454
return aligned_mem;
@@ -478,7 +478,7 @@ int fbgemmGet2DPartition(
478478
// for large thread numbers, we would like to reduce the aspect_ratio ---
479479
// if the matrix is short-and-fat
480480
// this allows us to assign more parallelism to i-dimension
481-
if (nthreads > 16 && m / n < 0.2) {
481+
if (nthreads > 16 && static_cast<double>(m) / n < 0.2) {
482482
aspect_ratio = 0.2;
483483
}
484484

0 commit comments

Comments
 (0)