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
b456d5e5
Commit
b456d5e5
authored
May 17, 2022
by
rocking
Browse files
Add template argument of dim . Prepare to support multiple dimension
parent
c2626122
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
example/19_binary_elementwise/broadcast_add.cpp
example/19_binary_elementwise/broadcast_add.cpp
+1
-1
include/ck/tensor_operation/gpu/device/device_binary_elementwise.hpp
...tensor_operation/gpu/device/device_binary_elementwise.hpp
+16
-4
No files found.
example/19_binary_elementwise/broadcast_add.cpp
View file @
b456d5e5
...
...
@@ -26,7 +26,7 @@ using EltwiseComputeDataType = F32;
using
Add
=
ck
::
tensor_operation
::
binary_element_wise
::
Add
;
using
DeviceElementwiseAddInstance
=
ck
::
tensor_operation
::
device
::
DeviceBinaryElementwise
<
F16
,
F16
,
CDataType
,
EltwiseComputeDataType
,
Add
,
8
>
;
DeviceBinaryElementwise
<
F16
,
F16
,
CDataType
,
EltwiseComputeDataType
,
Add
,
2
,
8
>
;
template
<
typename
HostTensorA
,
typename
HostTensorB
,
...
...
include/ck/tensor_operation/gpu/device/device_binary_elementwise.hpp
View file @
b456d5e5
...
...
@@ -15,15 +15,16 @@ template <typename ADataType,
typename
CDataType
,
typename
ComputeDataType
,
typename
ElementwiseFunctor
,
index_t
Dim
,
index_t
ScalarPerVector
>
struct
DeviceBinaryElementwise
:
public
BaseOperator
{
static
constexpr
auto
I0
=
Number
<
0
>
{};
static
auto
MakeDescriptor_M0
(
const
std
::
vector
<
int
>&
shape
,
const
std
::
vector
<
int
>&
stride
,
index_t
gridSize
,
index_t
threadPerBlock
)
static
auto
MakeDescriptor_M0
_2d
(
const
std
::
vector
<
int
>&
shape
,
const
std
::
vector
<
int
>&
stride
,
index_t
gridSize
,
index_t
threadPerBlock
)
{
const
int
m
=
shape
[
0
];
const
int
n
=
shape
[
1
];
...
...
@@ -51,6 +52,17 @@ struct DeviceBinaryElementwise : public BaseOperator
return
desc_m0_pad
;
}
static
auto
MakeDescriptor_M0
(
const
std
::
vector
<
int
>&
shape
,
const
std
::
vector
<
int
>&
stride
,
index_t
gridSize
,
index_t
threadPerBlock
)
{
if
constexpr
(
Dim
==
2
)
return
MakeDescriptor_M0_2d
(
shape
,
stride
,
gridSize
,
threadPerBlock
);
else
return
make_naive_tensor_descriptor
(
make_tuple
(
0
),
make_tuple
(
0
));
}
using
GridDesc_M0
=
decltype
(
MakeDescriptor_M0
({
1
,
1
},
{
1
,
1
},
1
,
1
));
using
GridwiseBinEltwise
=
GridwiseBinaryElementwise_1D
<
ADataType
,
BDataType
,
...
...
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