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
2a3ebb35
Commit
2a3ebb35
authored
Mar 06, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fix compilation error
parent
594e3f9e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
54 deletions
+38
-54
cpu_aligned_buffer.cpp
src/ngraph/runtime/cpu/cpu_aligned_buffer.cpp
+3
-1
cpu_aligned_buffer.hpp
src/ngraph/runtime/cpu/cpu_aligned_buffer.hpp
+3
-1
cpu_call_frame.cpp
src/ngraph/runtime/cpu/cpu_call_frame.cpp
+6
-8
cpu_mkl_allocator.cpp
src/ngraph/runtime/cpu/cpu_mkl_allocator.cpp
+16
-23
cpu_mkl_allocator.hpp
src/ngraph/runtime/cpu/cpu_mkl_allocator.hpp
+10
-21
No files found.
src/ngraph/runtime/cpu/cpu_aligned_buffer.cpp
View file @
2a3ebb35
...
...
@@ -22,7 +22,9 @@
using
namespace
ngraph
;
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
,
ngraph
::
runtime
::
cpu
::
CPUAllocator
*
cpu_allocator
)
{
m_byte_size
=
byte_size
;
m_cpu_allocator
=
cpu_allocator
;
...
...
src/ngraph/runtime/cpu/cpu_aligned_buffer.hpp
View file @
2a3ebb35
...
...
@@ -36,7 +36,9 @@ namespace ngraph
class
ngraph
::
runtime
::
cpu
::
CPUAlignedBuffer
{
public
:
CPUAlignedBuffer
(
size_t
byte_size
,
size_t
alignment
,
ngraph
::
runtime
::
cpu
::
CPUAllocator
*
cpu_allocator
);
CPUAlignedBuffer
(
size_t
byte_size
,
size_t
alignment
,
ngraph
::
runtime
::
cpu
::
CPUAllocator
*
cpu_allocator
);
~
CPUAlignedBuffer
();
size_t
size
()
const
{
return
m_byte_size
;
}
...
...
src/ngraph/runtime/cpu/cpu_call_frame.cpp
View file @
2a3ebb35
...
...
@@ -145,19 +145,17 @@ void runtime::cpu::CPU_CallFrame::setup_runtime_context()
// Create temporary buffer pools
size_t
alignment
=
runtime
::
cpu
::
CPU_ExternalFunction
::
s_memory_pool_alignment
;
// assign the passed memory allocators
/*ngraph::runtime::cpu::CPUAllocator::framework_allocator = m_framework_allocator;
ngraph::runtime::cpu::CPUAllocator::framework_deallocator = m_framework_deallocator;
ngraph::runtime::cpu::CPUAllocator::alignment = alignment;
*/
std
::
unique_ptr
<
ngraph
::
runtime
::
cpu
::
CPUAllocator
>
alloctor
=
nullptr
;
ngraph
::
runtime
::
cpu
::
CPUAllocator
*
allocator
=
nullptr
;
if
(
m_framework_allocator
&&
m_framework_deallocator
)
{
alloctor
=
new
ngraph
::
runtime
::
cpu
::
CPUAllocator
(
ngraph
::
runtime
::
FrameworkAllocator
(
m_framework_allocator
,
m_framework_deallocator
,
s_memory_pool_alignment
));
auto
fw_allocator
=
new
ngraph
::
runtime
::
FrameworkAllocator
(
m_framework_allocator
,
m_framework_deallocator
,
alignment
);
allocator
=
new
ngraph
::
runtime
::
cpu
::
CPUAllocator
(
fw_allocator
,
alignment
);
}
else
{
allocator
=
new
ngraph
::
runtime
::
cpu
::
CPUAllocator
(
ngraph
::
runtime
::
SystemAllocator
(
s_memory_pool_alignment
));
auto
sys_allocator
=
new
ngraph
::
runtime
::
SystemAllocator
(
alignment
);
allocator
=
new
ngraph
::
runtime
::
cpu
::
CPUAllocator
(
sys_allocator
,
alignment
);
}
for
(
auto
buffer_size
:
m_external_function
->
get_memory_buffer_sizes
())
...
...
src/ngraph/runtime/cpu/cpu_mkl_allocator.cpp
View file @
2a3ebb35
...
...
@@ -14,48 +14,41 @@
// limitations under the License.
//*****************************************************************************
#include "ngraph/runtime/cpu/cpu_mkl_allocator.hpp"
#include <string>
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/cpu_mkl_allocator.hpp"
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
CPUAllocator
()
{
}
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
CPUAllocator
(
ngraph
::
runtime
::
Allocator
*
allocator
)
:
m_allocator
(
allocator
)
ngraph
::
runtime
::
cpu
::
CPUAllocator
::
CPUAllocator
(
ngraph
::
runtime
::
Allocator
*
allocator
,
size_t
alignment
)
:
m_allocator
(
allocator
)
,
m_alignment
(
alignment
)
{
}
ngraph
::
runtime
::
cpu
::
CPUAllocator
::~
CPUAllocator
()
{
}
void
*
ngraph
::
runtime
::
cpu
::
cpu
Allocator
::
malloc
(
size_t
size
)
void
*
ngraph
::
runtime
::
cpu
::
CPU
Allocator
::
malloc
(
size_t
size
)
{
m_allocator
->
cpu_malloc
(
size
);
m_allocator
->
cpu_malloc
(
nullptr
,
size
,
m_alignment
);
}
void
ngraph
::
runtime
::
cpu
::
cpu
Allocator
::
free
(
void
*
ptr
)
void
ngraph
::
runtime
::
cpu
::
CPU
Allocator
::
free
(
void
*
ptr
)
{
m_allocator
->
cpu_free
(
ptr
);
m_allocator
->
cpu_free
(
nullptr
,
ptr
);
}
ngraph
::
runtime
::
SystemAllocator
::
SystemAllocator
(
size_t
alignment
)
:
m_alignment
(
alignment
)
:
m_alignment
(
alignment
)
{
}
ngraph
::
runtime
::
FrameworkAllocator
::
FrameworkAllocator
(
AllocateFunc
allocator
,
DestroyFunc
deallocator
,
size_t
alignment
)
:
m_allocator
(
allocator
)
,
m_deallocator
(
deallocator
)
,
m_alignment
(
alignment
)
ngraph
::
runtime
::
FrameworkAllocator
::
FrameworkAllocator
(
AllocateFunc
allocator
,
DestroyFunc
deallocator
,
size_t
alignment
)
:
m_allocator
(
allocator
)
,
m_deallocator
(
deallocator
)
,
m_alignment
(
alignment
)
{
}
src/ngraph/runtime/cpu/cpu_mkl_allocator.hpp
View file @
2a3ebb35
...
...
@@ -18,9 +18,9 @@
#include <cstddef>
#include <cstdint>
#include "ngraph/except.hpp"
#include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/util.hpp"
#include "ngraph/except.hpp"
using
namespace
ngraph
;
using
AllocateFunc
=
void
*
(
*
)(
void
*
,
size_t
,
size_t
);
...
...
@@ -51,8 +51,6 @@ namespace ngraph
namespace
cpu
{
class
CPUAllocator
;
void
*
cpu_malloc
(
size_t
size
,
size_t
alignment
,
AllocateFunc
framework_allocator
);
void
cpu_free
(
void
*
ptr
,
DestroyFunc
framework_deallocator
);
}
}
}
...
...
@@ -60,40 +58,34 @@ namespace ngraph
class
ngraph
::
runtime
::
cpu
::
CPUAllocator
{
public
:
CPUAllocator
(
ngraph
::
runtime
::
Allocator
*
alloctor
);
CPUAllocator
();
CPUAllocator
(
ngraph
::
runtime
::
Allocator
*
alloctor
,
size_t
alignment
);
~
CPUAllocator
();
void
*
malloc
(
size_t
size
);
void
free
(
void
*
ptr
);
private
:
std
::
unique_ptr
<
ngraph
::
runtime
::
Allocator
>
m_allocator
;
size_t
m_alignment
;
};
// Abstarct class for the allocator
class
ngraph
::
runtime
::
Allocator
{
public
:
public
:
virtual
void
*
cpu_malloc
(
void
*
,
size_t
size
,
size_t
alignment
)
=
0
;
virtual
void
cpu_free
(
void
*
ptr
,
void
*
)
=
0
;
};
class
ngraph
::
runtime
::
SystemAllocator
:
public
ngraph
::
runtime
::
Allocator
{
public
:
public
:
SystemAllocator
(
size_t
alignment
);
~
SystemAllocator
();
void
*
cpu_malloc
(
void
*
,
size_t
size
,
size_t
alignment
)
override
{
void
*
ptr
=
malloc
(
size
);
void
*
ptr
=
malloc
(
size
);
// check for exception
if
(
size
!=
0
&&
!
ptr
)
...
...
@@ -112,21 +104,19 @@ class ngraph::runtime::SystemAllocator : public ngraph::runtime::Allocator
}
}
private
:
private
:
size_t
m_alignment
;
};
class
ngraph
::
runtime
::
FrameworkAllocator
:
public
ngraph
::
runtime
::
Allocator
{
public
:
public
:
FrameworkAllocator
(
AllocateFunc
allocator
,
DestroyFunc
deallocator
,
size_t
alignment
);
~
FrameworkAllocator
();
void
*
cpu_malloc
(
void
*
,
size_t
size
,
size_t
alignment
)
override
{
void
*
ptr
=
m_allocator
(
nullptr
,
alignment
,
size
);
void
*
ptr
=
m_allocator
(
nullptr
,
alignment
,
size
);
// check for exception
if
(
size
!=
0
&&
!
ptr
)
...
...
@@ -145,9 +135,8 @@ class ngraph::runtime::FrameworkAllocator : public ngraph::runtime::Allocator
}
}
private
:
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