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
55a5d084
Commit
55a5d084
authored
Mar 03, 2019
by
Paul
Browse files
Formatting
parent
1cbbb897
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
test/schedule_test.cpp
test/schedule_test.cpp
+13
-16
No files found.
test/schedule_test.cpp
View file @
55a5d084
...
@@ -50,11 +50,9 @@ using instruction_map = std::unordered_map<migraphx::instruction_ref, std::size_
...
@@ -50,11 +50,9 @@ using instruction_map = std::unordered_map<migraphx::instruction_ref, std::size_
struct
schedule_model_test
struct
schedule_model_test
{
{
instruction_map
*
ins2stream
;
instruction_map
*
ins2stream
;
std
::
size_t
concurrency
()
const
std
::
size_t
concurrency
()
const
{
return
4
;
}
{
void
return
4
;
schedule_instruction
(
migraphx
::
program
&
p
,
migraphx
::
instruction_ref
ins
,
std
::
size_t
n
)
const
}
void
schedule_instruction
(
migraphx
::
program
&
p
,
migraphx
::
instruction_ref
ins
,
std
::
size_t
n
)
const
{
{
(
*
ins2stream
)[
ins
]
=
n
;
(
*
ins2stream
)[
ins
]
=
n
;
}
}
...
@@ -63,11 +61,10 @@ struct schedule_model_test
...
@@ -63,11 +61,10 @@ struct schedule_model_test
std
::
size_t
wait_on
,
std
::
size_t
wait_on
,
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
const
std
::
vector
<
std
::
size_t
>&
wait_for
)
const
{
{
}
}
std
::
size_t
weight
(
const
migraphx
::
operation
&
op
)
const
std
::
size_t
weight
(
const
migraphx
::
operation
&
op
)
const
{
{
if
(
op
.
name
()
==
"binary"
or
op
.
name
()
==
"unary"
)
if
(
op
.
name
()
==
"binary"
or
op
.
name
()
==
"unary"
)
return
4
;
return
4
;
else
else
return
1
;
return
1
;
...
@@ -87,15 +84,15 @@ struct schedule_target
...
@@ -87,15 +84,15 @@ struct schedule_target
bool
check_conflicts
(
migraphx
::
program
&
p
,
migraphx
::
instruction_ref
x
,
migraphx
::
instruction_ref
y
)
bool
check_conflicts
(
migraphx
::
program
&
p
,
migraphx
::
instruction_ref
x
,
migraphx
::
instruction_ref
y
)
{
{
for
(
auto
ins
:
migraphx
::
iterator_for
(
p
))
for
(
auto
ins
:
migraphx
::
iterator_for
(
p
))
{
{
if
(
ins
->
name
()
!=
"identity"
)
if
(
ins
->
name
()
!=
"identity"
)
continue
;
continue
;
if
(
ins
->
inputs
().
size
()
!=
2
)
if
(
ins
->
inputs
().
size
()
!=
2
)
continue
;
continue
;
if
(
ins
->
inputs
()
==
std
::
vector
<
migraphx
::
instruction_ref
>
{
x
,
y
})
if
(
ins
->
inputs
()
==
std
::
vector
<
migraphx
::
instruction_ref
>
{
x
,
y
})
return
true
;
return
true
;
if
(
ins
->
inputs
()
==
std
::
vector
<
migraphx
::
instruction_ref
>
{
y
,
x
})
if
(
ins
->
inputs
()
==
std
::
vector
<
migraphx
::
instruction_ref
>
{
y
,
x
})
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -105,10 +102,10 @@ TEST_CASE(test1)
...
@@ -105,10 +102,10 @@ TEST_CASE(test1)
{
{
instruction_map
ins2stream
;
instruction_map
ins2stream
;
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
one
=
p
.
add_literal
(
1
);
auto
one
=
p
.
add_literal
(
1
);
auto
two
=
p
.
add_literal
(
2
);
auto
two
=
p
.
add_literal
(
2
);
auto
onep
=
p
.
add_instruction
(
unary_op
{},
one
);
auto
onep
=
p
.
add_instruction
(
unary_op
{},
one
);
auto
twop
=
p
.
add_instruction
(
unary_op
{},
two
);
auto
twop
=
p
.
add_instruction
(
unary_op
{},
two
);
auto
binary
=
p
.
add_instruction
(
binary_op
{},
onep
,
twop
);
auto
binary
=
p
.
add_instruction
(
binary_op
{},
onep
,
twop
);
p
.
compile
(
schedule_target
{
&
ins2stream
});
p
.
compile
(
schedule_target
{
&
ins2stream
});
EXPECT
(
ins2stream
.
at
(
onep
)
!=
ins2stream
.
at
(
twop
));
EXPECT
(
ins2stream
.
at
(
onep
)
!=
ins2stream
.
at
(
twop
));
...
...
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