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
ebd7a6f1
Commit
ebd7a6f1
authored
Dec 11, 2023
by
Paul
Browse files
Fix inner for subwave and add more tests
parent
cb11ba46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletion
+67
-1
src/targets/gpu/kernels/include/migraphx/kernels/reduce.hpp
src/targets/gpu/kernels/include/migraphx/kernels/reduce.hpp
+1
-1
test/verify/test_block_reduce_small.cpp
test/verify/test_block_reduce_small.cpp
+66
-0
No files found.
src/targets/gpu/kernels/include/migraphx/kernels/reduce.hpp
View file @
ebd7a6f1
...
...
@@ -600,7 +600,7 @@ struct subwave
template
<
class
F
,
class
N
,
class
...
Ts
>
__device__
void
inner_void_impl
(
F
f
,
N
n
,
Ts
&&
...
xs
)
const
{
idx
.
local_wave_stride
(
n
,
[
&
](
auto
j
,
auto
d
)
{
f
(
xs
(
j
,
d
)...);
});
idx
.
local_
sub
wave_stride
<
SubWaveSize
>
(
n
,
[
&
](
auto
j
,
auto
d
)
{
f
(
xs
(
j
,
d
)...);
});
}
template
<
class
R
,
class
F
,
class
N
,
class
...
Ts
>
...
...
test/verify/test_block_reduce_small.cpp
0 → 100644
View file @
ebd7a6f1
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/make_op.hpp>
template
<
int
N
,
migraphx
::
shape
::
type_t
T
>
struct
test_block_reduce_small
:
verify_program
<
test_block_reduce_small
<
N
,
T
>>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
T
,
{
2
,
N
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"x"
,
s
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_mean"
,
{{
"axes"
,
{
1
}}}),
x
);
auto
rb
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
s
.
lens
()}}),
r
);
auto
add
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
rb
,
y
);
mm
->
add_return
({
add
});
return
p
;
};
};
template
<
int
N
>
struct
test_block_reduce_small_for_size
:
test_block_reduce_small
<
N
,
migraphx
::
shape
::
half_type
>
,
test_block_reduce_small
<
N
,
migraphx
::
shape
::
float_type
>
,
test_block_reduce_small
<
N
,
migraphx
::
shape
::
int8_type
>
{
};
template
struct
test_block_reduce_small_for_size
<
2
>;
template
struct
test_block_reduce_small_for_size
<
3
>;
template
struct
test_block_reduce_small_for_size
<
4
>;
template
struct
test_block_reduce_small_for_size
<
8
>;
template
struct
test_block_reduce_small_for_size
<
16
>;
template
struct
test_block_reduce_small_for_size
<
25
>;
template
struct
test_block_reduce_small_for_size
<
32
>;
template
struct
test_block_reduce_small_for_size
<
64
>;
template
struct
test_block_reduce_small_for_size
<
67
>;
template
struct
test_block_reduce_small_for_size
<
128
>;
template
struct
test_block_reduce_small_for_size
<
129
>;
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