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
f8510368
Commit
f8510368
authored
Sep 08, 2022
by
Po-Yen, Chen
Browse files
Use date type directly as template argument
parent
62d7361f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
24 deletions
+16
-24
include/ck/tensor_operation/gpu/device/device_permute.hpp
include/ck/tensor_operation/gpu/device/device_permute.hpp
+8
-11
include/ck/tensor_operation/gpu/grid/gridwise_permute.hpp
include/ck/tensor_operation/gpu/grid/gridwise_permute.hpp
+8
-13
No files found.
include/ck/tensor_operation/gpu/device/device_permute.hpp
View file @
f8510368
...
...
@@ -99,9 +99,6 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataType,
{
static_assert
(
3
<=
NumDim
,
"Only accept at least 3D dimension tensor"
);
using
InDataTypePointer
=
const
InDataType
*
;
using
OutDataTypePointer
=
OutDataType
*
;
template
<
index_t
N
=
NumDim
>
static
auto
ConvertArrayToTuple
(
const
std
::
array
<
index_t
,
NumDim
>&
array
)
{
...
...
@@ -142,8 +139,8 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataType,
using
GridwisePermute
=
GridwisePermute
<
InGridDesc
,
OutGridDesc
,
InDataType
Pointer
,
OutDataType
Pointer
,
InDataType
,
OutDataType
,
ElementwiseOperation
,
BlockSize
,
NPerBlock
,
...
...
@@ -162,8 +159,8 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataType,
const
void
*
in_dev_buffer
,
void
*
out_dev_buffer
,
ElementwiseOperation
elementwise_op
)
:
in_dev_buffer_
(
static_cast
<
InDataType
Pointer
>
(
in_dev_buffer
)),
out_dev_buffer_
(
static_cast
<
OutDataType
Pointer
>
(
out_dev_buffer
)),
:
in_dev_buffer_
(
static_cast
<
const
InDataType
*
>
(
in_dev_buffer
)),
out_dev_buffer_
(
static_cast
<
OutDataType
*
>
(
out_dev_buffer
)),
in_grid_desc_
(
MakeDescriptor_N_H_W
(
inLengths
,
inStrides
)),
out_grid_desc_
(
MakeDescriptor_N_H_W
(
inLengths
,
inStrides
)),
inLengths_
(
inLengths
),
...
...
@@ -175,8 +172,8 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataType,
{
}
InDataType
Pointer
in_dev_buffer_
;
OutDataType
Pointer
out_dev_buffer_
;
const
InDataType
*
in_dev_buffer_
;
OutDataType
*
out_dev_buffer_
;
InGridDesc
in_grid_desc_
;
OutGridDesc
out_grid_desc_
;
...
...
@@ -199,8 +196,8 @@ struct DevicePermute : detail::DevicePermuteBase<DevicePermute<InDataType,
const
auto
kernel
=
kernel_nd_permute
<
GridwisePermute
,
InGridDesc
,
OutGridDesc
,
InDataType
Pointer
,
OutDataType
Pointer
,
InDataType
,
OutDataType
,
ElementwiseOperation
,
typename
GridwisePermute
::
DefaultBlock2TileMap
>
;
...
...
include/ck/tensor_operation/gpu/grid/gridwise_permute.hpp
View file @
f8510368
...
...
@@ -68,14 +68,14 @@ struct Block2TileMap
template
<
typename
GridwisePermute
,
typename
InGridDesc
,
typename
OutGridDesc
,
typename
InDataType
Pointer
,
typename
OutDataType
Pointer
,
typename
InDataType
,
typename
OutDataType
,
typename
ElementwiseOperation
,
typename
Block2TileMap
>
__global__
void
kernel_nd_permute
(
const
InGridDesc
in_grid_desc
,
const
OutGridDesc
out_grid_desc
,
const
InDataType
Pointer
p_in_global
,
const
OutDataType
Pointer
p_out_global
,
const
InDataType
*
p_in_global
,
OutDataType
*
p_out_global
,
const
ElementwiseOperation
elementwise_op
,
const
Block2TileMap
block_2_tile_map
)
{
...
...
@@ -92,8 +92,8 @@ __global__ void kernel_nd_permute(const InGridDesc in_grid_desc,
template
<
typename
InGridDesc
,
typename
OutGridDesc
,
typename
InDataType
Pointer
,
typename
OutDataType
Pointer
,
typename
InDataType
,
typename
OutDataType
,
typename
ElementwiseOperation
,
index_t
BlockSize
,
index_t
NPerBlock
,
...
...
@@ -129,8 +129,6 @@ struct GridwisePermute
{
constexpr
auto
in_block_desc
=
GetInBlockDesc
();
using
InDataType
=
remove_cv_t
<
remove_pointer_t
<
InDataTypePointer
>>
;
return
in_block_desc
.
GetElementSpaceSize
()
*
sizeof
(
InDataType
);
}
...
...
@@ -142,15 +140,12 @@ struct GridwisePermute
template
<
typename
Block2TileMap
>
__device__
static
void
Run
(
const
InGridDesc
in_grid_desc
,
const
OutGridDesc
out_grid_desc
,
const
InDataType
Pointer
p_in_global
,
const
OutDataType
Pointer
p_out_global
,
const
InDataType
*
p_in_global
,
OutDataType
*
p_out_global
,
void
*
__restrict__
p_shared
,
const
ElementwiseOperation
elementwise_op
,
const
Block2TileMap
&
block_2_tile_map
)
{
using
InDataType
=
remove_cv_t
<
remove_pointer_t
<
InDataTypePointer
>>
;
using
OutDataType
=
remove_cv_t
<
remove_pointer_t
<
OutDataTypePointer
>>
;
auto
in_global_buf
=
make_dynamic_buffer
<
AddressSpaceEnum
::
Global
>
(
p_in_global
,
in_grid_desc
.
GetElementSpaceSize
());
...
...
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