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
5ae42120
"tests/vscode:/vscode.git/clone" did not exist on "41ae6708280ba84a4671d20fbb4d52f176083faa"
Commit
5ae42120
authored
Sep 06, 2022
by
Po-Yen, Chen
Browse files
Only accept single-input-single-output for 'DervicePermute'
parent
179092df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
33 deletions
+11
-33
example/36_permute/permute_fp16.cpp
example/36_permute/permute_fp16.cpp
+1
-1
include/ck/tensor_operation/gpu/device/device_permute.hpp
include/ck/tensor_operation/gpu/device/device_permute.hpp
+10
-32
No files found.
example/36_permute/permute_fp16.cpp
View file @
5ae42120
...
@@ -7,7 +7,7 @@ using ADataType = F16;
...
@@ -7,7 +7,7 @@ using ADataType = F16;
using
BDataType
=
F16
;
using
BDataType
=
F16
;
using
DevicePermuteInstance
=
ck
::
tensor_operation
::
device
::
using
DevicePermuteInstance
=
ck
::
tensor_operation
::
device
::
DevicePermute
<
ck
::
Tuple
<
ADataType
>
,
ck
::
Tuple
<
BDataType
>
,
PassThrough
,
4
,
8
,
S
<
8
>
,
S
<
1
>>
;
DevicePermute
<
ADataType
,
BDataType
,
PassThrough
,
4
,
8
,
S
<
8
>
,
S
<
1
>>
;
#include "run_permute_example.inc"
#include "run_permute_example.inc"
...
...
include/ck/tensor_operation/gpu/device/device_permute.hpp
View file @
5ae42120
...
@@ -51,52 +51,30 @@ struct DevicePermuteBase : BaseOperator
...
@@ -51,52 +51,30 @@ struct DevicePermuteBase : BaseOperator
};
};
}
// namespace detail
}
// namespace detail
template
<
typename
InDataType
Tuple
,
template
<
typename
InDataType
,
typename
OutDataType
Tuple
,
typename
OutDataType
,
typename
ElementwiseOperation
,
typename
ElementwiseOperation
,
index_t
NumDim
,
index_t
NumDim
,
index_t
MPerThread
,
index_t
MPerThread
,
typename
InScalarPerVectorSeq
,
typename
InScalarPerVectorSeq
,
typename
OutScalarPerVectorSeq
>
typename
OutScalarPerVectorSeq
>
struct
DevicePermute
:
detail
::
DevicePermuteBase
<
DevicePermute
<
InDataType
Tuple
,
struct
DevicePermute
:
detail
::
DevicePermuteBase
<
DevicePermute
<
InDataType
,
OutDataType
Tuple
,
OutDataType
,
ElementwiseOperation
,
ElementwiseOperation
,
NumDim
,
NumDim
,
MPerThread
,
MPerThread
,
InScalarPerVectorSeq
,
InScalarPerVectorSeq
,
OutScalarPerVectorSeq
>>
OutScalarPerVectorSeq
>>
{
{
static
constexpr
int
NumInput
=
InDataTypeTuple
::
Size
()
;
static
constexpr
int
NumInput
=
1
;
static
constexpr
int
NumOutput
=
OutDataTypeTuple
::
Size
()
;
static
constexpr
int
NumOutput
=
1
;
static_assert
(
NumInput
==
InScalarPerVectorSeq
::
Size
()
&&
static_assert
(
NumInput
==
InScalarPerVectorSeq
::
Size
()
&&
NumOutput
==
OutScalarPerVectorSeq
::
Size
(),
NumOutput
==
OutScalarPerVectorSeq
::
Size
(),
"Tuple size is inconsistent with the number of in/out!"
);
"Tuple size is inconsistent with the number of in/out!"
);
static
auto
GenerateInDataTypePointerTuple
()
using
InDataTypePointerTuple
=
Tuple
<
const
InDataType
*>
;
{
using
OutDataTypePointerTuple
=
Tuple
<
OutDataType
*>
;
return
generate_tuple
(
[
&
](
auto
I
)
{
using
DataType
=
remove_cvref_t
<
decltype
(
InDataTypeTuple
{}[
I
])
>
;
return
static_cast
<
const
DataType
*>
(
nullptr
);
},
Number
<
NumInput
>
{});
};
static
auto
GenerateOutDataTypePointerTuple
()
{
return
generate_tuple
(
[
&
](
auto
I
)
{
using
DataType
=
remove_cvref_t
<
decltype
(
OutDataTypeTuple
{}[
I
])
>
;
return
static_cast
<
DataType
*>
(
nullptr
);
},
Number
<
NumOutput
>
{});
};
using
InDataTypePointerTuple
=
decltype
(
GenerateInDataTypePointerTuple
());
using
OutDataTypePointerTuple
=
decltype
(
GenerateOutDataTypePointerTuple
());
template
<
typename
Desc_M
>
template
<
typename
Desc_M
>
static
auto
PadDescriptor_M_1d
(
Desc_M
desc_m
,
index_t
gridSize
,
index_t
blockSize
)
static
auto
PadDescriptor_M_1d
(
Desc_M
desc_m
,
index_t
gridSize
,
index_t
blockSize
)
...
@@ -187,14 +165,14 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataTypeTuple,
...
@@ -187,14 +165,14 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataTypeTuple,
{
{
in_dev_buffers_
=
generate_tuple
(
in_dev_buffers_
=
generate_tuple
(
[
&
](
auto
I
)
{
[
&
](
auto
I
)
{
using
DataType
=
remove_cvref_t
<
decltype
(
InDataTypeTuple
{}[
I
])
>
;
using
DataType
=
InDataType
;
return
static_cast
<
const
DataType
*>
(
in_dev_buffers
[
I
.
value
]);
return
static_cast
<
const
DataType
*>
(
in_dev_buffers
[
I
.
value
]);
},
},
Number
<
NumInput
>
{});
Number
<
NumInput
>
{});
out_dev_buffers_
=
generate_tuple
(
out_dev_buffers_
=
generate_tuple
(
[
&
](
auto
I
)
{
[
&
](
auto
I
)
{
using
DataType
=
remove_cvref_t
<
decltype
(
OutDataTypeTuple
{}[
I
])
>
;
using
DataType
=
OutDataType
;
return
static_cast
<
DataType
*>
(
out_dev_buffers
[
I
.
value
]);
return
static_cast
<
DataType
*>
(
out_dev_buffers
[
I
.
value
]);
},
},
Number
<
NumOutput
>
{});
Number
<
NumOutput
>
{});
...
...
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