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
ab34197e
Commit
ab34197e
authored
Mar 07, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- add virtual destructor method to CPU allocator
- fix clang errors
parent
65eb0f09
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
17 deletions
+18
-17
cpu_call_frame.cpp
src/ngraph/runtime/cpu/cpu_call_frame.cpp
+3
-3
cpu_mkl_allocator.cpp
src/ngraph/runtime/cpu/cpu_mkl_allocator.cpp
+12
-7
cpu_mkl_allocator.hpp
src/ngraph/runtime/cpu/cpu_mkl_allocator.hpp
+3
-7
No files found.
src/ngraph/runtime/cpu/cpu_call_frame.cpp
View file @
ab34197e
...
...
@@ -148,13 +148,13 @@ void runtime::cpu::CPU_CallFrame::setup_runtime_context()
ngraph
::
runtime
::
cpu
::
CPUAllocator
*
allocator
=
nullptr
;
if
(
m_framework_allocator
&&
m_framework_deallocator
)
{
auto
fw_allocator
=
new
ngraph
::
runtime
::
FrameworkAllocator
(
m_framework_allocator
,
m_framework_deallocator
,
alignment
);
auto
fw_allocator
=
new
ngraph
::
runtime
::
FrameworkAllocator
(
m_framework_allocator
,
m_framework_deallocator
);
allocator
=
new
ngraph
::
runtime
::
cpu
::
CPUAllocator
(
fw_allocator
,
alignment
);
}
else
{
auto
sys_allocator
=
new
ngraph
::
runtime
::
SystemAllocator
(
alignment
);
auto
sys_allocator
=
new
ngraph
::
runtime
::
SystemAllocator
();
allocator
=
new
ngraph
::
runtime
::
cpu
::
CPUAllocator
(
sys_allocator
,
alignment
);
}
...
...
src/ngraph/runtime/cpu/cpu_mkl_allocator.cpp
View file @
ab34197e
...
...
@@ -31,7 +31,7 @@ ngraph::runtime::cpu::CPUAllocator::~CPUAllocator()
void
*
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
malloc
(
size_t
size
)
{
m_allocator
->
cpu_malloc
(
nullptr
,
size
,
m_alignment
);
return
m_allocator
->
cpu_malloc
(
nullptr
,
size
,
m_alignment
);
}
void
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
free
(
void
*
ptr
)
...
...
@@ -39,16 +39,21 @@ void ngraph::runtime::cpu::CPUAllocator::free(void* ptr)
m_allocator
->
cpu_free
(
nullptr
,
ptr
);
}
ngraph
::
runtime
::
SystemAllocator
::
SystemAllocator
(
size_t
alignment
)
:
m_alignment
(
alignment
)
ngraph
::
runtime
::
SystemAllocator
::
SystemAllocator
()
{
}
ngraph
::
runtime
::
FrameworkAllocator
::
FrameworkAllocator
(
AllocateFunc
allocator
,
DestroyFunc
deallocator
,
size_t
alignment
)
ngraph
::
runtime
::
SystemAllocator
::~
SystemAllocator
()
{
}
ngraph
::
runtime
::
FrameworkAllocator
::~
FrameworkAllocator
()
{
}
ngraph
::
runtime
::
FrameworkAllocator
::
FrameworkAllocator
(
AllocateFunc
&
allocator
,
DestroyFunc
&
deallocator
)
:
m_allocator
(
allocator
)
,
m_deallocator
(
deallocator
)
,
m_alignment
(
alignment
)
{
}
src/ngraph/runtime/cpu/cpu_mkl_allocator.hpp
View file @
ab34197e
...
...
@@ -22,7 +22,6 @@
#include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/util.hpp"
using
namespace
ngraph
;
using
AllocateFunc
=
void
*
(
*
)(
void
*
,
size_t
,
size_t
);
using
DestroyFunc
=
void
(
*
)(
void
*
,
void
*
);
...
...
@@ -75,6 +74,7 @@ private:
class
ngraph
::
runtime
::
Allocator
{
public
:
virtual
~
Allocator
()
=
default
;
virtual
void
*
cpu_malloc
(
void
*
,
size_t
size
,
size_t
alignment
)
=
0
;
virtual
void
cpu_free
(
void
*
ptr
,
void
*
)
=
0
;
};
...
...
@@ -84,7 +84,7 @@ public:
class
ngraph
::
runtime
::
SystemAllocator
:
public
ngraph
::
runtime
::
Allocator
{
public
:
SystemAllocator
(
size_t
alignment
);
SystemAllocator
();
~
SystemAllocator
();
void
*
cpu_malloc
(
void
*
,
size_t
size
,
size_t
alignment
)
override
...
...
@@ -107,9 +107,6 @@ public:
free
(
ptr
);
}
}
private
:
size_t
m_alignment
;
};
// FrameworkAllocator overides and implements "cpu_malloc" & "cpu_free" of Alloctaor interface class,
...
...
@@ -117,7 +114,7 @@ private:
class
ngraph
::
runtime
::
FrameworkAllocator
:
public
ngraph
::
runtime
::
Allocator
{
public
:
FrameworkAllocator
(
AllocateFunc
allocator
,
DestroyFunc
deallocator
,
size_t
alignment
);
FrameworkAllocator
(
AllocateFunc
&
allocator
,
DestroyFunc
&
deallocator
);
~
FrameworkAllocator
();
void
*
cpu_malloc
(
void
*
,
size_t
size
,
size_t
alignment
)
override
...
...
@@ -144,5 +141,4 @@ public:
private
:
AllocateFunc
m_allocator
;
DestroyFunc
m_deallocator
;
size_t
m_alignment
;
};
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