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
a9325a54
Commit
a9325a54
authored
Sep 16, 2018
by
Paul
Browse files
Formating
parent
767d2885
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
25 deletions
+35
-25
src/include/migraph/instruction.hpp
src/include/migraph/instruction.hpp
+4
-2
src/program.cpp
src/program.cpp
+5
-3
test/include/rob.hpp
test/include/rob.hpp
+22
-19
test/validate.cpp
test/validate.cpp
+4
-1
No files found.
src/include/migraph/instruction.hpp
View file @
a9325a54
...
...
@@ -138,12 +138,14 @@ struct instruction
ins
->
recompute_shape
();
}
static
void
replace
(
instruction_ref
ins
,
operation
o
,
const
shape
&
r
,
std
::
vector
<
instruction_ref
>
args
)
static
void
replace
(
instruction_ref
ins
,
operation
o
,
const
shape
&
r
,
std
::
vector
<
instruction_ref
>
args
)
{
ins
->
replace
(
o
,
r
,
std
::
move
(
args
));
backreference
(
ins
);
}
private:
private:
// internal
void
replace
(
operation
o
,
const
shape
&
r
,
std
::
vector
<
instruction_ref
>
args
)
{
...
...
src/program.cpp
View file @
a9325a54
...
...
@@ -290,7 +290,8 @@ argument generic_eval(const program& p,
else
if
(
ins
->
name
()
==
"@param"
)
{
results
.
emplace
(
ins
,
trace
(
ins
,
[
&
]
{
return
params
.
at
(
any_cast
<
builtin
::
param
>
(
ins
->
get_operator
()).
parameter
);
return
params
.
at
(
any_cast
<
builtin
::
param
>
(
ins
->
get_operator
()).
parameter
);
}));
}
else
if
(
ins
->
name
()
==
"@outline"
)
...
...
@@ -305,8 +306,9 @@ argument generic_eval(const program& p,
assert
(
results
.
find
(
i
)
!=
results
.
end
());
return
results
[
i
];
});
results
.
emplace
(
ins
,
trace
(
ins
,
[
&
]
{
return
ins
->
get_operator
().
compute
(
ctx
,
ins
->
get_shape
(),
values
);
}));
results
.
emplace
(
ins
,
trace
(
ins
,
[
&
]
{
return
ins
->
get_operator
().
compute
(
ctx
,
ins
->
get_shape
(),
values
);
}));
}
assert
(
results
.
find
(
ins
)
!=
results
.
end
());
}
...
...
test/include/rob.hpp
View file @
a9325a54
...
...
@@ -10,33 +10,36 @@
template
<
class
Tag
>
struct
stowed
{
static
typename
Tag
::
type
value
;
};
template
<
class
Tag
>
static
typename
Tag
::
type
value
;
};
template
<
class
Tag
>
typename
Tag
::
type
stowed
<
Tag
>::
value
;
template
<
class
Tag
,
typename
Tag
::
type
x
>
struct
stow_private
{
stow_private
()
{
stowed
<
Tag
>::
value
=
x
;
}
static
stow_private
instance
;
stow_private
()
{
stowed
<
Tag
>::
value
=
x
;
}
static
stow_private
instance
;
};
template
<
class
Tag
,
typename
Tag
::
type
x
>
stow_private
<
Tag
,
x
>
stow_private
<
Tag
,
x
>::
instance
;
template
<
class
Tag
,
typename
Tag
::
type
x
>
stow_private
<
Tag
,
x
>
stow_private
<
Tag
,
x
>::
instance
;
template
<
class
C
,
class
T
>
struct
mem_data_ptr
{
typedef
T
(
C
::*
type
);
};
template
<
class
C
,
class
T
>
struct
mem_data_ptr
{
typedef
T
(
C
::*
type
);
};
#define MIGRAPH_ROB(name, Type, C, mem) \
struct name
##
_tag \
: mem_data_ptr<C, Type>
\
{};
\
template struct stow_private<name
##
_tag,&C::mem>; \
template<class T> \
auto& name(T&& x) \
{
\
return x.*stowed<name
##
_tag>::value; \
}
#define MIGRAPH_ROB(name, Type, C, mem)
\
struct name##_tag
: mem_data_ptr<C, Type>
\
{
\
};
\
template struct stow_private<name##_tag,
&C::mem>; \
template
<class T>
\
auto& name(T&& x)
\
{
\
return x.*stowed<name##_tag>::value;
\
}
#ifdef __clang__
#pragma clang diagnostic pop
...
...
test/validate.cpp
View file @
a9325a54
...
...
@@ -39,7 +39,10 @@ void incomplete_args()
EXPECT
(
bool
{
p
.
validate
()
==
ins
});
}
MIGRAPH_ROB
(
access_ins_arguments
,
std
::
vector
<
migraph
::
instruction_ref
>
,
migraph
::
instruction
,
arguments
)
MIGRAPH_ROB
(
access_ins_arguments
,
std
::
vector
<
migraph
::
instruction_ref
>
,
migraph
::
instruction
,
arguments
)
void
invalid_args
()
{
...
...
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