Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
3b5d27f7
Commit
3b5d27f7
authored
Aug 25, 2022
by
Paul
Browse files
Use average
parent
a0921a37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/targets/gpu/jit/concat.cpp
src/targets/gpu/jit/concat.cpp
+9
-5
No files found.
src/targets/gpu/jit/concat.cpp
View file @
3b5d27f7
...
@@ -61,11 +61,15 @@ struct concat_compiler : compiler<concat_compiler>
...
@@ -61,11 +61,15 @@ struct concat_compiler : compiler<concat_compiler>
{
{
std
::
vector
<
std
::
string
>
names
()
const
{
return
{
"concat"
};
}
std
::
vector
<
std
::
string
>
names
()
const
{
return
{
"concat"
};
}
static
std
::
size_t
get_
min
_elements
(
const
std
::
vector
<
shape
>&
inputs
)
static
std
::
size_t
get_
concat
_elements
(
const
std
::
vector
<
shape
>&
inputs
)
{
{
auto
it
=
std
::
min_element
(
auto
total
=
std
::
accumulate
(
inputs
.
begin
(),
inputs
.
end
(),
0
,
[](
auto
x
,
auto
s
)
{
inputs
.
begin
(),
inputs
.
end
(),
by
(
std
::
less
<>
{},
[](
auto
s
)
{
return
s
.
elements
();
}));
return
x
+
s
.
elements
();
return
it
->
elements
();
});
return
total
/
inputs
.
size
();
// auto it = std::min_element(
// inputs.begin(), inputs.end(), by(std::less<>{}, [](auto s) { return s.elements(); }));
// return it->elements();
}
}
operation
compile_op
(
context
&
ctx
,
const
std
::
vector
<
shape
>&
inputs
,
const
value
&
v
)
const
operation
compile_op
(
context
&
ctx
,
const
std
::
vector
<
shape
>&
inputs
,
const
value
&
v
)
const
...
@@ -79,7 +83,7 @@ struct concat_compiler : compiler<concat_compiler>
...
@@ -79,7 +83,7 @@ struct concat_compiler : compiler<concat_compiler>
auto
vec
=
vectorize
::
elements
(
axis
,
options
.
virtual_inputs
);
auto
vec
=
vectorize
::
elements
(
axis
,
options
.
virtual_inputs
);
options
.
kernel_name
=
v
.
get
(
"kernel"
,
"concat_kernel"
);
options
.
kernel_name
=
v
.
get
(
"kernel"
,
"concat_kernel"
);
options
.
set_launch_params
(
options
.
set_launch_params
(
v
,
compute_global_for
(
ctx
,
get_
min
_elements
(
options
.
inputs
)
/
vec
.
size
,
256
));
v
,
compute_global_for
(
ctx
,
get_
concat
_elements
(
options
.
inputs
)
/
vec
.
size
,
256
));
auto
src
=
interpolate_string
(
concat_kernel
,
auto
src
=
interpolate_string
(
concat_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