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
e8ebfa27
Commit
e8ebfa27
authored
Mar 21, 2019
by
pruthvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change getters signature return type to onnx runtime function signature
parent
39e82f08
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
83 deletions
+6
-83
backend.cpp
src/ngraph/runtime/backend.cpp
+2
-2
backend.hpp
src/ngraph/runtime/backend.hpp
+2
-2
cpu_allocator.hpp
src/ngraph/runtime/cpu/cpu_allocator.hpp
+2
-76
cpu_backend.hpp
src/ngraph/runtime/cpu/cpu_backend.hpp
+0
-3
No files found.
src/ngraph/runtime/backend.cpp
View file @
e8ebfa27
...
...
@@ -65,12 +65,12 @@ void runtime::Backend::remove_compiled_function(std::shared_ptr<Executable> exec
{
}
void
*
runtime
::
Backend
::
get_device_memory_alloc
()
ngraph
::
runtime
::
AllocateFunc
runtime
::
Backend
::
get_device_memory_alloc
()
{
return
nullptr
;
}
void
*
runtime
::
Backend
::
get_device_memory_dealloc
()
ngraph
::
runtime
::
DestroyFunc
runtime
::
Backend
::
get_device_memory_dealloc
()
{
return
nullptr
;
}
...
...
src/ngraph/runtime/backend.hpp
View file @
e8ebfa27
...
...
@@ -117,7 +117,7 @@ public:
virtual
void
remove_compiled_function
(
std
::
shared_ptr
<
Executable
>
exec
);
virtual
void
*
get_device_memory_alloc
();
virtual
void
*
get_device_memory_dealloc
();
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_allocator.hpp
View file @
e8ebfa27
...
...
@@ -45,8 +45,6 @@ namespace ngraph
namespace
runtime
{
class
Allocator
;
//class SystemAllocator;
//class FrameworkAllocator;
namespace
cpu
{
class
CPUAllocator
;
...
...
@@ -61,7 +59,7 @@ public:
CPUAllocator
();
~
CPUAllocator
();
void
*
Malloc
(
void
*
handle
,
size_t
size
,
size_t
alignment
)
override
void
*
Malloc
(
void
*
handle
,
size_t
size
,
size_t
alignment
)
{
void
*
ptr
=
malloc
(
size
);
// check for exception
...
...
@@ -72,7 +70,7 @@ public:
}
return
ptr
;
}
void
Free
(
void
*
handle
,
void
*
ptr
)
override
void
Free
(
void
*
handle
,
void
*
ptr
)
{
if
(
ptr
)
{
...
...
@@ -80,75 +78,3 @@ public:
}
}
};
/*// Abstarct class for the allocator
class ngraph::runtime::Allocator
{
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:
SystemAllocator(size_t alignment);
~SystemAllocator();
void* cpu_malloc(void*, size_t size, size_t alignment) override
{
void* ptr = malloc(size);
// check for exception
if (size != 0 && !ptr)
{
throw ngraph_error("malloc failed to allocate memory of size " + std::to_string(size));
throw std::bad_alloc();
}
return ptr;
}
void cpu_free(void* ptr, void*) override
{
if (ptr)
{
free(ptr);
}
}
private:
size_t m_alignment;
};
class ngraph::runtime::FrameworkAllocator : public ngraph::runtime::Allocator
{
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);
// check for exception
if (size != 0 && !ptr)
{
throw ngraph_error("malloc failed to allocate memory of size " + std::to_string(size));
throw std::bad_alloc();
}
return ptr;
}
void cpu_free(void* ptr, void*) override
{
if (ptr)
{
m_deallocator(nullptr, ptr);
}
}
private:
AllocateFunc m_allocator;
DestroyFunc m_deallocator;
size_t m_alignment;
};*/
src/ngraph/runtime/cpu/cpu_backend.hpp
View file @
e8ebfa27
...
...
@@ -67,9 +67,6 @@ namespace ngraph
bool
is_supported
(
const
Node
&
node
)
const
override
;
bool
is_supported_property
(
const
Property
prop
)
const
override
;
//static inline void* MallocHook(size_t size);
//static inline void FreeHook(void *ptr);
private
:
std
::
unordered_map
<
std
::
shared_ptr
<
Function
>
,
std
::
shared_ptr
<
Executable
>>
m_exec_map
;
...
...
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