Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/FBGEMM.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProtonu Basu <protonu@fb.com>2019-07-16 23:10:44 +0300
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-07-16 23:14:24 +0300
commit931b3b71f021401dede9f35f3920eeb1e98c4c09 (patch)
tree1c0d47282a487c191fc741de5257687599aa0f22
parentfeca34d3d0b52527a1caa53186bc2ebf72d227c2 (diff)
changes to remove warnings when building in opt mode
Summary: Changes to remove warnings when building FBGEMM in opt mode. Cleanup to address initialization of MCB, KCB, NCBX Reviewed By: jianyuh Differential Revision: D16283443 fbshipit-source-id: 0829aee45ed1d262a18bcf4dd294393ef018a688
-rw-r--r--src/PackAMatrix.cc22
-rw-r--r--src/PackAWithIm2Col.cc21
-rw-r--r--src/PackAWithQuantRowOffset.cc25
-rw-r--r--src/PackAWithRowOffset.cc25
-rw-r--r--src/PackBMatrix.cc22
-rw-r--r--src/PackMatrix.cc40
6 files changed, 69 insertions, 86 deletions
diff --git a/src/PackAMatrix.cc b/src/PackAMatrix.cc
index 87adaba..143e11d 100644
--- a/src/PackAMatrix.cc
+++ b/src/PackAMatrix.cc
@@ -34,31 +34,29 @@ PackAMatrix<T, accT>::PackAMatrix(
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
+ if ((!fbgemmHasAvx512Support() && !fbgemmHasAvx2Support())) {
+ assert(0 && "unknown architecure");
+ }
+
if (params) {
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- BaseType::brow_ = params->MCB;
- BaseType::bcol_ = params->KCB;
- row_interleave_B_ = params->ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- }
+ BaseType::brow_ = params->MCB;
+ BaseType::bcol_ = params->KCB;
+ row_interleave_B_ = params->ROW_INTERLEAVE;
} else {
if (fbgemmHasAvx512Support()) {
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx512>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx512>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx512>::ROW_INTERLEAVE;
- } else if (fbgemmHasAvx2Support()) {
+ } else {
+ // AVX2
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx2>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx2>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx2>::ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
}
}
+
if (BaseType::numCols() % groups != 0) {
throw std::runtime_error(
"groups = " + std::to_string(groups) +
diff --git a/src/PackAWithIm2Col.cc b/src/PackAWithIm2Col.cc
index e55dd4e..d731654 100644
--- a/src/PackAWithIm2Col.cc
+++ b/src/PackAWithIm2Col.cc
@@ -49,32 +49,29 @@ PackAWithIm2Col<T, accT, SPATIAL_DIM>::PackAWithIm2Col(
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
+ if ((!fbgemmHasAvx512Support() && !fbgemmHasAvx2Support())) {
+ assert(0 && "unknown architecure");
+ }
if (params) {
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- BaseType::brow_ = params->MCB;
- BaseType::bcol_ = params->KCB;
- row_interleave_B_ = params->ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- }
+ BaseType::brow_ = params->MCB;
+ BaseType::bcol_ = params->KCB;
+ row_interleave_B_ = params->ROW_INTERLEAVE;
} else {
if (fbgemmHasAvx512Support()) {
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx512>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx512>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx512>::ROW_INTERLEAVE;
- } else if (fbgemmHasAvx2Support()) {
+ } else {
+ // AVX2
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx2>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx2>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx2>::ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
}
}
+
if (BaseType::numCols() % conv_p.G != 0) {
throw std::runtime_error(
"groups = " + std::to_string(conv_p.G) +
diff --git a/src/PackAWithQuantRowOffset.cc b/src/PackAWithQuantRowOffset.cc
index 7572a51..0e5c598 100644
--- a/src/PackAWithQuantRowOffset.cc
+++ b/src/PackAWithQuantRowOffset.cc
@@ -45,32 +45,31 @@ PackAWithQuantRowOffset<T, accT>::PackAWithQuantRowOffset(
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
- rowOffsetAllocatedHere = false;
+ if ((!fbgemmHasAvx512Support() && !fbgemmHasAvx2Support())) {
+ assert(0 && "unknown architecure");
+ }
+
if (params) {
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- BaseType::brow_ = params->MCB;
- BaseType::bcol_ = params->KCB;
- row_interleave_B_ = params->ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- }
+ BaseType::brow_ = params->MCB;
+ BaseType::bcol_ = params->KCB;
+ row_interleave_B_ = params->ROW_INTERLEAVE;
} else {
if (fbgemmHasAvx512Support()) {
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx512>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx512>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx512>::ROW_INTERLEAVE;
- } else if (fbgemmHasAvx2Support()) {
+ } else {
+ // AVX2
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx2>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx2>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx2>::ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unknown architecure");
}
}
+
+ rowOffsetAllocatedHere = false;
+
if (BaseType::numCols() % groups != 0) {
throw std::runtime_error(
"groups = " + std::to_string(groups) +
diff --git a/src/PackAWithRowOffset.cc b/src/PackAWithRowOffset.cc
index b791817..733bf5c 100644
--- a/src/PackAWithRowOffset.cc
+++ b/src/PackAWithRowOffset.cc
@@ -39,32 +39,31 @@ PackAWithRowOffset<T, accT>::PackAWithRowOffset(
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
- rowOffsetAllocatedHere = false;
+ if ((!fbgemmHasAvx512Support() && !fbgemmHasAvx2Support())) {
+ assert(0 && "unknown architecure");
+ }
+
if (params) {
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- BaseType::brow_ = params->MCB;
- BaseType::bcol_ = params->KCB;
- row_interleave_B_ = params->ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- }
+ BaseType::brow_ = params->MCB;
+ BaseType::bcol_ = params->KCB;
+ row_interleave_B_ = params->ROW_INTERLEAVE;
} else {
if (fbgemmHasAvx512Support()) {
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx512>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx512>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx512>::ROW_INTERLEAVE;
- } else if (fbgemmHasAvx2Support()) {
+ } else {
+ // AVX2
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx2>::MCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx2>::KCB;
row_interleave_B_ =
PackingTraits<T, accT, inst_set_t::avx2>::ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unknown architecure");
}
}
+
+ rowOffsetAllocatedHere = false;
+
if (BaseType::numCols() % groups != 0) {
throw std::runtime_error(
"groups = " + std::to_string(groups) +
diff --git a/src/PackBMatrix.cc b/src/PackBMatrix.cc
index 497cc2d..a2805b1 100644
--- a/src/PackBMatrix.cc
+++ b/src/PackBMatrix.cc
@@ -188,31 +188,29 @@ PackBMatrix<T, accT>::PackBMatrix(
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
+ if ((!fbgemmHasAvx512Support() && !fbgemmHasAvx2Support())) {
+ assert(0 && "unknown architecure");
+ }
+
if (params) {
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- BaseType::brow_ = params->KCB;
- BaseType::bcol_ = params->NCB;
- row_interleave_ = params->ROW_INTERLEAVE;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- }
+ BaseType::brow_ = params->KCB;
+ BaseType::bcol_ = params->NCB;
+ row_interleave_ = params->ROW_INTERLEAVE;
} else {
if (fbgemmHasAvx512Support()) {
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx512>::KCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx512>::NCB;
row_interleave_ =
PackingTraits<T, accT, inst_set_t::avx512>::ROW_INTERLEAVE;
- } else if (fbgemmHasAvx2Support()) {
+ } else {
+ // AVX2
BaseType::brow_ = PackingTraits<T, accT, inst_set_t::avx2>::KCB;
BaseType::bcol_ = PackingTraits<T, accT, inst_set_t::avx2>::NCB;
row_interleave_ =
PackingTraits<T, accT, inst_set_t::avx2>::ROW_INTERLEAVE;
- } else {
- // Error
- assert(0 && "unknown architecure");
}
}
+
if (BaseType::numRows() % groups != 0) {
throw std::runtime_error(
"groups = " + std::to_string(groups) +
diff --git a/src/PackMatrix.cc b/src/PackMatrix.cc
index 33227fb..c7503dd 100644
--- a/src/PackMatrix.cc
+++ b/src/PackMatrix.cc
@@ -36,45 +36,37 @@ int PackMatrix<PT, inpType, accType>::packedBufferSize(
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
+ if ((!fbgemmHasAvx512Support() && !fbgemmHasAvx2Support())) {
+ assert(0 && "unknown architecure");
+ }
+
int MCB, KCB, NCB;
if (params) {
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- MCB = params->MCB;
- NCB = params->NCB;
- KCB = params->KCB;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- }
+ MCB = params->MCB;
+ NCB = params->NCB;
+ KCB = params->KCB;
} else {
if (fbgemmHasAvx512Support()) {
MCB = PackingTraits<inpType, accType, inst_set_t::avx512>::MCB;
NCB = PackingTraits<inpType, accType, inst_set_t::avx512>::NCB;
KCB = PackingTraits<inpType, accType, inst_set_t::avx512>::KCB;
- } else if (fbgemmHasAvx2Support()) {
+ } else {
+ // AVX2
MCB = PackingTraits<inpType, accType, inst_set_t::avx2>::MCB;
NCB = PackingTraits<inpType, accType, inst_set_t::avx2>::NCB;
KCB = PackingTraits<inpType, accType, inst_set_t::avx2>::KCB;
- } else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
- return -1;
}
}
- if (fbgemmHasAvx512Support() || fbgemmHasAvx2Support()) {
- if (isA()) {
- return MCB * KCB;
- } else {
- int rowBlock = KCB;
- int colBlock = NCB;
- return (((rows + rowBlock - 1) / rowBlock) * rowBlock) *
- (((cols + colBlock - 1) / colBlock) * colBlock);
- }
+ if (isA()) {
+ return MCB * KCB;
} else {
- // TODO: Have default slower path
- assert(0 && "unsupported architecure");
+ int rowBlock = KCB;
+ int colBlock = NCB;
+ return (((rows + rowBlock - 1) / rowBlock) * rowBlock) *
+ (((cols + colBlock - 1) / colBlock) * colBlock);
}
+
return -1;
}