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
153053fa
Commit
153053fa
authored
Apr 26, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressed PR comments
parent
5abfaebf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
aligned_buffer.cpp
src/ngraph/runtime/aligned_buffer.cpp
+2
-2
allocator.cpp
src/ngraph/runtime/allocator.cpp
+3
-3
allocator.hpp
src/ngraph/runtime/allocator.hpp
+2
-2
No files found.
src/ngraph/runtime/aligned_buffer.cpp
View file @
153053fa
...
...
@@ -38,7 +38,7 @@ runtime::AlignedBuffer::AlignedBuffer(size_t byte_size, size_t alignment, Alloca
{
m_byte_size
=
std
::
max
<
size_t
>
(
1
,
byte_size
);
size_t
allocation_size
=
m_byte_size
+
alignment
;
m_allocated_buffer
=
static_cast
<
char
*>
(
m_allocator
->
M
alloc
(
allocation_size
,
alignment
));
m_allocated_buffer
=
static_cast
<
char
*>
(
m_allocator
->
m
alloc
(
allocation_size
,
alignment
));
m_aligned_buffer
=
m_allocated_buffer
;
size_t
mod
=
size_t
(
m_aligned_buffer
)
%
alignment
;
...
...
@@ -52,6 +52,6 @@ runtime::AlignedBuffer::~AlignedBuffer()
{
if
(
m_allocated_buffer
!=
nullptr
)
{
m_allocator
->
F
ree
(
m_allocated_buffer
);
m_allocator
->
f
ree
(
m_allocated_buffer
);
}
}
src/ngraph/runtime/allocator.cpp
View file @
153053fa
...
...
@@ -23,7 +23,7 @@ ngraph::runtime::Allocator::~Allocator()
class
ngraph
::
runtime
::
DefaultAllocator
:
public
ngraph
::
runtime
::
Allocator
{
public
:
void
*
M
alloc
(
size_t
size
,
size_t
alignment
)
void
*
m
alloc
(
size_t
size
,
size_t
alignment
)
{
// If allocation succeeds, returns a pointer to the lowest (first) byte in the
// allocated memory block that is suitably aligned for any scalar type.
...
...
@@ -40,7 +40,7 @@ public:
return
ptr
;
}
void
F
ree
(
void
*
ptr
)
void
f
ree
(
void
*
ptr
)
{
if
(
ptr
)
{
...
...
@@ -51,6 +51,6 @@ public:
ngraph
::
runtime
::
Allocator
*
ngraph
::
runtime
::
get_ngraph_allocator
()
{
auto
allocator
=
new
ngraph
::
runtime
::
DefaultAllocator
();
static
DefaultAllocator
*
allocator
=
new
DefaultAllocator
();
return
allocator
;
}
src/ngraph/runtime/allocator.hpp
View file @
153053fa
...
...
@@ -42,9 +42,9 @@ public:
/// \brief allocates memory with the given size and alignment requirement
/// \param size exact size of bytes to allocate
/// \param alignment specifies the alignment. Must be a valid alignment supported by the implementation.
virtual
void
*
M
alloc
(
size_t
size
,
size_t
alignment
)
=
0
;
virtual
void
*
m
alloc
(
size_t
size
,
size_t
alignment
)
=
0
;
/// \brief deallocates the memory pointed by ptr
/// \param ptr pointer to the aligned memory to be released
virtual
void
F
ree
(
void
*
ptr
)
=
0
;
virtual
void
f
ree
(
void
*
ptr
)
=
0
;
};
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