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
d185b48c
Commit
d185b48c
authored
Oct 06, 2017
by
Jaikrishnan Menon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Codegen: Add license header and switch line endings - CRLF -> LF
parent
da80abe6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
61 deletions
+75
-61
compiler.cpp
src/ngraph/codegen/compiler.cpp
+0
-0
compiler.hpp
src/ngraph/codegen/compiler.hpp
+75
-61
No files found.
src/ngraph/codegen/compiler.cpp
View file @
d185b48c
This diff is collapsed.
Click to expand it.
src/ngraph/codegen/compiler.hpp
View file @
d185b48c
#pragma once
#include <llvm/ExecutionEngine/MCJIT.h> // forces JIT to link in
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#include <llvm/Option/Arg.h>
namespace
nervana
{
namespace
cpu
{
class
module
;
class
execution_state
;
}
}
class
nervana
::
cpu
::
module
{
public
:
private
:
std
::
unique_ptr
<
llvm
::
Module
>
m_module
;
};
class
nervana
::
cpu
::
execution_state
:
public
llvm
::
SectionMemoryManager
{
public
:
execution_state
();
~
execution_state
();
std
::
unique_ptr
<
llvm
::
Module
>
compile
(
const
std
::
string
&
source
,
const
std
::
string
&
name
=
""
);
bool
add_module
(
std
::
unique_ptr
<
llvm
::
Module
>&
);
void
finalize
();
template
<
typename
ftype
>
std
::
function
<
ftype
>
find_function
(
const
std
::
string
&
func_name
)
{
auto
f
=
m_execution_engine
->
getPointerToNamedFunction
(
func_name
);
return
f_cast
<
ftype
>
(
f
);
}
private
:
llvm
::
ExecutionEngine
*
m_execution_engine
;
template
<
typename
signature
>
std
::
function
<
signature
>
f_cast
(
void
*
f
)
{
return
static_cast
<
signature
*>
((
signature
*
)
f
);
}
// class method_resolver : public llvm::RTDyldMemoryManager
// {
// public:
// method_resolver(compiler* m);
// virtual uint64_t getSymbolAddress(const std::string &name) override;
// private:
// compiler* m_Compiler;
// };
};
// ----------------------------------------------------------------------------
// Copyright 2017 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#pragma once
#include <llvm/ExecutionEngine/MCJIT.h> // forces JIT to link in
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#include <llvm/Option/Arg.h>
namespace
nervana
{
namespace
cpu
{
class
module
;
class
execution_state
;
}
}
class
nervana
::
cpu
::
module
{
public
:
private
:
std
::
unique_ptr
<
llvm
::
Module
>
m_module
;
};
class
nervana
::
cpu
::
execution_state
:
public
llvm
::
SectionMemoryManager
{
public
:
execution_state
();
~
execution_state
();
std
::
unique_ptr
<
llvm
::
Module
>
compile
(
const
std
::
string
&
source
,
const
std
::
string
&
name
=
""
);
bool
add_module
(
std
::
unique_ptr
<
llvm
::
Module
>&
);
void
finalize
();
template
<
typename
ftype
>
std
::
function
<
ftype
>
find_function
(
const
std
::
string
&
func_name
)
{
auto
f
=
m_execution_engine
->
getPointerToNamedFunction
(
func_name
);
return
f_cast
<
ftype
>
(
f
);
}
private
:
llvm
::
ExecutionEngine
*
m_execution_engine
;
template
<
typename
signature
>
std
::
function
<
signature
>
f_cast
(
void
*
f
)
{
return
static_cast
<
signature
*>
((
signature
*
)
f
);
}
// class method_resolver : public llvm::RTDyldMemoryManager
// {
// public:
// method_resolver(compiler* m);
// virtual uint64_t getSymbolAddress(const std::string &name) override;
// private:
// compiler* m_Compiler;
// };
};
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