Commit d5641c18 authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

fix build errors on centos (#1436)

parent 9ee10506
......@@ -21,6 +21,9 @@
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/type/element_type.hpp"
// This define is a workaround for gcc on centos and is required for aligned()
#define NGRAPH_CPU_ALIGNMENT 64
namespace ngraph
{
namespace runtime
......@@ -57,7 +60,7 @@ namespace ngraph
/// @param n Number of bytes to read, must be integral number of elements.
void read(void* p, size_t tensor_offset, size_t n) const override;
static constexpr size_t BufferAlignment = 64;
static constexpr int BufferAlignment = NGRAPH_CPU_ALIGNMENT;
private:
char* buffer;
......
......@@ -55,9 +55,9 @@ namespace ngraph
void reduce(const ElementType v, ElementType* R)
{
TensorViewPtrs inputs, outputs;
ElementType p __attribute__((aligned(CPUTensorView::BufferAlignment))) = v;
ElementType q __attribute__((aligned(CPUTensorView::BufferAlignment))) = *R;
ElementType r __attribute__((aligned(CPUTensorView::BufferAlignment)));
ElementType p __attribute__((aligned(NGRAPH_CPU_ALIGNMENT))) = v;
ElementType q __attribute__((aligned(NGRAPH_CPU_ALIGNMENT))) = *R;
ElementType r __attribute__((aligned(NGRAPH_CPU_ALIGNMENT)));
inputs.emplace_back(backend->create_tensor(
ngraph::element::from<ElementType>(), Shape{}, &p));
......
......@@ -46,9 +46,9 @@ namespace ngraph
auto reducer = [&](ElementType a, ElementType b) {
TensorViewPtrs inputs, outputs;
ElementType p __attribute__((aligned(CPUTensorView::BufferAlignment))) = a;
ElementType q __attribute__((aligned(CPUTensorView::BufferAlignment))) = b;
ElementType r __attribute__((aligned(CPUTensorView::BufferAlignment)));
ElementType p __attribute__((aligned(NGRAPH_CPU_ALIGNMENT))) = a;
ElementType q __attribute__((aligned(NGRAPH_CPU_ALIGNMENT))) = b;
ElementType r __attribute__((aligned(NGRAPH_CPU_ALIGNMENT)));
inputs.emplace_back(backend->create_tensor(
ngraph::element::from<ElementType>(), Shape{}, &p));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment