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
e279b402
"vscode:/vscode.git/clone" did not exist on "ab733e7b392c00b063f92f0b6097493203def7e9"
Commit
e279b402
authored
Jun 08, 2023
by
rocking
Browse files
Add more operations
parent
b3bc666b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
include/ck/tensor_operation/gpu/grid/gridwise_put_element_1d.hpp
.../ck/tensor_operation/gpu/grid/gridwise_put_element_1d.hpp
+16
-5
No files found.
include/ck/tensor_operation/gpu/grid/gridwise_put_element_1d.hpp
View file @
e279b402
...
...
@@ -25,6 +25,7 @@ __global__ void kernel_put_element_1d(const InGrid1dDesc in_grid_1d_desc,
in_grid_1d_desc
,
p_in_global
,
p_indices_global
,
p_out_global
,
elementwise_op
);
}
// output[indices] = input
template
<
typename
InGrid1dDesc
,
typename
InDataType
,
typename
IndexDataType
,
...
...
@@ -116,10 +117,6 @@ struct GridwisePutElement_1D
static_for
<
0
,
InVectorSize
,
1
>
{}([
&
](
auto
iM
)
{
if
(
indices_thread_buf
[
iM
]
>=
0
)
{
// TODO - Support other operations
static_assert
(
MemOp
==
InMemoryDataOperationEnum
::
Set
||
MemOp
==
InMemoryDataOperationEnum
::
AtomicAdd
);
if
constexpr
(
MemOp
==
InMemoryDataOperationEnum
::
Set
)
{
// User should guarantee each index in p_indices_global is different
...
...
@@ -131,9 +128,23 @@ struct GridwisePutElement_1D
atomic_add
<
OutDataType
>
(
p_out_global
+
indices_thread_buf
[
iM
],
ck
::
type_convert
<
OutDataType
>
(
in_thread_buf
[
iM
]));
}
else
if
constexpr
(
MemOp
==
InMemoryDataOperationEnum
::
AtomicMax
)
{
atomic_max
<
OutDataType
>
(
p_out_global
+
indices_thread_buf
[
iM
],
ck
::
type_convert
<
OutDataType
>
(
in_thread_buf
[
iM
]));
}
else
if
constexpr
(
MemOp
==
InMemoryDataOperationEnum
::
Add
)
{
// User should guarantee each index in p_indices_global is different
*
(
p_out_global
+
indices_thread_buf
[
iM
])
+=
ck
::
type_convert
<
OutDataType
>
(
in_thread_buf
[
iM
]);
}
else
{
// TODO
static_assert
(
MemOp
==
InMemoryDataOperationEnum
::
Set
||
MemOp
==
InMemoryDataOperationEnum
::
AtomicAdd
||
MemOp
==
InMemoryDataOperationEnum
::
AtomicMax
||
MemOp
==
InMemoryDataOperationEnum
::
Add
);
}
}
});
...
...
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