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
c2ff1508
Commit
c2ff1508
authored
Oct 06, 2017
by
Jaikrishnan Menon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Codegen: Minor cleanup
parent
4ecdb791
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
compiler.cpp
src/ngraph/codegen/compiler.cpp
+8
-17
compiler.hpp
src/ngraph/codegen/compiler.hpp
+5
-0
No files found.
src/ngraph/codegen/compiler.cpp
View file @
c2ff1508
...
@@ -12,8 +12,6 @@
...
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include <iostream>
#include <clang/CodeGen/ObjectFilePCHContainerOperations.h>
#include <clang/CodeGen/ObjectFilePCHContainerOperations.h>
#include <clang/Driver/DriverDiagnostic.h>
#include <clang/Driver/DriverDiagnostic.h>
#include <clang/Driver/Options.h>
#include <clang/Driver/Options.h>
...
@@ -150,40 +148,31 @@ std::unique_ptr<llvm::Module> execution_state::compile(const string& source, con
...
@@ -150,40 +148,31 @@ std::unique_ptr<llvm::Module> execution_state::compile(const string& source, con
bool
execution_state
::
add_module
(
std
::
unique_ptr
<
llvm
::
Module
>&
module
)
bool
execution_state
::
add_module
(
std
::
unique_ptr
<
llvm
::
Module
>&
module
)
{
{
bool
rc
=
false
;
if
(
module
)
if
(
module
)
{
{
rc
=
true
;
if
(
!
m_execution_engine
)
if
(
!
m_execution_engine
)
{
{
std
::
string
jit_error_string
;
// auto mm = unique_ptr<RTDyldMemoryManager>(new method_resolver(this));
// auto mm = unique_ptr<RTDyldMemoryManager>(new method_resolver(this));
m_execution_engine
=
llvm
::
EngineBuilder
(
move
(
module
))
m_execution_engine
=
llvm
::
EngineBuilder
(
move
(
module
))
.
setEngineKind
(
llvm
::
EngineKind
::
JIT
)
.
setEngineKind
(
llvm
::
EngineKind
::
JIT
)
.
setOptLevel
(
llvm
::
CodeGenOpt
::
Aggressive
)
.
setOptLevel
(
llvm
::
CodeGenOpt
::
Aggressive
)
.
setErrorStr
(
&
jit_error
_string
)
.
setErrorStr
(
&
jit_error
)
// .setUseMCJIT(true)
// .setUseMCJIT(true)
// .setMCJITMemoryManager(std::move(mm))
// .setMCJITMemoryManager(std::move(mm))
.
create
();
.
create
();
if
(
m_execution_engine
)
if
(
!
m_execution_engine
)
{
}
else
{
{
cout
<<
"nullptr engine
\n
"
;
return
false
;
cout
<<
jit_error_string
<<
endl
;
rc
=
false
;
}
}
}
}
}
}
else
else
{
{
cout
<<
"nullptr module
\n
"
;
return
false
;
rc
=
false
;
}
}
return
rc
;
return
true
;
}
}
void
execution_state
::
finalize
()
void
execution_state
::
finalize
()
...
@@ -195,6 +184,8 @@ void execution_state::finalize()
...
@@ -195,6 +184,8 @@ void execution_state::finalize()
}
}
else
else
{
{
throw
std
::
runtime_error
(
"must add_module before finalize"
);
throw
std
::
runtime_error
(
"Error in finalize: "
+
(
jit_error
.
empty
()
?
"Could not create an execution engine"
:
jit_error
));
}
}
}
}
src/ngraph/codegen/compiler.hpp
View file @
c2ff1508
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
#pragma once
#pragma once
#include <functional>
#include <memory>
#include <string>
#include <llvm/ExecutionEngine/MCJIT.h> // forces JIT to link in
#include <llvm/ExecutionEngine/MCJIT.h> // forces JIT to link in
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#include <llvm/Option/Arg.h>
#include <llvm/Option/Arg.h>
...
@@ -56,6 +60,7 @@ public:
...
@@ -56,6 +60,7 @@ public:
private
:
private
:
llvm
::
ExecutionEngine
*
m_execution_engine
;
llvm
::
ExecutionEngine
*
m_execution_engine
;
std
::
string
jit_error
;
template
<
typename
signature
>
template
<
typename
signature
>
std
::
function
<
signature
>
f_cast
(
void
*
f
)
std
::
function
<
signature
>
f_cast
(
void
*
f
)
...
...
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