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
3577a3bd
Commit
3577a3bd
authored
Jun 21, 2022
by
Paul
Browse files
Merge branch 'type-string-driver' into driver-help-errors
parents
4d882650
1b098fd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
src/driver/argument_parser.hpp
src/driver/argument_parser.hpp
+27
-1
No files found.
src/driver/argument_parser.hpp
View file @
3577a3bd
...
@@ -118,6 +118,32 @@ struct value_parser
...
@@ -118,6 +118,32 @@ struct value_parser
}
}
};
};
template
<
class
T
>
struct
type_name
{
static
const
std
::
string
&
apply
()
{
return
migraphx
::
get_type_name
<
T
>
();
}
};
template
<
>
struct
type_name
<
std
::
string
>
{
static
const
std
::
string
&
apply
()
{
static
const
std
::
string
name
=
"std::string"
;
return
name
;
}
};
template
<
class
T
>
struct
type_name
<
std
::
vector
<
T
>>
{
static
const
std
::
string
&
apply
()
{
static
const
std
::
string
name
=
"std::vector<"
+
type_name
<
T
>::
apply
()
+
">"
;
return
name
;
}
};
struct
argument_parser
struct
argument_parser
{
{
struct
argument
struct
argument
...
@@ -166,7 +192,7 @@ struct argument_parser
...
@@ -166,7 +192,7 @@ struct argument_parser
}});
}});
argument
&
arg
=
arguments
.
back
();
argument
&
arg
=
arguments
.
back
();
arg
.
type
=
migraphx
::
get_
type_name
<
T
>
();
arg
.
type
=
type_name
<
T
>
::
apply
();
migraphx
::
each_args
([
&
](
auto
f
)
{
f
(
x
,
arg
);
},
fs
...);
migraphx
::
each_args
([
&
](
auto
f
)
{
f
(
x
,
arg
);
},
fs
...);
if
(
not
arg
.
default_value
.
empty
()
and
arg
.
nargs
>
0
)
if
(
not
arg
.
default_value
.
empty
()
and
arg
.
nargs
>
0
)
arg
.
default_value
=
as_string_value
(
x
);
arg
.
default_value
=
as_string_value
(
x
);
...
...
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