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
composable_kernel
Commits
7f3c6e28
Commit
7f3c6e28
authored
May 29, 2022
by
Anthony Chang
Browse files
add squared add reduction op; allows sq sum
parent
8c144c7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
include/ck/tensor_operation/gpu/thread/reduction_functions_threadwise.hpp
...r_operation/gpu/thread/reduction_functions_threadwise.hpp
+1
-0
include/ck/utility/reduction_operator.hpp
include/ck/utility/reduction_operator.hpp
+10
-0
No files found.
include/ck/tensor_operation/gpu/thread/reduction_functions_threadwise.hpp
View file @
7f3c6e28
...
@@ -51,6 +51,7 @@ struct ThreadwiseReduction
...
@@ -51,6 +51,7 @@ struct ThreadwiseReduction
static_assert
(
src_length_m
==
dst_length_m
,
"lengths of source and dst buffer must match!"
);
static_assert
(
src_length_m
==
dst_length_m
,
"lengths of source and dst buffer must match!"
);
using
Op
=
OpReduce
;
using
Accumulation
=
detail
::
AccumulateWithNanCheck
<
PropagateNan
,
OpReduce
,
AccDataType
>
;
using
Accumulation
=
detail
::
AccumulateWithNanCheck
<
PropagateNan
,
OpReduce
,
AccDataType
>
;
template
<
typename
SrcBufferType
,
typename
DstBufferType
>
template
<
typename
SrcBufferType
,
typename
DstBufferType
>
...
...
include/ck/utility/reduction_operator.hpp
View file @
7f3c6e28
...
@@ -71,6 +71,16 @@ struct Add
...
@@ -71,6 +71,16 @@ struct Add
__host__
__device__
inline
constexpr
void
operator
()(
T
&
a
,
T
b
)
const
{
a
=
a
+
b
;
}
__host__
__device__
inline
constexpr
void
operator
()(
T
&
a
,
T
b
)
const
{
a
=
a
+
b
;
}
};
};
template
<
class
T
>
struct
SquaredAdd
{
using
dataType
=
T
;
__host__
__device__
static
constexpr
T
GetReductionZeroVal
()
{
return
static_cast
<
T
>
(
0.0
f
);
};
__host__
__device__
inline
constexpr
void
operator
()(
T
&
a
,
T
b
)
const
{
a
=
a
+
b
*
b
;
}
};
template
<
class
T
>
template
<
class
T
>
struct
Mul
struct
Mul
{
{
...
...
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