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
45fa26fb
Commit
45fa26fb
authored
May 16, 2018
by
Paul
Browse files
Make stream op optional
parent
e788222e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
14 deletions
+30
-14
include/rtg/operation.hpp
include/rtg/operation.hpp
+13
-0
test/eval_test.cpp
test/eval_test.cpp
+0
-12
tools/include/operation.hpp
tools/include/operation.hpp
+12
-1
tools/te.py
tools/te.py
+5
-1
No files found.
include/rtg/operation.hpp
View file @
45fa26fb
...
@@ -11,6 +11,16 @@
...
@@ -11,6 +11,16 @@
namespace
rtg
{
namespace
rtg
{
namespace
operation_stream
{
template
<
class
T
>
auto
operator
<<
(
std
::
ostream
&
os
,
const
T
&
x
)
->
decltype
(
os
<<
x
.
name
())
{
return
os
<<
x
.
name
();
}
}
// namespace operation_stream
/*
/*
* Type-erased interface for:
* Type-erased interface for:
*
*
...
@@ -142,16 +152,19 @@ struct operation
...
@@ -142,16 +152,19 @@ struct operation
shape
compute_shape
(
std
::
vector
<
shape
>
input
)
const
override
shape
compute_shape
(
std
::
vector
<
shape
>
input
)
const
override
{
{
return
private_detail_te_value
.
compute_shape
(
std
::
move
(
input
));
return
private_detail_te_value
.
compute_shape
(
std
::
move
(
input
));
}
}
argument
compute
(
std
::
vector
<
argument
>
input
)
const
override
argument
compute
(
std
::
vector
<
argument
>
input
)
const
override
{
{
return
private_detail_te_value
.
compute
(
std
::
move
(
input
));
return
private_detail_te_value
.
compute
(
std
::
move
(
input
));
}
}
std
::
ostream
&
operator_shift_left
(
std
::
ostream
&
os
)
const
override
std
::
ostream
&
operator_shift_left
(
std
::
ostream
&
os
)
const
override
{
{
using
rtg
::
operation_stream
::
operator
<<
;
return
os
<<
private_detail_te_value
;
return
os
<<
private_detail_te_value
;
}
}
...
...
test/eval_test.cpp
View file @
45fa26fb
...
@@ -31,12 +31,6 @@ struct sum_op
...
@@ -31,12 +31,6 @@ struct sum_op
RTG_THROW
(
"Wrong inputs"
);
RTG_THROW
(
"Wrong inputs"
);
return
inputs
.
front
();
return
inputs
.
front
();
}
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
sum_op
&
op
)
{
os
<<
op
.
name
();
return
os
;
}
};
};
struct
minus_op
struct
minus_op
...
@@ -66,12 +60,6 @@ struct minus_op
...
@@ -66,12 +60,6 @@ struct minus_op
RTG_THROW
(
"Wrong inputs"
);
RTG_THROW
(
"Wrong inputs"
);
return
inputs
.
front
();
return
inputs
.
front
();
}
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
minus_op
&
op
)
{
os
<<
op
.
name
();
return
os
;
}
};
};
struct
id_target
struct
id_target
...
...
tools/include/operation.hpp
View file @
45fa26fb
...
@@ -11,12 +11,23 @@
...
@@ -11,12 +11,23 @@
namespace
rtg
{
namespace
rtg
{
namespace
operation_stream
{
template
<
class
T
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
T
&
x
)
{
os
<<
x
.
name
();
return
os
;
}
}
<%
<%
interface
(
'
operation
'
,
interface
(
'
operation
'
,
virtual
(
'
name
'
,
returns
=
'
std
::
string
'
,
const
=
True
),
virtual
(
'
name
'
,
returns
=
'
std
::
string
'
,
const
=
True
),
virtual
(
'
compute_shape
'
,
returns
=
'
shape
'
,
input
=
'
std
::
vector
<
shape
>
'
,
const
=
True
),
virtual
(
'
compute_shape
'
,
returns
=
'
shape
'
,
input
=
'
std
::
vector
<
shape
>
'
,
const
=
True
),
virtual
(
'
compute
'
,
returns
=
'
argument
'
,
input
=
'
std
::
vector
<
argument
>
'
,
const
=
True
),
virtual
(
'
compute
'
,
returns
=
'
argument
'
,
input
=
'
std
::
vector
<
argument
>
'
,
const
=
True
),
friend
(
'
operator
<<
'
,
returns
=
'
std
::
ostream
&
'
,
os
=
'
std
::
ostream
&
'
,
op
=
'
const
operation
&
'
)
friend
(
'
operator
<<
'
,
returns
=
'
std
::
ostream
&
'
,
os
=
'
std
::
ostream
&
'
,
op
=
'
const
operation
&
'
,
using
=
'
rtg
::
operation_stream
::
operator
<<
'
)
)
)
%>
%>
...
...
tools/te.py
View file @
45fa26fb
...
@@ -173,6 +173,7 @@ pure_virtual_member = string.Template("virtual ${return_type} ${internal_name}($
...
@@ -173,6 +173,7 @@ pure_virtual_member = string.Template("virtual ${return_type} ${internal_name}($
virtual_member
=
string
.
Template
(
'''
virtual_member
=
string
.
Template
(
'''
${return_type} ${internal_name}(${member_params}) ${member_const} override
${return_type} ${internal_name}(${member_params}) ${member_const} override
{
{
${using}
return ${call};
return ${call};
}
}
'''
)
'''
)
...
@@ -217,7 +218,8 @@ def convert_member(d, struct_name):
...
@@ -217,7 +218,8 @@ def convert_member(d, struct_name):
'const'
:
''
,
'const'
:
''
,
'member_const'
:
''
,
'member_const'
:
''
,
'friend'
:
''
,
'friend'
:
''
,
'this'
:
'(*this)'
'this'
:
'(*this)'
,
'using'
:
''
}
}
args
=
[]
args
=
[]
params
=
[]
params
=
[]
...
@@ -237,6 +239,8 @@ def convert_member(d, struct_name):
...
@@ -237,6 +239,8 @@ def convert_member(d, struct_name):
member
[
'member_const'
]
=
'const'
member
[
'member_const'
]
=
'const'
elif
x
==
'friend'
:
elif
x
==
'friend'
:
member
[
'friend'
]
=
'friend'
member
[
'friend'
]
=
'friend'
elif
x
==
'using'
:
member
[
'using'
]
=
'using {};'
.
format
(
d
[
name
][
'using'
])
else
:
else
:
use_member
=
not
(
skip
and
struct_name
==
trim_type_name
(
t
))
use_member
=
not
(
skip
and
struct_name
==
trim_type_name
(
t
))
arg_name
=
x
arg_name
=
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