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
52223d46
Commit
52223d46
authored
May 26, 2023
by
Paul
Browse files
Move time_op to migraphx_gpu
parent
da29ed61
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
20 deletions
+12
-20
src/targets/gpu/CMakeLists.txt
src/targets/gpu/CMakeLists.txt
+1
-0
src/targets/gpu/compile_ops.cpp
src/targets/gpu/compile_ops.cpp
+8
-13
src/targets/gpu/driver/compile_op.cpp
src/targets/gpu/driver/compile_op.cpp
+1
-1
src/targets/gpu/driver/run_op.cpp
src/targets/gpu/driver/run_op.cpp
+1
-1
src/targets/gpu/include/migraphx/gpu/time_op.hpp
src/targets/gpu/include/migraphx/gpu/time_op.hpp
+0
-2
src/targets/gpu/time_op.cpp
src/targets/gpu/time_op.cpp
+1
-3
No files found.
src/targets/gpu/CMakeLists.txt
View file @
52223d46
...
@@ -122,6 +122,7 @@ add_library(migraphx_gpu
...
@@ -122,6 +122,7 @@ add_library(migraphx_gpu
schedule_model.cpp
schedule_model.cpp
sync_device.cpp
sync_device.cpp
target.cpp
target.cpp
time_op.cpp
topk.cpp
topk.cpp
write_literals.cpp
write_literals.cpp
${
JIT_GPU_SRCS
}
${
JIT_GPU_SRCS
}
...
...
src/targets/gpu/compile_ops.cpp
View file @
52223d46
...
@@ -81,20 +81,17 @@ struct compile_plan
...
@@ -81,20 +81,17 @@ struct compile_plan
context
*
ctx
;
context
*
ctx
;
operation
preop
;
operation
preop
;
instruction_ref
ins
;
instruction_ref
ins
;
optional
<
tuning_config
>
config
=
nullopt
;
optional
<
tuning_config
>
config
=
nullopt
;
std
::
vector
<
compiled_result
>
results
=
{};
std
::
vector
<
compiled_result
>
results
=
{};
void
update_config
()
void
update_config
()
{
config
=
get_tuning_config
(
*
ctx
,
ins
,
preop
);
}
{
template
<
class
Vector
>
config
=
get_tuning_config
(
*
ctx
,
ins
,
preop
);
}
template
<
class
Vector
>
void
add_compiles
(
Vector
&
compiles
)
void
add_compiles
(
Vector
&
compiles
)
{
{
if
(
config
.
has_value
())
if
(
config
.
has_value
())
{
{
const
auto
&
solutions
=
config
.
value
().
solutions
;
const
auto
&
solutions
=
config
.
value
().
solutions
;
results
.
resize
(
solutions
.
size
());
results
.
resize
(
solutions
.
size
());
for
(
auto
i
:
range
(
solutions
.
size
()))
for
(
auto
i
:
range
(
solutions
.
size
()))
{
{
auto
solution
=
solutions
[
i
];
auto
solution
=
solutions
[
i
];
compiles
.
emplace_back
([
=
]
{
compiles
.
emplace_back
([
=
]
{
...
@@ -143,19 +140,17 @@ void compile_ops::apply(module& m) const
...
@@ -143,19 +140,17 @@ void compile_ops::apply(module& m) const
cps
.
push_back
({
ctx
,
preop
,
ins
});
cps
.
push_back
({
ctx
,
preop
,
ins
});
}
}
// Get the tuning configs for all ops
// Get the tuning configs for all ops
par_compile
(
cps
.
size
(),
[
&
](
auto
i
)
{
par_compile
(
cps
.
size
(),
[
&
](
auto
i
)
{
cps
[
i
].
update_config
();
});
cps
[
i
].
update_config
();
});
// Compile everything in parallel
// Compile everything in parallel
std
::
vector
<
std
::
function
<
void
()
>>
compiles
;
std
::
vector
<
std
::
function
<
void
()
>>
compiles
;
for
(
auto
&
cp
:
cps
)
for
(
auto
&
cp
:
cps
)
{
{
cp
.
add_compiles
(
compiles
);
cp
.
add_compiles
(
compiles
);
}
}
par_compile
(
compiles
.
size
(),
[
&
](
auto
i
)
{
compiles
[
i
]();
});
par_compile
(
compiles
.
size
(),
[
&
](
auto
i
)
{
compiles
[
i
]();
});
// Replace and/or benchmark
// Replace and/or benchmark
for
(
const
auto
&
cp
:
cps
)
for
(
const
auto
&
cp
:
cps
)
{
{
cp
.
replace
(
m
);
cp
.
replace
(
m
);
}
}
...
...
src/targets/gpu/driver/compile_op.cpp
View file @
52223d46
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#include <migraphx/gpu/driver/action.hpp>
#include <migraphx/gpu/driver/action.hpp>
#include <migraphx/gpu/
driver/perf
.hpp>
#include <migraphx/gpu/
time_op
.hpp>
#include <migraphx/gpu/compiler.hpp>
#include <migraphx/gpu/compiler.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/context.hpp>
...
...
src/targets/gpu/driver/run_op.cpp
View file @
52223d46
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#include <migraphx/gpu/driver/action.hpp>
#include <migraphx/gpu/driver/action.hpp>
#include <migraphx/gpu/
driver/perf
.hpp>
#include <migraphx/gpu/
time_op
.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
...
...
src/targets/gpu/
driver/
include/migraphx/gpu/
driver/perf
.hpp
→
src/targets/gpu/include/migraphx/gpu/
time_op
.hpp
View file @
52223d46
...
@@ -31,12 +31,10 @@
...
@@ -31,12 +31,10 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
driver
{
std
::
pair
<
double
,
double
>
std
::
pair
<
double
,
double
>
time_op
(
context
&
ictx
,
operation
op
,
const
std
::
vector
<
shape
>&
inputs
,
int
n
=
100
);
time_op
(
context
&
ictx
,
operation
op
,
const
std
::
vector
<
shape
>&
inputs
,
int
n
=
100
);
}
// namespace driver
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/targets/gpu/
driver/perf
.cpp
→
src/targets/gpu/
time_op
.cpp
View file @
52223d46
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* THE SOFTWARE.
*/
*/
#include <migraphx/gpu/
driver/perf
.hpp>
#include <migraphx/gpu/
time_op
.hpp>
#include <migraphx/context.hpp>
#include <migraphx/context.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/time.hpp>
#include <migraphx/time.hpp>
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
driver
{
std
::
vector
<
argument
>
generate_arguments
(
const
std
::
vector
<
shape
>&
shapes
,
unsigned
long
seed
=
0
)
std
::
vector
<
argument
>
generate_arguments
(
const
std
::
vector
<
shape
>&
shapes
,
unsigned
long
seed
=
0
)
{
{
...
@@ -69,7 +68,6 @@ time_op(context& ictx, operation op, const std::vector<shape>& inputs, int n)
...
@@ -69,7 +68,6 @@ time_op(context& ictx, operation op, const std::vector<shape>& inputs, int n)
return
std
::
make_pair
(
host_time
/
n
,
device_time
/
n
);
return
std
::
make_pair
(
host_time
/
n
,
device_time
/
n
);
}
}
}
// namespace driver
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
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