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
74b3d019
Commit
74b3d019
authored
Aug 20, 2018
by
Paul
Browse files
Formatting
parent
4f778e9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
src/include/migraph/generate.hpp
src/include/migraph/generate.hpp
+4
-4
src/include/migraph/tracer.hpp
src/include/migraph/tracer.hpp
+10
-14
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+15
-11
No files found.
src/include/migraph/generate.hpp
View file @
74b3d019
...
...
@@ -10,10 +10,10 @@ namespace migraph {
template
<
class
T
>
struct
xorshf96_generator
{
long
max
=
16
;
unsigned
long
x
=
123456789
;
unsigned
long
y
=
362436069
;
unsigned
long
z
=
521288629
;
long
max
=
16
;
unsigned
long
x
=
123456789
;
unsigned
long
y
=
362436069
;
unsigned
long
z
=
521288629
;
constexpr
T
operator
()()
noexcept
{
...
...
src/include/migraph/tracer.hpp
View file @
74b3d019
...
...
@@ -7,36 +7,32 @@ namespace migraph {
struct
swallow
{
template
<
class
...
Ts
>
template
<
class
...
Ts
>
swallow
(
Ts
&&
...)
{}
{
}
};
struct
tracer
{
tracer
()
{}
tracer
()
{}
tracer
(
std
::
ostream
&
s
)
:
os
(
&
s
)
{}
tracer
(
std
::
ostream
&
s
)
:
os
(
&
s
)
{}
bool
enabled
()
const
{
return
os
!=
nullptr
;
}
bool
enabled
()
const
{
return
os
!=
nullptr
;
}
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
operator
()(
const
Ts
&
...
xs
)
const
{
if
(
os
!=
nullptr
)
if
(
os
!=
nullptr
)
{
swallow
{
*
os
<<
xs
...};
*
os
<<
std
::
endl
;
}
}
private:
std
::
ostream
*
os
=
nullptr
;
private:
std
::
ostream
*
os
=
nullptr
;
};
}
// namespace migraph
...
...
test/gpu/miopen.cpp
View file @
74b3d019
...
...
@@ -24,16 +24,20 @@
// An improved async, that doesn't block
template
<
class
Function
>
std
::
future
<
typename
std
::
result_of
<
Function
()
>::
type
>
detach_async
(
Function
&&
f
,
bool
parallel
=
true
)
std
::
future
<
typename
std
::
result_of
<
Function
()
>::
type
>
detach_async
(
Function
&&
f
,
bool
parallel
=
true
)
{
if
(
parallel
){
using
result_type
=
typename
std
::
result_of
<
Function
()
>::
type
;
std
::
packaged_task
<
result_type
()
>
task
(
std
::
forward
<
Function
>
(
f
));
auto
fut
=
task
.
get_future
();
std
::
thread
(
std
::
move
(
task
)).
detach
();
return
std
::
move
(
fut
);
}
else
{
return
std
::
async
(
std
::
launch
::
deferred
,
std
::
move
(
f
));
if
(
parallel
)
{
using
result_type
=
typename
std
::
result_of
<
Function
()
>::
type
;
std
::
packaged_task
<
result_type
()
>
task
(
std
::
forward
<
Function
>
(
f
));
auto
fut
=
task
.
get_future
();
std
::
thread
(
std
::
move
(
task
)).
detach
();
return
std
::
move
(
fut
);
}
else
{
return
std
::
async
(
std
::
launch
::
deferred
,
std
::
move
(
f
));
}
}
...
...
@@ -57,10 +61,10 @@ std::array<std::function<void()>, 2> auto_print::handlers = {};
void
compile_check
(
migraph
::
program
&
p
,
migraph
::
target
t
)
{
auto
name
=
t
.
name
();
auto
s
=
p
.
get_shape
();
auto
s
=
p
.
get_shape
();
std
::
stringstream
ss
;
p
.
compile
(
std
::
move
(
t
),
migraph
::
tracer
{
ss
});
if
(
p
.
get_shape
()
!=
s
)
if
(
p
.
get_shape
()
!=
s
)
{
std
::
cout
<<
ss
.
str
()
<<
std
::
endl
;
throw
std
::
runtime_error
(
"Compiling program with "
+
name
+
" alters its shape"
);
...
...
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