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
ebfbae82
Commit
ebfbae82
authored
May 17, 2022
by
turneram
Browse files
Merge remote-tracking branch 'origin/develop' into transformer-opts
parents
1974671d
a27dd28c
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
23 deletions
+31
-23
src/targets/gpu/include/migraphx/gpu/sync_device.hpp
src/targets/gpu/include/migraphx/gpu/sync_device.hpp
+1
-1
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
+1
-1
src/targets/gpu/schedule_model.cpp
src/targets/gpu/schedule_model.cpp
+8
-8
src/targets/gpu/sync_device.cpp
src/targets/gpu/sync_device.cpp
+4
-4
src/targets/gpu/write_literals.cpp
src/targets/gpu/write_literals.cpp
+7
-7
tools/install_prereqs.sh
tools/install_prereqs.sh
+10
-2
No files found.
src/targets/gpu/include/migraphx/gpu/sync_device.hpp
View file @
ebfbae82
...
...
@@ -15,7 +15,7 @@ namespace gpu {
struct
sync_device
{
std
::
string
name
()
const
{
return
"sync_device"
;
}
void
apply
(
module
&
p
)
const
;
void
apply
(
module
&
m
)
const
;
};
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
...
...
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
View file @
ebfbae82
...
...
@@ -14,7 +14,7 @@ struct write_literals
context
*
ctx
=
nullptr
;
std
::
string
name
()
const
{
return
"gpu::write_literals"
;
}
void
apply
(
module
&
p
)
const
;
void
apply
(
module
&
m
)
const
;
};
}
// namespace gpu
...
...
src/targets/gpu/schedule_model.cpp
View file @
ebfbae82
...
...
@@ -77,28 +77,28 @@ MIGRAPHX_REGISTER_OP(wait_event)
MIGRAPHX_REGISTER_OP
(
set_stream
)
std
::
size_t
schedule_model
::
concurrency
()
const
{
return
streams
;
}
void
schedule_model
::
sched
(
module
&
p
,
instruction_ref
ins
,
std
::
size_t
n
)
const
void
schedule_model
::
sched
(
module
&
m
,
instruction_ref
ins
,
std
::
size_t
n
)
const
{
auto
last_stream
=
std
::
find_if
(
std
::
make_reverse_iterator
(
ins
),
std
::
make_reverse_iterator
(
p
.
begin
()),
std
::
make_reverse_iterator
(
m
.
begin
()),
[
&
](
auto
&&
i
)
{
return
i
.
name
()
==
"gpu::set_stream"
;
});
if
(
last_stream
!=
std
::
make_reverse_iterator
(
p
.
begin
()))
if
(
last_stream
!=
std
::
make_reverse_iterator
(
m
.
begin
()))
{
auto
&&
op
=
any_cast
<
set_stream
>
(
last_stream
->
get_operator
());
// If the same stream was set earlier then skip
if
(
op
.
stream
==
n
)
return
;
}
p
.
insert_instruction
(
ins
,
set_stream
{
n
});
m
.
insert_instruction
(
ins
,
set_stream
{
n
});
}
void
schedule_model
::
wait
(
module
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_id
)
const
void
schedule_model
::
wait
(
module
&
m
,
instruction_ref
ins
,
std
::
size_t
wait_id
)
const
{
p
.
insert_instruction
(
ins
,
wait_event
{
wait_id
});
m
.
insert_instruction
(
ins
,
wait_event
{
wait_id
});
}
void
schedule_model
::
record
(
module
&
p
,
instruction_ref
ins
,
std
::
size_t
wait_id
)
const
void
schedule_model
::
record
(
module
&
m
,
instruction_ref
ins
,
std
::
size_t
wait_id
)
const
{
p
.
insert_instruction
(
std
::
next
(
ins
),
record_event
{
wait_id
});
m
.
insert_instruction
(
std
::
next
(
ins
),
record_event
{
wait_id
});
}
static
std
::
unordered_map
<
std
::
string
,
std
::
size_t
>
create_weight_map
()
...
...
src/targets/gpu/sync_device.cpp
View file @
ebfbae82
...
...
@@ -8,9 +8,9 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
void
sync_device
::
apply
(
module
&
p
)
const
void
sync_device
::
apply
(
module
&
m
)
const
{
auto
last
=
std
::
prev
(
p
.
end
());
auto
last
=
std
::
prev
(
m
.
end
());
if
(
last
->
name
()
==
"@return"
)
{
auto
inputs
=
last
->
inputs
();
...
...
@@ -18,10 +18,10 @@ void sync_device::apply(module& p) const
return
(
i
->
name
()
==
"hip::copy_from_gpu"
);
}))
{
auto
sync_in
=
p
.
insert_instruction
(
last
,
make_op
(
"hip::sync_stream"
),
inputs
);
auto
sync_in
=
m
.
insert_instruction
(
last
,
make_op
(
"hip::sync_stream"
),
inputs
);
if
(
not
inputs
.
empty
())
{
p
.
replace_instruction
(
inputs
.
front
(),
sync_in
);
m
.
replace_instruction
(
inputs
.
front
(),
sync_in
);
}
}
}
...
...
src/targets/gpu/write_literals.cpp
View file @
ebfbae82
...
...
@@ -11,25 +11,25 @@ namespace gpu {
MIGRAPHX_DECLARE_ENV_VAR
(
MIGRAPHX_COPY_LITERALS
)
void
write_literals
::
apply
(
module
&
p
)
const
void
write_literals
::
apply
(
module
&
m
)
const
{
assert
(
ctx
!=
nullptr
);
std
::
size_t
n
=
0
;
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
m
))
{
if
(
ins
->
name
()
==
"@literal"
)
{
if
(
enabled
(
MIGRAPHX_COPY_LITERALS
{}))
{
literal
l
=
ins
->
get_literal
();
auto
pre
=
p
.
add_literal
(
l
);
auto
alloc
=
p
.
insert_instruction
(
std
::
next
(
pre
),
hip_allocate
{
l
.
get_shape
()});
p
.
replace_instruction
(
ins
,
hip_copy_to_gpu
{},
pre
,
alloc
);
auto
pre
=
m
.
add_literal
(
l
);
auto
alloc
=
m
.
insert_instruction
(
std
::
next
(
pre
),
hip_allocate
{
l
.
get_shape
()});
m
.
replace_instruction
(
ins
,
hip_copy_to_gpu
{},
pre
,
alloc
);
}
else
{
std
::
string
id
=
p
.
name
()
+
":@literal:"
+
std
::
to_string
(
n
);
p
.
replace_instruction
(
ins
,
hip_copy_literal
{
ins
->
get_literal
(),
id
});
std
::
string
id
=
m
.
name
()
+
":@literal:"
+
std
::
to_string
(
n
);
m
.
replace_instruction
(
ins
,
hip_copy_literal
{
ins
->
get_literal
(),
id
});
n
++
;
}
}
...
...
tools/install_prereqs.sh
View file @
ebfbae82
...
...
@@ -4,12 +4,20 @@
set
-e
#install pip3, rocm-cmake, rocblas and miopen
apt update
&&
apt
install
-y
python3-pip rocm-cmake rocblas miopen-hip openmp-extras
export
LC_ALL
=
C.UTF-8
export
LANG
=
C.UTF-8
# Need pip3 and Python headers to build dependencies
apt update
&&
apt
install
-y
python3-pip python3-dev cmake rocm-cmake rocblas miopen-hip openmp-extras
# Needed for cmake to build various pip packages
pip3
install
setuptools wheel
# install rbuild to build dependencies
pip3
install
https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
PREFIX
=
/usr/local
REQ_FILE_DIR
=
""
if
[
"$#"
-ge
2
]
;
then
...
...
Prev
1
2
3
Next
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