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
3beb5fe3
Commit
3beb5fe3
authored
Mar 25, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added getter's and setter's method for framework allocators object
parent
3f2ba6f9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
2 deletions
+43
-2
allocator.cpp
src/ngraph/runtime/allocator.cpp
+2
-2
backend.cpp
src/ngraph/runtime/backend.cpp
+10
-0
backend.hpp
src/ngraph/runtime/backend.hpp
+4
-0
cpu_backend.cpp
src/ngraph/runtime/cpu/cpu_backend.cpp
+19
-0
cpu_backend.hpp
src/ngraph/runtime/cpu/cpu_backend.hpp
+8
-0
No files found.
src/ngraph/runtime/allocator.cpp
View file @
3beb5fe3
...
...
@@ -18,7 +18,7 @@
void
*
ngraph
::
runtime
::
Allocator
::
Malloc
(
void
*
handle
,
size_t
size
,
size_t
alignment
)
{
void
*
ptr
=
malloc
(
size
);
void
*
ptr
=
ngraph
::
aligned_alloc
(
alignment
,
size
);
// check for exception
if
(
size
!=
0
&&
!
ptr
)
...
...
@@ -32,6 +32,6 @@ void ngraph::runtime::Allocator::Free(void* handle, void* ptr)
{
if
(
ptr
)
{
free
(
ptr
);
ngraph
::
aligned_
free
(
ptr
);
}
}
src/ngraph/runtime/backend.cpp
View file @
3beb5fe3
...
...
@@ -65,6 +65,16 @@ void runtime::Backend::remove_compiled_function(std::shared_ptr<Executable> exec
{
}
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>
runtime
::
Backend
::
get_framework_memory_allocator
()
{
return
nullptr
;
}
void
runtime
::
Backend
::
set_framework_memory_allocator
(
const
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>&
allocator
)
{
}
ngraph
::
runtime
::
AllocateFunc
runtime
::
Backend
::
get_device_memory_alloc
()
{
return
nullptr
;
...
...
src/ngraph/runtime/backend.hpp
View file @
3beb5fe3
...
...
@@ -20,6 +20,7 @@
#include "ngraph/function.hpp"
#include "ngraph/pass/pass_config.hpp"
#include "ngraph/runtime/allocator.hpp"
#include "ngraph/runtime/executable.hpp"
#include "ngraph/runtime/performance_counter.hpp"
#include "ngraph/shape.hpp"
...
...
@@ -117,6 +118,9 @@ public:
virtual
void
remove_compiled_function
(
std
::
shared_ptr
<
Executable
>
exec
);
virtual
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>
get_framework_memory_allocator
();
virtual
void
set_framework_memory_allocator
(
const
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>&
allocator
);
virtual
ngraph
::
runtime
::
AllocateFunc
get_device_memory_alloc
();
virtual
ngraph
::
runtime
::
DestroyFunc
get_device_memory_dealloc
();
virtual
bool
is_device_memory
();
...
...
src/ngraph/runtime/cpu/cpu_backend.cpp
View file @
3beb5fe3
...
...
@@ -50,6 +50,14 @@ namespace
}
s_cpu_static_init
;
}
runtime
::
cpu
::
CPU_Backend
::
CPU_Backend
()
{
m_allocator
=
make_shared
<
ngraph
::
runtime
::
Allocator
>
();
}
runtime
::
cpu
::
CPU_Backend
::~
CPU_Backend
()
{
}
shared_ptr
<
runtime
::
cpu
::
CPU_CallFrame
>
runtime
::
cpu
::
CPU_Backend
::
make_call_frame
(
const
shared_ptr
<
runtime
::
cpu
::
CPU_ExternalFunction
>&
external_function
,
ngraph
::
pass
::
PassConfig
&
pass_config
,
...
...
@@ -65,6 +73,17 @@ shared_ptr<runtime::Tensor>
return
make_shared
<
runtime
::
cpu
::
CPUTensorView
>
(
element_type
,
shape
,
this
);
}
shared_ptr
<
ngraph
::
runtime
::
Allocator
>
runtime
::
cpu
::
CPU_Backend
::
get_framework_memory_allocator
()
{
return
m_allocator
;
}
void
runtime
::
cpu
::
CPU_Backend
::
set_framework_memory_allocator
(
const
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>&
allocator
)
{
m_allocator
=
allocator
;
}
shared_ptr
<
runtime
::
Tensor
>
runtime
::
cpu
::
CPU_Backend
::
create_tensor
(
const
element
::
Type
&
element_type
,
const
Shape
&
shape
,
void
*
memory_pointer
)
{
...
...
src/ngraph/runtime/cpu/cpu_backend.hpp
View file @
3beb5fe3
...
...
@@ -21,6 +21,7 @@
#include "cpu_backend_visibility.h"
#include "ngraph/pass/pass_config.hpp"
#include "ngraph/runtime/allocator.hpp"
#include "ngraph/runtime/backend.hpp"
#include "ngraph/runtime/cpu/cpu_allocator.hpp"
...
...
@@ -36,6 +37,8 @@ namespace ngraph
class
CPU_BACKEND_API
CPU_Backend
:
public
runtime
::
Backend
{
public
:
CPU_Backend
();
~
CPU_Backend
();
std
::
shared_ptr
<
CPU_CallFrame
>
make_call_frame
(
const
std
::
shared_ptr
<
CPU_ExternalFunction
>&
external_function
,
ngraph
::
pass
::
PassConfig
&
pass_config
,
...
...
@@ -64,12 +67,17 @@ namespace ngraph
void
remove_compiled_function
(
std
::
shared_ptr
<
Executable
>
exec
)
override
;
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>
get_framework_memory_allocator
()
override
;
void
set_framework_memory_allocator
(
const
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>&
allocator
)
override
;
bool
is_supported
(
const
Node
&
node
)
const
override
;
bool
is_supported_property
(
const
Property
prop
)
const
override
;
private
:
std
::
unordered_map
<
std
::
shared_ptr
<
Function
>
,
std
::
shared_ptr
<
Executable
>>
m_exec_map
;
std
::
shared_ptr
<
ngraph
::
runtime
::
Allocator
>
m_allocator
=
nullptr
;
};
class
CPU_BACKEND_API
CPU_Executable
:
public
runtime
::
Executable
...
...
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