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
6430acb6
Commit
6430acb6
authored
May 26, 2019
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
47a7e128
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
16 deletions
+67
-16
backend.cpp
src/ngraph/runtime/backend.cpp
+36
-2
backend.hpp
src/ngraph/runtime/backend.hpp
+30
-13
tensor.cpp
src/ngraph/runtime/tensor.cpp
+1
-1
No files found.
src/ngraph/runtime/backend.cpp
View file @
6430acb6
...
@@ -91,10 +91,44 @@ std::shared_ptr<runtime::Executable> runtime::Backend::load(istream& input_strea
...
@@ -91,10 +91,44 @@ std::shared_ptr<runtime::Executable> runtime::Backend::load(istream& input_strea
throw
runtime_error
(
"load opertion unimplemented."
);
throw
runtime_error
(
"load opertion unimplemented."
);
}
}
void
runtime
::
Backend
::
post_write
(
const
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
)
runtime
::
Backend
::
AsyncEvent
::
AsyncEvent
(
Type
type
,
void
*
p
,
size_t
size_in_bytes
)
:
m_type
{
type
}
,
m_data
{
p
}
,
m_size_in_bytes
{
size_in_bytes
}
,
m_executable
{
nullptr
}
,
m_outputs
{
nullptr
}
,
m_inputs
{
nullptr
}
{
{
}
}
void
runtime
::
Backend
::
post_read
(
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
)
runtime
::
Backend
::
AsyncEvent
::
AsyncEvent
(
const
shared_ptr
<
Executable
>&
executable
,
const
vector
<
shared_ptr
<
runtime
::
Tensor
>>&
outputs
,
const
vector
<
shared_ptr
<
runtime
::
Tensor
>>&
inputs
)
:
m_type
{
Type
::
EXECUTE
}
,
m_data
{
nullptr
}
,
m_size_in_bytes
{
0
}
,
m_executable
{
executable
}
,
m_outputs
{
&
outputs
}
,
m_inputs
{
&
inputs
}
{
}
void
runtime
::
Backend
::
post_async_read_event
(
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
)
{
}
void
runtime
::
Backend
::
post_async_write_event
(
const
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
)
{
}
void
runtime
::
Backend
::
post_async_execute_event
(
const
std
::
shared_ptr
<
Executable
>&
executable
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>&
inputs
,
std
::
promise
<
void
>&
promise
)
{
{
}
}
src/ngraph/runtime/backend.hpp
View file @
6430acb6
...
@@ -143,25 +143,42 @@ public:
...
@@ -143,25 +143,42 @@ public:
protected
:
protected
:
friend
class
ngraph
::
runtime
::
Tensor
;
friend
class
ngraph
::
runtime
::
Tensor
;
void
post_write
(
const
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
);
void
post_read
(
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
);
class
ReadWriteInfo
class
AsyncEvent
{
{
public
:
public
:
ReadWriteInfo
(
void
*
p
,
size_t
size
,
bool
is_read
)
enum
class
Type
:
m_data
{
p
}
,
m_size_in_bytes
{
size
}
,
m_is_read
{
is_read
}
{
{
}
READ
,
bool
is_read
()
const
{
return
m_is_read
;
}
WRITE
,
bool
is_write
()
const
{
return
!
is_read
();
}
EXECUTE
void
*
get_ptr
()
const
{
return
m_data
;
}
};
void
*
get_data
()
const
{
return
m_data
;
}
bool
get_size_in_bytes
()
const
{
return
m_size_in_bytes
;
}
bool
get_size_in_bytes
()
const
{
return
m_size_in_bytes
;
}
Type
get_type
()
const
{
return
m_type
;
}
std
::
shared_ptr
<
Executable
>
get_executable
()
const
{
return
m_executable
;
}
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>*
get_outputs
()
const
{
return
m_outputs
;
}
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>*
get_inputs
()
const
{
return
m_inputs
;
}
private
:
private
:
AsyncEvent
(
Type
,
void
*
p
,
size_t
size_in_bytes
);
AsyncEvent
(
const
std
::
shared_ptr
<
Executable
>&
m_executable
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>&
m_outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>&
m_inputs
);
const
Type
m_type
;
void
*
m_data
;
void
*
m_data
;
size_t
m_size_in_bytes
;
const
size_t
m_size_in_bytes
;
bool
m_is_read
;
std
::
shared_ptr
<
Executable
>
m_executable
;
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>*
m_outputs
;
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>*
m_inputs
;
};
};
void
post_async_read_event
(
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
);
void
post_async_write_event
(
const
void
*
p
,
size_t
size_in_bytes
,
std
::
promise
<
void
>&
promise
);
void
post_async_execute_event
(
const
std
::
shared_ptr
<
Executable
>&
executable
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>&
outputs
,
const
std
::
vector
<
std
::
shared_ptr
<
runtime
::
Tensor
>>&
inputs
,
std
::
promise
<
void
>&
promise
);
};
};
src/ngraph/runtime/tensor.cpp
View file @
6430acb6
...
@@ -103,7 +103,7 @@ future<void> runtime::Tensor::begin_write(const void* p, size_t n)
...
@@ -103,7 +103,7 @@ future<void> runtime::Tensor::begin_write(const void* p, size_t n)
if
(
m_backend
)
if
(
m_backend
)
{
{
auto
f
=
m_promise
.
get_future
();
auto
f
=
m_promise
.
get_future
();
m_backend
->
post_
write
(
p
,
n
,
m_promise
);
m_backend
->
post_
async_write_event
(
p
,
n
,
m_promise
);
return
f
;
return
f
;
}
}
else
else
...
...
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