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
21da04c5
Commit
21da04c5
authored
Feb 28, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style-fix
parent
d676fb77
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
27 deletions
+20
-27
cpu_aligned_buffer.cpp
src/ngraph/runtime/cpu/cpu_aligned_buffer.cpp
+3
-13
cpu_aligned_buffer.hpp
src/ngraph/runtime/cpu/cpu_aligned_buffer.hpp
+1
-4
cpu_call_frame.cpp
src/ngraph/runtime/cpu/cpu_call_frame.cpp
+5
-2
cpu_mkl_allocator.cpp
src/ngraph/runtime/cpu/cpu_mkl_allocator.cpp
+6
-3
cpu_mkl_allocator.hpp
src/ngraph/runtime/cpu/cpu_mkl_allocator.hpp
+5
-5
No files found.
src/ngraph/runtime/cpu/cpu_aligned_buffer.cpp
View file @
21da04c5
...
...
@@ -22,20 +22,10 @@
using
namespace
ngraph
;
runtime
::
cpu
::
CPUAlignedBuffer
::
CPUAlignedBuffer
()
:
m_cpu_allocator
(
nullptr
,
nullptr
,
0
)
,
m_allocated_buffer
(
nullptr
)
,
m_aligned_buffer
(
nullptr
)
,
m_byte_size
(
0
)
{
}
runtime
::
cpu
::
CPUAlignedBuffer
::
CPUAlignedBuffer
(
size_t
byte_size
,
size_t
alignment
,
ngraph
::
runtime
::
cpu
::
CPUAllocator
&
cpu_allocator
)
runtime
::
cpu
::
CPUAlignedBuffer
::
CPUAlignedBuffer
(
size_t
byte_size
,
size_t
alignment
)
{
m_byte_size
=
byte_size
;
AllocateFunc
allocator
=
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
m_
framework_allocator
;
AllocateFunc
allocator
=
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
framework_allocator
;
if
(
m_byte_size
>
0
)
{
size_t
allocation_size
=
m_byte_size
+
alignment
;
...
...
@@ -58,7 +48,7 @@ runtime::cpu::CPUAlignedBuffer::CPUAlignedBuffer(size_t byte_size,
runtime
::
cpu
::
CPUAlignedBuffer
::~
CPUAlignedBuffer
()
{
DestroyFunc
deallocator
=
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
m_
framework_deallocator
;
DestroyFunc
deallocator
=
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
framework_deallocator
;
if
(
m_allocated_buffer
!=
nullptr
)
{
ngraph
::
runtime
::
cpu
::
cpu_free
(
m_allocated_buffer
,
deallocator
);
...
...
src/ngraph/runtime/cpu/cpu_aligned_buffer.hpp
View file @
21da04c5
...
...
@@ -36,10 +36,7 @@ namespace ngraph
class
ngraph
::
runtime
::
cpu
::
CPUAlignedBuffer
{
public
:
CPUAlignedBuffer
(
size_t
byte_size
,
size_t
alignment
,
ngraph
::
runtime
::
cpu
::
CPUAllocator
&
cpu_allocator
);
CPUAlignedBuffer
();
CPUAlignedBuffer
(
size_t
byte_size
,
size_t
alignment
);
~
CPUAlignedBuffer
();
size_t
size
()
const
{
return
m_byte_size
;
}
...
...
src/ngraph/runtime/cpu/cpu_call_frame.cpp
View file @
21da04c5
...
...
@@ -126,10 +126,13 @@ void runtime::cpu::CPU_CallFrame::setup_runtime_context()
// Create temporary buffer pools
size_t
alignment
=
runtime
::
cpu
::
CPU_ExternalFunction
::
s_memory_pool_alignment
;
CPUAllocator
cpu_allocator
(
nullptr
,
nullptr
,
alignment
);
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
framework_allocator
=
nullptr
;
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
framework_deallocator
=
nullptr
;
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
alignment
=
alignment
;
for
(
auto
buffer_size
:
m_external_function
->
get_memory_buffer_sizes
())
{
auto
buffer
=
new
CPUAlignedBuffer
(
buffer_size
,
alignment
,
cpu_allocator
);
auto
buffer
=
new
CPUAlignedBuffer
(
buffer_size
,
alignment
);
ctx
->
memory_buffers
.
push_back
(
buffer
);
}
const
auto
&
mkldnn_emitter
=
m_external_function
->
get_mkldnn_emitter
();
...
...
src/ngraph/runtime/cpu/cpu_mkl_allocator.cpp
View file @
21da04c5
...
...
@@ -17,14 +17,17 @@
#include "ngraph/runtime/cpu/cpu_mkl_allocator.hpp"
#include <string>
#include "ngraph/except.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
CPUAllocator
()
{
}
AllocateFunc
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
m_framework_allocator
=
nullptr
;
DestroyFunc
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
m_framework_deallocator
=
nullptr
;
size_t
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
m_alignment
=
4096
;
AllocateFunc
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
framework_allocator
=
nullptr
;
DestroyFunc
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
framework_deallocator
=
nullptr
;
size_t
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
alignment
=
ngraph
::
runtime
::
cpu
::
CPU_ExternalFunction
::
s_memory_pool_alignment
;
;
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
CPUAllocator
(
AllocateFunc
allocator
,
DestroyFunc
deallocator
,
...
...
src/ngraph/runtime/cpu/cpu_mkl_allocator.hpp
View file @
21da04c5
...
...
@@ -60,18 +60,18 @@ public:
CPUAllocator
();
~
CPUAllocator
();
static
AllocateFunc
m_
framework_allocator
;
static
DestroyFunc
m_
framework_deallocator
;
static
size_t
m_
alignment
;
static
AllocateFunc
framework_allocator
;
static
DestroyFunc
framework_deallocator
;
static
size_t
alignment
;
private
:
static
inline
void
*
MallocHook
(
size_t
size
)
{
ngraph
::
runtime
::
cpu
::
cpu_malloc
(
size
,
m_alignment
,
m_
framework_allocator
);
ngraph
::
runtime
::
cpu
::
cpu_malloc
(
size
,
alignment
,
framework_allocator
);
}
static
inline
void
FreeHook
(
void
*
ptr
)
{
ngraph
::
runtime
::
cpu
::
cpu_free
(
ptr
,
m_
framework_deallocator
);
ngraph
::
runtime
::
cpu
::
cpu_free
(
ptr
,
framework_deallocator
);
}
};
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