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
ead6317d
Commit
ead6317d
authored
Mar 31, 2022
by
Umang Yadav
Committed by
Chris Austen
Mar 31, 2022
Browse files
Change the doc to mention only gpu or ref as targets (#1153)
Documentation update for valid targets
parent
cd0a4aa5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
doc/src/reference/py.rst
doc/src/reference/py.rst
+1
-1
src/register_target.cpp
src/register_target.cpp
+12
-2
test/targets.cpp
test/targets.cpp
+5
-0
No files found.
doc/src/reference/py.rst
View file @
ead6317d
...
@@ -121,7 +121,7 @@ target
...
@@ -121,7 +121,7 @@ target
Constructs the target.
Constructs the target.
:param str name: The name of the target to construct. This can either be '
c
pu' or '
gpu
'.
:param str name: The name of the target to construct. This can either be '
g
pu' or '
ref
'.
:rtype: target
:rtype: target
...
...
src/register_target.cpp
View file @
ead6317d
#include <migraphx/register_target.hpp>
#include <unordered_map>
#include <unordered_map>
#include <migraphx/register_target.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
@@ -11,7 +11,17 @@ std::unordered_map<std::string, target>& target_map()
...
@@ -11,7 +11,17 @@ std::unordered_map<std::string, target>& target_map()
}
}
void
register_target
(
const
target
&
t
)
{
target_map
()[
t
.
name
()]
=
t
;
}
void
register_target
(
const
target
&
t
)
{
target_map
()[
t
.
name
()]
=
t
;
}
target
make_target
(
const
std
::
string
&
name
)
{
return
target_map
().
at
(
name
);
}
target
make_target
(
const
std
::
string
&
name
)
{
const
auto
it
=
target_map
().
find
(
name
);
if
(
it
==
target_map
().
end
())
{
MIGRAPHX_THROW
(
"Requested target '"
+
name
+
"' is not enabled or not supported"
);
}
return
it
->
second
;
}
std
::
vector
<
std
::
string
>
get_targets
()
std
::
vector
<
std
::
string
>
get_targets
()
{
{
std
::
vector
<
std
::
string
>
result
;
std
::
vector
<
std
::
string
>
result
;
...
...
test/targets.cpp
View file @
ead6317d
...
@@ -12,6 +12,11 @@ TEST_CASE(make_target)
...
@@ -12,6 +12,11 @@ TEST_CASE(make_target)
}
}
}
}
TEST_CASE
(
make_invalid_target
)
{
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
make_target
(
"mi100"
);
}));
}
TEST_CASE
(
targets
)
TEST_CASE
(
targets
)
{
{
auto
ts
=
migraphx
::
get_targets
();
auto
ts
=
migraphx
::
get_targets
();
...
...
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