aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/kernels/eigen_support.cc
diff options
context:
space:
mode:
authorGravatar Yu-Cheng Ling <ycling@google.com>2018-07-20 16:23:51 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-20 16:28:54 -0700
commita4bab4517eddef07236529c0141e85bcae06ad74 (patch)
tree4ac8bf545068adbe6007ee2dd35273df58cb5cd3 /tensorflow/contrib/lite/kernels/eigen_support.cc
parent41781bad97698c29cd74203cef465d2adb2f04e8 (diff)
Align TFLite tensors to 64 bytes for EIGEN_DONT_ALIGN
PiperOrigin-RevId: 205471025
Diffstat (limited to 'tensorflow/contrib/lite/kernels/eigen_support.cc')
-rw-r--r--tensorflow/contrib/lite/kernels/eigen_support.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/kernels/eigen_support.cc b/tensorflow/contrib/lite/kernels/eigen_support.cc
index 4f0d020793..e542ad0765 100644
--- a/tensorflow/contrib/lite/kernels/eigen_support.cc
+++ b/tensorflow/contrib/lite/kernels/eigen_support.cc
@@ -16,6 +16,7 @@ limitations under the License.
#include <utility>
+#include "tensorflow/contrib/lite/arena_planner.h"
#include "tensorflow/contrib/lite/kernels/internal/optimized/eigen_spatial_convolutions.h"
#include "tensorflow/contrib/lite/kernels/op_macros.h"
@@ -23,6 +24,16 @@ namespace tflite {
namespace eigen_support {
namespace {
+#ifndef EIGEN_DONT_ALIGN
+// Eigen may require buffers to be algiend to 16, 32 or 64 bytes depending on
+// hardware architecture and build configurations.
+// If the static assertion fails, try to increase `kDefaultTensorAlignment` to
+// in `arena_planner.h` to 32 or 64.
+static_assert(
+ kDefaultTensorAlignment % EIGEN_MAX_ALIGN_BYTES == 0,
+ "kDefaultArenaAlignment doesn't comply with Eigen alignment requirement.");
+#endif // EIGEN_DONT_ALIGN
+
// We have a single global threadpool for all convolution operations. This means
// that inferences started from different threads may block each other, but
// since the underlying resource of CPU cores should be consumed by the