Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
aa3815c5
Unverified
Commit
aa3815c5
authored
Mar 15, 2018
by
Robert Kimball
Committed by
GitHub
Mar 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set the EIGEN_MPL2_ONLY flag and add tests to make sure it is set for compile and codegen (#655)
parent
79c77fdd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
0 deletions
+26
-0
CMakeLists.txt
CMakeLists.txt
+3
-0
compiler.cpp
src/ngraph/codegen/compiler.cpp
+3
-0
node.cpp
src/ngraph/node.cpp
+4
-0
codegen.cpp
test/codegen.cpp
+16
-0
No files found.
CMakeLists.txt
View file @
aa3815c5
...
...
@@ -46,6 +46,9 @@ else()
message
(
WARNING
"You are using an unsupported compiler. Compilation has only been tested with Clang (
${
CLANG_MIN_VERSION
}
and up), Apple Clang (
${
APPLE_CLANG_MIN_VERSION
}
and up), and GCC (
${
GCC_MIN_VERSION
}
and up)."
)
endif
()
# Prevent Eigen from using any LGPL3 code
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DEIGEN_MPL2_ONLY"
)
if
(
$ENV{NGRAPH_USE_PREBUILT_LLVM}
)
set
(
NGRAPH_USE_PREBUILT_LLVM TRUE
)
endif
()
...
...
src/ngraph/codegen/compiler.cpp
View file @
aa3815c5
...
...
@@ -148,6 +148,9 @@ void codegen::StaticCompiler::initialize()
args
.
push_back
(
"-mllvm"
);
args
.
push_back
(
"-inline-threshold=1000000"
);
// Prevent Eigen from using any LGPL3 code
args
.
push_back
(
"-DEIGEN_MPL2_ONLY"
);
// Prepare DiagnosticEngine
IntrusiveRefCntPtr
<
DiagnosticOptions
>
diag_options
=
new
DiagnosticOptions
();
diag_options
->
ErrorLimit
=
20
;
...
...
src/ngraph/node.cpp
View file @
aa3815c5
...
...
@@ -26,6 +26,10 @@
#include "ngraph/ops/result.hpp"
#include "ngraph/placement.hpp"
#if not defined(EIGEN_MPL2_ONLY)
#error("The flag `EIGEN_MPL2_ONLY` must be defined");
#endif
using
namespace
std
;
using
namespace
ngraph
;
...
...
test/codegen.cpp
View file @
aa3815c5
...
...
@@ -26,6 +26,22 @@
using
namespace
std
;
using
namespace
ngraph
;
TEST
(
codegen
,
eigen_gpl_test
)
{
// In order for this test to pass the in-memory compiler must define EIGEN_MPL2_ONLY
constexpr
auto
source
=
R"(
#if not defined(EIGEN_MPL2_ONLY)
#error("must define flag")
#endif
)"
;
codegen
::
Compiler
compiler
;
codegen
::
ExecutionEngine
execution_engine
;
auto
module
=
compiler
.
compile
(
source
);
ASSERT_NE
(
nullptr
,
module
);
}
TEST
(
DISABLED_codegen
,
simple_return
)
{
constexpr
auto
source
=
R"(extern "C" int test() { return 2+5; })"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment