Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
1b56b01b
Commit
1b56b01b
authored
Jul 28, 2022
by
Ted Themistokleous
Browse files
Work in progress initial stream sync spelunking
parent
4918d769
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
5 deletions
+37
-5
src/api/api.cpp
src/api/api.cpp
+5
-0
src/api/include/migraphx/migraphx.hpp
src/api/include/migraphx/migraphx.hpp
+2
-1
src/include/migraphx/context.hpp
src/include/migraphx/context.hpp
+15
-0
src/include/migraphx/program.hpp
src/include/migraphx/program.hpp
+1
-0
src/targets/gpu/include/migraphx/gpu/context.hpp
src/targets/gpu/include/migraphx/gpu/context.hpp
+9
-0
tools/api/api.cpp
tools/api/api.cpp
+5
-4
No files found.
src/api/api.cpp
View file @
1b56b01b
...
...
@@ -242,6 +242,11 @@ bool equal(const T& x, const T& y)
}
std
::
vector
<
argument
>
run
(
program
&
p
,
const
parameter_map
&
params
)
{
return
p
.
eval
(
params
);
}
std
::
vector
<
argument
>
run_async
(
program
&
p
,
const
parameter_map
&
params
,
const
execution_environment
&
exec_env
)
{
return
p
.
eval
(
params
,
exec_env
);
}
std
::
vector
<
shape
>
get_output_shapes
(
program
&
p
)
{
return
p
.
get_output_shapes
();
}
...
...
src/api/include/migraphx/migraphx.hpp
View file @
1b56b01b
...
...
@@ -972,7 +972,8 @@ struct program : MIGRAPHX_HANDLE_BASE(program)
}
/// Run the program using the inputs passed in
arguments
eval
(
const
program_parameters
&
pparams
)
const
arguments
eval
(
const
program_parameters
&
pparams
,
const
execution_environment
&
e
=
{
nullptr
,
false
})
const
{
migraphx_arguments_t
pout
;
call
(
&
migraphx_program_run
,
&
pout
,
this
->
get_handle_ptr
(),
pparams
.
get_handle_ptr
());
...
...
src/include/migraphx/context.hpp
View file @
1b56b01b
...
...
@@ -76,8 +76,13 @@ struct context
value
to_value
()
const
;
// (optional)
void
from_value
(
const
value
&
v
);
// (optional)
any_ptr
get_queue
();
// Used for async streams
void
wait_for
(
any_ptr
queue
);
void
finish_on
(
any_ptr
queue
);
//
void
finish
()
const
;
};
...
...
@@ -165,6 +170,16 @@ struct context
return
(
*
this
).
private_detail_te_get_handle
().
get_queue
();
}
void
wait_for
(
any_ptr
queue
)
{
// TODO
}
void
finish_on
(
any_ptr
queue
)
{
// TODO
}
void
finish
()
const
{
assert
((
*
this
).
private_detail_te_handle_mem_var
);
...
...
src/include/migraphx/program.hpp
View file @
1b56b01b
...
...
@@ -77,6 +77,7 @@ struct program
std
::
unordered_map
<
std
::
string
,
shape
>
get_parameter_shapes
()
const
;
std
::
vector
<
argument
>
eval
(
parameter_map
params
)
const
;
std
::
vector
<
argument
>
eval
(
parameter_map
params
,
execution_environment
exec_env
)
const
;
std
::
size_t
size
()
const
;
...
...
src/targets/gpu/include/migraphx/gpu/context.hpp
View file @
1b56b01b
...
...
@@ -194,6 +194,12 @@ struct hip_device
std
::
unordered_map
<
std
::
string
,
argument
>
preallocations
{};
};
struct
excecution_environment
{
any_ptr
queue
=
nullptr
;
bool
async
=
false
;
};
struct
context
{
context
(
std
::
size_t
device_id
=
0
,
std
::
size_t
n
=
value_of
(
MIGRAPHX_NSTREAMS
{},
1
))
...
...
@@ -265,6 +271,9 @@ struct context
this
->
current_device
=
std
::
make_shared
<
hip_device
>
(
0
,
n_streams
);
}
void
wait_for
(
any_ptr
queue
)
{}
void
finish_on
(
any_ptr
queue
)
{}
any_ptr
get_queue
()
{
return
get_stream
().
get
();
}
private:
...
...
tools/api/api.cpp
View file @
1b56b01b
...
...
@@ -87,13 +87,14 @@ migraphx_status try_(F f, bool output = true) // NOLINT
shape
::
type_t
to_shape_type
(
migraphx_shape_datatype_t
t
)
{
switch
(
t
)
{
void
wait_for
()
const
{
call
(
&
case
migraphx_shape_tuple_type
:
return
shape
::
tuple_type
;
#define MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT(x, y) \
case migraphx_shape_##x: return shape::x;
MIGRAPHX_SHAPE_VISIT_TYPES
(
MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT
)
#undef MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT
}
MIGRAPHX_SHAPE_VISIT_TYPES
(
MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT
)
#
undef
MIGRAPHX_DETAIL_SHAPE_CASE_CONVERT
}
MIGRAPHX_THROW
(
migraphx_status_bad_param
,
"Unknown type"
);
}
...
...
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