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
c5d87f8f
Commit
c5d87f8f
authored
Sep 15, 2022
by
Paul
Browse files
Format
parent
9466f4c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
10 deletions
+14
-10
src/targets/gpu/compile_gen.cpp
src/targets/gpu/compile_gen.cpp
+10
-5
src/targets/gpu/include/migraphx/gpu/compile_gen.hpp
src/targets/gpu/include/migraphx/gpu/compile_gen.hpp
+3
-1
src/targets/gpu/jit/pointwise.cpp
src/targets/gpu/jit/pointwise.cpp
+1
-4
No files found.
src/targets/gpu/compile_gen.cpp
View file @
c5d87f8f
...
@@ -49,7 +49,9 @@ static std::vector<std::size_t> vector_sizes(const std::vector<shape>& inputs)
...
@@ -49,7 +49,9 @@ static std::vector<std::size_t> vector_sizes(const std::vector<shape>& inputs)
return
{
4
,
2
};
return
{
4
,
2
};
}
}
vectorize
vectorize
::
elements
(
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
,
const
std
::
vector
<
std
::
size_t
>&
sizes
)
vectorize
vectorize
::
elements
(
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
,
const
std
::
vector
<
std
::
size_t
>&
sizes
)
{
{
if
(
std
::
all_of
(
if
(
std
::
all_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
const
auto
&
s
)
{
return
s
.
lens
()[
axis
]
==
1
;
}))
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
const
auto
&
s
)
{
return
s
.
lens
()[
axis
]
==
1
;
}))
...
@@ -83,16 +85,19 @@ vectorize vectorize::elements(std::size_t axis, const std::vector<shape>& inputs
...
@@ -83,16 +85,19 @@ vectorize vectorize::elements(std::size_t axis, const std::vector<shape>& inputs
vectorize
vectorize
::
elements
(
context
&
ctx
,
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
)
vectorize
vectorize
::
elements
(
context
&
ctx
,
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
)
{
{
if
(
inputs
.
empty
())
if
(
inputs
.
empty
())
return
{
1
,
axis
};
return
{
1
,
axis
};
std
::
size_t
n
=
std
::
max_element
(
inputs
.
begin
(),
inputs
.
end
(),
by
(
std
::
less
<>
{},
[](
const
auto
&
s
)
{
return
s
.
elements
();
}))
->
elements
();
std
::
size_t
n
=
std
::
max_element
(
inputs
.
begin
(),
inputs
.
end
(),
by
(
std
::
less
<>
{},
[](
const
auto
&
s
)
{
return
s
.
elements
();
}))
->
elements
();
std
::
size_t
max_global
=
ctx
.
get_current_device
().
get_cu_count
()
*
std
::
size_t
max_global
=
ctx
.
get_current_device
().
get_cu_count
()
*
ctx
.
get_current_device
().
get_max_workitems_per_cu
();
ctx
.
get_current_device
().
get_max_workitems_per_cu
();
std
::
size_t
over
=
n
/
max_global
;
std
::
size_t
over
=
n
/
max_global
;
std
::
vector
<
std
::
size_t
>
sizes
;
std
::
vector
<
std
::
size_t
>
sizes
;
if
(
over
>
8
)
if
(
over
>
8
)
sizes
.
push_back
(
8
);
sizes
.
push_back
(
8
);
if
(
over
>
4
)
if
(
over
>
4
)
sizes
.
push_back
(
4
);
sizes
.
push_back
(
4
);
sizes
.
push_back
(
2
);
sizes
.
push_back
(
2
);
return
elements
(
axis
,
inputs
,
sizes
);
return
elements
(
axis
,
inputs
,
sizes
);
...
...
src/targets/gpu/include/migraphx/gpu/compile_gen.hpp
View file @
c5d87f8f
...
@@ -47,7 +47,9 @@ struct vectorize
...
@@ -47,7 +47,9 @@ struct vectorize
std
::
size_t
axis
=
0
;
std
::
size_t
axis
=
0
;
static
vectorize
elements
(
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
);
static
vectorize
elements
(
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
);
static
vectorize
elements
(
context
&
ctx
,
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
);
static
vectorize
elements
(
context
&
ctx
,
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
);
static
vectorize
elements
(
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
,
const
std
::
vector
<
std
::
size_t
>&
sizes
);
static
vectorize
elements
(
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
,
const
std
::
vector
<
std
::
size_t
>&
sizes
);
std
::
string
str
()
const
;
std
::
string
str
()
const
;
};
};
struct
preload
struct
preload
...
...
src/targets/gpu/jit/pointwise.cpp
View file @
c5d87f8f
...
@@ -78,10 +78,7 @@ struct pointwise_compiler : compiler<pointwise_compiler>
...
@@ -78,10 +78,7 @@ struct pointwise_compiler : compiler<pointwise_compiler>
auto
vec
=
vectorize
::
elements
(
ctx
,
axis
,
options
.
virtual_inputs
);
auto
vec
=
vectorize
::
elements
(
ctx
,
axis
,
options
.
virtual_inputs
);
options
.
kernel_name
=
v
.
get
(
"kernel"
,
"kernel"
);
options
.
kernel_name
=
v
.
get
(
"kernel"
,
"kernel"
);
options
.
set_launch_params
(
options
.
set_launch_params
(
v
,
v
,
compute_global_for
(
ctx
,
options
.
output
.
elements
()
/
vec
.
size
,
256
));
compute_global_for
(
ctx
,
options
.
output
.
elements
()
/
vec
.
size
,
256
));
auto
src
=
interpolate_string
(
pointwise_kernel
,
auto
src
=
interpolate_string
(
pointwise_kernel
,
{{
"kernel"
,
options
.
kernel_name
},
{{
"kernel"
,
options
.
kernel_name
},
{
"params"
,
enum_params
(
inputs
.
size
(),
"void * private_p"
)},
{
"params"
,
enum_params
(
inputs
.
size
(),
"void * private_p"
)},
...
...
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