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_ROCM
Commits
32806d5f
"src/vscode:/vscode.git/clone" did not exist on "82e95712135bd2b1769c2932d46973653b29126b"
Commit
32806d5f
authored
Dec 27, 2023
by
Jun Liu
Browse files
Merge branch 'amd-develop' into amd-master
parents
e70a4d19
d0f355a3
Changes
138
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
962 additions
and
52 deletions
+962
-52
library/src/tensor_operation_instance/gpu/normalization_bwd_data/device_layernorm2d_bwd_data_f32_instance.cpp
...ion_bwd_data/device_layernorm2d_bwd_data_f32_instance.cpp
+23
-0
library/src/tensor_operation_instance/gpu/normalization_bwd_data/normalization_bwd_data_instance_common.hpp
...ation_bwd_data/normalization_bwd_data_instance_common.hpp
+73
-0
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/CMakeLists.txt
..._instance/gpu/normalization_bwd_gamma_beta/CMakeLists.txt
+8
-0
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/device_groupnorm_bwd_gamma_beta_f32_instance.cpp
...mma_beta/device_groupnorm_bwd_gamma_beta_f32_instance.cpp
+23
-0
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/device_layernorm2d_bwd_gamma_beta_f16_instance.cpp
...a_beta/device_layernorm2d_bwd_gamma_beta_f16_instance.cpp
+24
-0
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/device_layernorm2d_bwd_gamma_beta_f32_instance.cpp
...a_beta/device_layernorm2d_bwd_gamma_beta_f32_instance.cpp
+24
-0
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/normalization_bwd_gamma_beta_instance_common.hpp
...mma_beta/normalization_bwd_gamma_beta_instance_common.hpp
+73
-0
library/src/tensor_operation_instance/gpu/normalization_fwd/device_groupnorm_fwd_f16_instance.cpp
...u/normalization_fwd/device_groupnorm_fwd_f16_instance.cpp
+1
-1
library/src/tensor_operation_instance/gpu/normalization_fwd/device_groupnorm_fwd_swish_f16_instance.cpp
...alization_fwd/device_groupnorm_fwd_swish_f16_instance.cpp
+1
-1
library/src/tensor_operation_instance/gpu/normalization_fwd/device_layernorm2d_fwd_f16_instance.cpp
...normalization_fwd/device_layernorm2d_fwd_f16_instance.cpp
+1
-1
library/src/tensor_operation_instance/gpu/normalization_fwd/device_layernorm4d_fwd_f16_instance.cpp
...normalization_fwd/device_layernorm4d_fwd_f16_instance.cpp
+1
-1
library/src/tensor_operation_instance/gpu/normalization_fwd/normalization_fwd_instance_common.hpp
...u/normalization_fwd/normalization_fwd_instance_common.hpp
+37
-37
library/src/tensor_operation_instance/gpu/permute_scale/CMakeLists.txt
...ensor_operation_instance/gpu/permute_scale/CMakeLists.txt
+2
-0
library/src/tensor_operation_instance/gpu/permute_scale/device_permute_scale_instances.cpp
...ance/gpu/permute_scale/device_permute_scale_instances.cpp
+56
-0
library/src/tensor_operation_instance/gpu/quantization/conv2d_fwd/conv2d_quantization_common.hpp
...pu/quantization/conv2d_fwd/conv2d_quantization_common.hpp
+3
-3
library/src/tensor_operation_instance/gpu/transpose/device_transpose_instances_3d.cpp
..._instance/gpu/transpose/device_transpose_instances_3d.cpp
+0
-8
profiler/include/profiler/profile_groupnorm_bwd_data_impl.hpp
...iler/include/profiler/profile_groupnorm_bwd_data_impl.hpp
+250
-0
profiler/include/profiler/profile_layernorm_bwd_data_impl.hpp
...iler/include/profiler/profile_layernorm_bwd_data_impl.hpp
+255
-0
profiler/src/CMakeLists.txt
profiler/src/CMakeLists.txt
+3
-0
profiler/src/profile_groupnorm_bwd_data.cpp
profiler/src/profile_groupnorm_bwd_data.cpp
+104
-0
No files found.
library/src/tensor_operation_instance/gpu/normalization_bwd_data/device_layernorm2d_bwd_data_f32_instance.cpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "normalization_bwd_data_instance_common.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
void
add_device_layernorm2d_bwd_data_f32_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationBwdData
<
F32
,
F32
,
F32
,
F32
,
F32
,
2
,
1
>>>&
instances
)
{
add_device_operation_instances
(
instances
,
device_layernorm_bwd_data_f32_generic_instance
<
2
,
1
>
{});
add_device_operation_instances
(
instances
,
device_layernorm_bwd_data_f32_instances
<
2
,
1
>
{});
}
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/normalization_bwd_data/normalization_bwd_data_instance_common.hpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#pragma once
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_normalization_bwd_data_impl.hpp"
#include "ck/utility/data_type.hpp"
#include "ck/library/tensor_operation_instance/add_device_operation_instance.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_data_f16_instances
=
// clang-format off
std
::
tuple
<
// DYDataType, XDataType, GammaDataType, MeanInvStdDataType, ComputeDataType, DXDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, IsDYFastestDimReduced, DYSrcVectorSize, IsXFastestDimReduced, XSrcVectorSize, IsGammaFastestDimReduced, GammaSrcVectorSize, IsMeanInvStdFastestDimReduced, MeanInvStdSrcVectorSize, IsDXFastestDimReduced, DXDstVectorSize>
DeviceNormalizationBwdDataImpl
<
F16
,
F16
,
F16
,
F16
,
F32
,
F16
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
2
,
true
,
2
,
true
,
2
,
true
,
2
,
false
,
1
,
true
,
2
>
,
DeviceNormalizationBwdDataImpl
<
F16
,
F16
,
F16
,
F16
,
F32
,
F16
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
4
,
true
,
4
,
true
,
4
,
true
,
4
,
false
,
1
,
true
,
4
>
,
DeviceNormalizationBwdDataImpl
<
F16
,
F16
,
F16
,
F16
,
F32
,
F16
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
8
,
true
,
8
,
true
,
8
,
true
,
8
,
false
,
1
,
true
,
8
>
// clang-format on
>
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_data_f16_generic_instance
=
std
::
tuple
<
// clang-format off
DeviceNormalizationBwdDataImpl
<
F16
,
F16
,
F16
,
F16
,
F32
,
F16
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
1
,
true
,
1
,
true
,
1
,
true
,
1
,
false
,
1
,
true
,
1
>
// clang-format on
>
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_data_f32_instances
=
// clang-format off
std
::
tuple
<
// DYDataType, XDataType, GammaDataType, MeanInvStdDataType, ComputeDataType, DXDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, IsDYFastestDimReduced, DYSrcVectorSize, IsXFastestDimReduced, XSrcVectorSize, IsGammaFastestDimReduced, GammaSrcVectorSize, IsMeanInvStdFastestDimReduced, MeanInvStdSrcVectorSize, IsDXFastestDimReduced, DXDstVectorSize>
DeviceNormalizationBwdDataImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
2
,
true
,
2
,
true
,
2
,
true
,
2
,
false
,
1
,
true
,
2
>
,
DeviceNormalizationBwdDataImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
4
,
true
,
4
,
true
,
4
,
true
,
4
,
false
,
1
,
true
,
4
>
// clang-format on
>
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_data_f32_generic_instance
=
std
::
tuple
<
// clang-format off
DeviceNormalizationBwdDataImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
1
,
true
,
1
,
true
,
1
,
true
,
1
,
false
,
1
,
true
,
1
>
// clang-format on
>
;
using
device_groupnorm_bwd_data_f32_instances
=
// clang-format off
std
::
tuple
<
// DYDataType, XDataType, GammaDataType, MeanInvStdDataType, ComputeDataType, DXDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, IsDYFastestDimReduced, DYSrcVectorSize, IsXFastestDimReduced, XSrcVectorSize, IsGammaFastestDimReduced, GammaSrcVectorSize, IsMeanInvStdFastestDimReduced, MeanInvStdSrcVectorSize, IsDXFastestDimReduced, DXDstVectorSize>
DeviceNormalizationBwdDataImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
,
256
,
1
,
256
,
1
,
2
,
true
,
2
,
true
,
2
,
true
,
2
,
false
,
1
,
true
,
2
>
,
DeviceNormalizationBwdDataImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
,
256
,
1
,
256
,
1
,
4
,
true
,
4
,
true
,
4
,
true
,
4
,
false
,
1
,
true
,
4
>
// clang-format on
>
;
using
device_groupnorm_bwd_data_f32_generic_instance
=
std
::
tuple
<
// clang-format off
DeviceNormalizationBwdDataImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
,
64
,
1
,
64
,
1
,
1
,
true
,
1
,
true
,
1
,
true
,
1
,
false
,
1
,
true
,
1
>
// clang-format on
>
;
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/CMakeLists.txt
0 → 100644
View file @
32806d5f
set
(
DEVICE_NORMALIZATION_BWD_GAMMA_BETA_INSTANCES
)
list
(
APPEND DEVICE_NORMALIZATION_BWD_GAMMA_BETA_INSTANCES
device_groupnorm_bwd_gamma_beta_f32_instance.cpp
device_layernorm2d_bwd_gamma_beta_f16_instance.cpp
device_layernorm2d_bwd_gamma_beta_f32_instance.cpp
)
add_instance_library
(
device_normalization_bwd_gamma_beta_instance
${
DEVICE_NORMALIZATION_BWD_GAMMA_BETA_INSTANCES
}
)
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/device_groupnorm_bwd_gamma_beta_f32_instance.cpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "normalization_bwd_gamma_beta_instance_common.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
void
add_device_groupnorm_bwd_gamma_beta_f32_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationBwdGammaBeta
<
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
>>>&
instances
)
{
add_device_operation_instances
(
instances
,
device_groupnorm_bwd_gamma_beta_f32_instances
{});
add_device_operation_instances
(
instances
,
device_groupnorm_bwd_gamma_beta_f32_generic_instance
{});
}
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/device_layernorm2d_bwd_gamma_beta_f16_instance.cpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "normalization_bwd_gamma_beta_instance_common.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
void
add_device_layernorm2d_bwd_gamma_beta_rank_2_1_f16_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationBwdGammaBeta
<
F16
,
F16
,
F16
,
F16
,
F16
,
2
,
1
>>>&
instances
)
{
add_device_operation_instances
(
instances
,
device_layernorm_bwd_gamma_beta_f16_generic_instance
<
2
,
1
>
{});
add_device_operation_instances
(
instances
,
device_layernorm_bwd_gamma_beta_f16_instances
<
2
,
1
>
{});
}
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/device_layernorm2d_bwd_gamma_beta_f32_instance.cpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "normalization_bwd_gamma_beta_instance_common.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
void
add_device_layernorm2d_bwd_gamma_beta_rank_2_1_f32_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationBwdGammaBeta
<
F32
,
F32
,
F32
,
F32
,
F32
,
2
,
1
>>>&
instances
)
{
add_device_operation_instances
(
instances
,
device_layernorm_bwd_gamma_beta_f32_generic_instance
<
2
,
1
>
{});
add_device_operation_instances
(
instances
,
device_layernorm_bwd_gamma_beta_f32_instances
<
2
,
1
>
{});
}
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/normalization_bwd_gamma_beta/normalization_bwd_gamma_beta_instance_common.hpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#pragma once
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_normalization_bwd_gamma_beta_impl.hpp"
#include "ck/utility/data_type.hpp"
#include "ck/library/tensor_operation_instance/add_device_operation_instance.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_gamma_beta_f16_instances
=
// clang-format off
std
::
tuple
<
// DYDataType, XDataType, MeanInvStdDataType, ComputeDataType, DGammaDataType, DBetaDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, IsDYFastestDimReduced, DYSrcVectorSize, IsXFastestDimReduced, XSrcVectorSize, IsMeanInvStdFastestDimReduced, MeanInvStdSrcVectorSize, DGammaDstVectorSize, DBetaDstVectorSize>
DeviceNormalizationBwdGammaBetaImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F16
,
Rank
,
Reduce
,
256
,
1
,
256
,
2
,
1
,
false
,
2
,
false
,
2
,
true
,
1
,
2
,
2
>
,
DeviceNormalizationBwdGammaBetaImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F16
,
Rank
,
Reduce
,
256
,
1
,
256
,
4
,
1
,
false
,
4
,
false
,
4
,
true
,
1
,
4
,
4
>
,
DeviceNormalizationBwdGammaBetaImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F16
,
Rank
,
Reduce
,
256
,
1
,
256
,
8
,
1
,
false
,
8
,
false
,
8
,
true
,
1
,
8
,
8
>
// clang-format on
>
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_gamma_beta_f16_generic_instance
=
std
::
tuple
<
// clang-format off
DeviceNormalizationBwdGammaBetaImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F16
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
1
,
false
,
1
,
false
,
1
,
true
,
1
,
1
,
1
>
// clang-format on
>
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_gamma_beta_f32_instances
=
// clang-format off
std
::
tuple
<
// DYDataType, XDataType, MeanInvStdDataType, ComputeDataType, DGammaDataType, DBetaDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, IsDYFastestDimReduced, DYSrcVectorSize, IsXFastestDimReduced, XSrcVectorSize, IsMeanInvStdFastestDimReduced, MeanInvStdSrcVectorSize, DGammaDstVectorSize, DBetaDstVectorSize>
DeviceNormalizationBwdGammaBetaImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
Rank
,
Reduce
,
256
,
1
,
256
,
2
,
1
,
false
,
2
,
false
,
2
,
true
,
1
,
2
,
2
>
,
DeviceNormalizationBwdGammaBetaImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
Rank
,
Reduce
,
256
,
1
,
256
,
4
,
1
,
false
,
4
,
false
,
4
,
true
,
1
,
4
,
4
>
// clang-format on
>
;
template
<
index_t
Rank
,
index_t
Reduce
>
using
device_layernorm_bwd_gamma_beta_f32_generic_instance
=
std
::
tuple
<
// clang-format off
DeviceNormalizationBwdGammaBetaImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
1
,
false
,
1
,
false
,
1
,
true
,
1
,
1
,
1
>
// clang-format on
>
;
using
device_groupnorm_bwd_gamma_beta_f32_instances
=
// clang-format off
std
::
tuple
<
// DYDataType, XDataType, MeanInvStdDataType, ComputeDataType, DGammaDataType, DBetaDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, IsDYFastestDimReduced, DYSrcVectorSize, IsXFastestDimReduced, XSrcVectorSize, IsMeanInvStdFastestDimReduced, MeanInvStdSrcVectorSize, DGammaDstVectorSize, DBetaDstVectorSize>
DeviceNormalizationBwdGammaBetaImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
,
256
,
1
,
256
,
2
,
1
,
false
,
2
,
false
,
2
,
false
,
1
,
2
,
2
>
,
DeviceNormalizationBwdGammaBetaImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
,
256
,
1
,
256
,
4
,
1
,
false
,
4
,
false
,
4
,
false
,
1
,
4
,
4
>
// clang-format on
>
;
using
device_groupnorm_bwd_gamma_beta_f32_generic_instance
=
std
::
tuple
<
// clang-format off
DeviceNormalizationBwdGammaBetaImpl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
5
,
3
,
64
,
1
,
64
,
1
,
1
,
false
,
1
,
false
,
1
,
false
,
1
,
1
,
1
>
// clang-format on
>
;
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/normalization_fwd/device_groupnorm_fwd_f16_instance.cpp
View file @
32806d5f
...
@@ -11,7 +11,7 @@ namespace instance {
...
@@ -11,7 +11,7 @@ namespace instance {
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
void
add_device_normalization_fwd_rank_5_3_f16_instances
(
void
add_device_normalization_fwd_rank_5_3_f16_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
32
,
Pass
,
5
,
3
>>>&
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
16
,
Pass
,
5
,
3
>>>&
instances
)
instances
)
{
{
add_device_operation_instances
(
instances
,
add_device_operation_instances
(
instances
,
...
...
library/src/tensor_operation_instance/gpu/normalization_fwd/device_groupnorm_fwd_swish_f16_instance.cpp
View file @
32806d5f
...
@@ -11,7 +11,7 @@ namespace instance {
...
@@ -11,7 +11,7 @@ namespace instance {
using
Swish
=
ck
::
tensor_operation
::
element_wise
::
Swish
;
using
Swish
=
ck
::
tensor_operation
::
element_wise
::
Swish
;
void
add_device_normalization_fwd_rank_5_3_swish_f16_instances
(
void
add_device_normalization_fwd_rank_5_3_swish_f16_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
32
,
Swish
,
5
,
3
>>>&
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
16
,
Swish
,
5
,
3
>>>&
instances
)
instances
)
{
{
add_device_operation_instances
(
instances
,
add_device_operation_instances
(
instances
,
...
...
library/src/tensor_operation_instance/gpu/normalization_fwd/device_layernorm2d_fwd_f16_instance.cpp
View file @
32806d5f
...
@@ -11,7 +11,7 @@ namespace instance {
...
@@ -11,7 +11,7 @@ namespace instance {
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
void
add_device_normalization_fwd_rank_2_1_f16_instances
(
void
add_device_normalization_fwd_rank_2_1_f16_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
32
,
Pass
,
2
,
1
>>>&
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
16
,
Pass
,
2
,
1
>>>&
instances
)
instances
)
{
{
add_device_operation_instances
(
instances
,
add_device_operation_instances
(
instances
,
...
...
library/src/tensor_operation_instance/gpu/normalization_fwd/device_layernorm4d_fwd_f16_instance.cpp
View file @
32806d5f
...
@@ -11,7 +11,7 @@ namespace instance {
...
@@ -11,7 +11,7 @@ namespace instance {
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
void
add_device_normalization_fwd_rank_4_3_f16_instances
(
void
add_device_normalization_fwd_rank_4_3_f16_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
32
,
Pass
,
4
,
3
>>>&
std
::
vector
<
std
::
unique_ptr
<
DeviceNormalizationFwd
<
F16
,
F16
,
F16
,
F16
,
F
16
,
Pass
,
4
,
3
>>>&
instances
)
instances
)
{
{
add_device_operation_instances
(
instances
,
add_device_operation_instances
(
instances
,
...
...
library/src/tensor_operation_instance/gpu/normalization_fwd/normalization_fwd_instance_common.hpp
View file @
32806d5f
...
@@ -23,24 +23,24 @@ using device_normalization_f16_instances =
...
@@ -23,24 +23,24 @@ using device_normalization_f16_instances =
// clang-format off
// clang-format off
std
::
tuple
<
std
::
tuple
<
// XDataType, GammaDataType, BetaDataType, ComputeDataType, YDataType, SaveMeanInvStdDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, XYSrcVectorDim, XSrcVectorSize, GammaSrcVectorDim, GammaSrcVectorSize, BetaSrcVectorDim, BetaSrcVectorSize, YDstVectorSize, SaveMeanInvStdScalarPerVector>
// XDataType, GammaDataType, BetaDataType, ComputeDataType, YDataType, SaveMeanInvStdDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, XYSrcVectorDim, XSrcVectorSize, GammaSrcVectorDim, GammaSrcVectorSize, BetaSrcVectorDim, BetaSrcVectorSize, YDstVectorSize, SaveMeanInvStdScalarPerVector>
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
2
,
1
,
2
,
1
,
2
,
1
,
2
,
2
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
2
,
1
,
2
,
1
,
2
,
1
,
2
,
2
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
4
,
1
,
4
,
1
,
4
,
1
,
4
,
4
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
4
,
1
,
4
,
1
,
4
,
1
,
4
,
4
,
1
>
,
// irregular size
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
2
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
2
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
2
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
2
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
// clang-format on
// clang-format on
>
;
>
;
...
@@ -49,31 +49,31 @@ using device_normalization_splitk_f16_instances =
...
@@ -49,31 +49,31 @@ using device_normalization_splitk_f16_instances =
// clang-format off
// clang-format off
std
::
tuple
<
std
::
tuple
<
// XDataType, GammaDataType, BetaDataType, ComputeDataType, YDataType, SaveMeanInvStdDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, XYSrcVectorDim, XSrcVectorSize, GammaSrcVectorDim, GammaSrcVectorSize, BetaSrcVectorDim, BetaSrcVectorSize, YDstVectorSize, SaveMeanInvStdScalarPerVector>
// XDataType, GammaDataType, BetaDataType, ComputeDataType, YDataType, SaveMeanInvStdDataType, Rank, NumReduceDim, BlockSize, MThreadClusterSize, KThreadClusterSize, MThreadSliceSize, KThreadSliceSize, XYSrcVectorDim, XSrcVectorSize, GammaSrcVectorDim, GammaSrcVectorSize, BetaSrcVectorDim, BetaSrcVectorSize, YDstVectorSize, SaveMeanInvStdScalarPerVector>
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
2
,
1
,
2
,
1
,
2
,
1
,
2
,
2
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
2
,
1
,
2
,
1
,
2
,
1
,
2
,
2
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
4
,
1
,
4
,
1
,
4
,
1
,
4
,
4
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
4
,
1
,
4
,
1
,
4
,
1
,
4
,
4
,
1
>
,
// irregular size
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
128
,
1
,
128
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
2
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
2
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
2
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
2
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
256
,
1
,
256
,
1
,
32
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
512
,
1
,
512
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
8
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
,
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
DeviceNormalizationFwdSplitKImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
1024
,
1
,
1024
,
1
,
16
,
1
,
8
,
1
,
8
,
1
,
8
,
8
,
1
>
// clang-format on
// clang-format on
>
;
>
;
template
<
typename
OutElementwise
,
index_t
Rank
,
index_t
Reduce
>
template
<
typename
OutElementwise
,
index_t
Rank
,
index_t
Reduce
>
using
device_normalization_f16_generic_instance
=
std
::
tuple
<
using
device_normalization_f16_generic_instance
=
std
::
tuple
<
// clang-format off
// clang-format off
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
32
,
OutElementwise
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
DeviceNormalizationFwdImpl
<
F16
,
F16
,
F16
,
F32
,
F16
,
F
16
,
OutElementwise
,
Rank
,
Reduce
,
64
,
1
,
64
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
>
// clang-format on
// clang-format on
>
;
>
;
...
...
library/src/tensor_operation_instance/gpu/permute_scale/CMakeLists.txt
0 → 100644
View file @
32806d5f
add_instance_library
(
device_permute_scale_instance
device_permute_scale_instances.cpp
)
library/src/tensor_operation_instance/gpu/permute_scale/device_permute_scale_instances.cpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_elementwise_scale_impl.hpp"
#include "ck/utility/data_type.hpp"
#include "ck/library/tensor_operation_instance/add_device_operation_instance.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
using
Pass
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
UnaryOp
=
ck
::
tensor_operation
::
element_wise
::
UnarySquare
;
using
Scale
=
ck
::
tensor_operation
::
element_wise
::
Scale
;
// clang-format off
using
device_permute_scale_f16_instances
=
std
::
tuple
<
DeviceElementwiseImpl
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
1
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
,
DeviceElementwiseImpl
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
8
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
,
DeviceElementwiseImpl
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
4
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
,
DeviceElementwiseImpl
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
2
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
>
;
using
device_permute_scale_f32_instances
=
std
::
tuple
<
DeviceElementwiseImpl
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
1
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
,
DeviceElementwiseImpl
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
8
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
,
DeviceElementwiseImpl
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
4
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
,
DeviceElementwiseImpl
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
Pass
,
UnaryOp
,
Scale
,
4
,
2
,
ck
::
Sequence
<
1
>
,
ck
::
Sequence
<
1
>>
>
;
// clang-format on
void
add_device_permute_scale_f16_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceElementwise
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
Pass
,
UnaryOp
,
Scale
,
4
>>>&
instances
)
{
add_device_operation_instances
(
instances
,
device_permute_scale_f16_instances
{});
}
void
add_device_permute_scale_f32_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceElementwise
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
Pass
,
UnaryOp
,
Scale
,
4
>>>&
instances
)
{
add_device_operation_instances
(
instances
,
device_permute_scale_f32_instances
{});
}
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
library/src/tensor_operation_instance/gpu/quantization/conv2d_fwd/conv2d_quantization_common.hpp
View file @
32806d5f
...
@@ -22,13 +22,13 @@ using S = ck::Sequence<Is...>;
...
@@ -22,13 +22,13 @@ using S = ck::Sequence<Is...>;
using
NHWGC
=
ck
::
tensor_layout
::
convolution
::
NHWGC
;
using
NHWGC
=
ck
::
tensor_layout
::
convolution
::
NHWGC
;
using
GKYXC
=
ck
::
tensor_layout
::
convolution
::
GKYXC
;
using
GKYXC
=
ck
::
tensor_layout
::
convolution
::
GKYXC
;
using
NHWGK
=
ck
::
tensor_layout
::
convolution
::
NHWGK
;
using
NHWGK
=
ck
::
tensor_layout
::
convolution
::
NHWGK
;
using
GK
=
ck
::
tensor_layout
::
convolution
::
G_K
;
using
G
_
K
=
ck
::
tensor_layout
::
convolution
::
G_K
;
using
PassThrough
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
PassThrough
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
Relu
=
ck
::
tensor_operation
::
element_wise
::
Relu
;
using
Relu
=
ck
::
tensor_operation
::
element_wise
::
Relu
;
using
TanH
=
ck
::
tensor_operation
::
element_wise
::
TanH
;
using
TanH
=
ck
::
tensor_operation
::
element_wise
::
TanH
;
using
GK_Tuple
=
ck
::
Tuple
<
GK
>
;
using
GK_Tuple
=
ck
::
Tuple
<
G
_
K
>
;
using
GK_GK_Tuple
=
ck
::
Tuple
<
GK
,
GK
>
;
using
GK_GK_Tuple
=
ck
::
Tuple
<
G
_
K
,
G
_
K
>
;
using
I32_Tuple
=
ck
::
Tuple
<
int32_t
>
;
using
I32_Tuple
=
ck
::
Tuple
<
int32_t
>
;
using
F32_Tuple
=
ck
::
Tuple
<
float
>
;
using
F32_Tuple
=
ck
::
Tuple
<
float
>
;
using
I32_F32_Tuple
=
ck
::
Tuple
<
int32_t
,
float
>
;
using
I32_F32_Tuple
=
ck
::
Tuple
<
int32_t
,
float
>
;
...
...
library/src/tensor_operation_instance/gpu/transpose/device_transpose_instances_3d.cpp
View file @
32806d5f
...
@@ -19,22 +19,14 @@ void add_device_transpose_f16_instances(
...
@@ -19,22 +19,14 @@ void add_device_transpose_f16_instances(
std
::
vector
<
std
::
unique_ptr
<
DeviceElementwise
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
PassThrough
,
5
>>>&
std
::
vector
<
std
::
unique_ptr
<
DeviceElementwise
<
ck
::
Tuple
<
F16
>
,
ck
::
Tuple
<
F16
>
,
PassThrough
,
5
>>>&
instances
)
instances
)
{
{
#ifdef CK_ENABLE_FP16
add_device_operation_instances
(
instances
,
device_transpose_f16_instances
{});
add_device_operation_instances
(
instances
,
device_transpose_f16_instances
{});
#else
ignore
=
instances
;
#endif
}
}
void
add_device_transpose_f32_instances
(
void
add_device_transpose_f32_instances
(
std
::
vector
<
std
::
unique_ptr
<
DeviceElementwise
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
PassThrough
,
5
>>>&
std
::
vector
<
std
::
unique_ptr
<
DeviceElementwise
<
ck
::
Tuple
<
F32
>
,
ck
::
Tuple
<
F32
>
,
PassThrough
,
5
>>>&
instances
)
instances
)
{
{
#ifdef CK_ENABLE_FP32
add_device_operation_instances
(
instances
,
device_transpose_f32_instances
{});
add_device_operation_instances
(
instances
,
device_transpose_f32_instances
{});
#else
ignore
=
instances
;
#endif
}
}
}
// namespace instance
}
// namespace instance
...
...
profiler/include/profiler/profile_groupnorm_bwd_data_impl.hpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#pragma once
#include <iomanip>
#include "ck/ck.hpp"
#include "ck/library/tensor_operation_instance/gpu/groupnorm_bwd_data.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_groupnorm_bwd.hpp"
namespace
ck
{
namespace
profiler
{
template
<
typename
DYDataType
,
typename
XDataType
,
typename
GammaDataType
,
typename
MeanInvStdDataType
,
typename
ComputeDataType
,
typename
DXDataType
>
bool
profile_groupnorm_bwd_data_impl
(
int
do_verification
,
int
init_method
,
bool
do_log
,
bool
time_kernel
,
std
::
vector
<
index_t
>
length
)
{
// we don't need DGamma and DBeta here, just for reference class
using
DGammaDataType
=
DXDataType
;
using
DBetaDataType
=
DXDataType
;
if
(
length
.
size
()
!=
5
)
return
false
;
index_t
N
=
length
[
0
];
index_t
G
=
length
[
3
];
index_t
C
=
length
[
4
];
std
::
vector
<
index_t
>
reduce_dim
=
{
1
,
2
,
4
};
std
::
vector
<
index_t
>
gammaLength
=
{
G
,
C
};
Tensor
<
DYDataType
>
dy
(
length
);
Tensor
<
XDataType
>
x
(
length
);
Tensor
<
GammaDataType
>
gamma
({
G
,
C
});
Tensor
<
MeanInvStdDataType
>
mean
({
N
,
G
});
Tensor
<
MeanInvStdDataType
>
inv_std
({
N
,
G
});
Tensor
<
DXDataType
>
dx
(
length
);
Tensor
<
DXDataType
>
host_dx
(
length
);
Tensor
<
DGammaDataType
>
host_dgamma
({
G
,
C
});
Tensor
<
DBetaDataType
>
host_dbeta
({
G
,
C
});
std
::
vector
<
index_t
>
strideDy
=
std
::
vector
<
ck
::
index_t
>
{
dy
.
mDesc
.
GetStrides
().
begin
(),
dy
.
mDesc
.
GetStrides
().
end
()};
std
::
vector
<
index_t
>
strideX
=
strideDy
;
std
::
vector
<
index_t
>
strideDx
=
strideDy
;
std
::
vector
<
index_t
>
strideGamma
=
{
0
,
0
,
0
,
C
,
1
};
std
::
vector
<
index_t
>
strideMeanInvStd
=
{
G
,
0
,
0
,
1
,
0
};
switch
(
init_method
)
{
case
0
:
dy
.
GenerateTensorValue
(
GeneratorTensor_1
<
DYDataType
>
{});
x
.
GenerateTensorValue
(
GeneratorTensor_1
<
XDataType
>
{});
gamma
.
GenerateTensorValue
(
GeneratorTensor_1
<
GammaDataType
>
{});
mean
.
GenerateTensorValue
(
GeneratorTensor_1
<
MeanInvStdDataType
>
{});
inv_std
.
GenerateTensorValue
(
GeneratorTensor_1
<
MeanInvStdDataType
>
{});
dx
.
GenerateTensorValue
(
GeneratorTensor_1
<
DXDataType
>
{});
break
;
case
1
:
dy
.
GenerateTensorValue
(
GeneratorTensor_2
<
DYDataType
>
{
-
5
,
5
});
x
.
GenerateTensorValue
(
GeneratorTensor_2
<
XDataType
>
{
-
5
,
5
});
gamma
.
GenerateTensorValue
(
GeneratorTensor_2
<
GammaDataType
>
{
-
5
,
5
});
mean
.
GenerateTensorValue
(
GeneratorTensor_2
<
MeanInvStdDataType
>
{
-
5
,
5
});
inv_std
.
GenerateTensorValue
(
GeneratorTensor_2
<
MeanInvStdDataType
>
{
-
5
,
5
});
dx
.
GenerateTensorValue
(
GeneratorTensor_2
<
DXDataType
>
{
-
5
,
5
});
break
;
default:
dy
.
GenerateTensorValue
(
GeneratorTensor_3
<
DYDataType
>
{
0
,
1
});
x
.
GenerateTensorValue
(
GeneratorTensor_3
<
XDataType
>
{
0
,
1
});
gamma
.
GenerateTensorValue
(
GeneratorTensor_3
<
GammaDataType
>
{
-
0.5
,
0.5
});
mean
.
GenerateTensorValue
(
GeneratorTensor_3
<
MeanInvStdDataType
>
{
-
0.5
,
0.5
});
inv_std
.
GenerateTensorValue
(
GeneratorTensor_3
<
MeanInvStdDataType
>
{
-
0.5
,
0.5
});
dx
.
GenerateTensorValue
(
GeneratorTensor_3
<
DXDataType
>
{
-
0.5
,
0.5
});
}
DeviceMem
dy_dev
(
sizeof
(
DYDataType
)
*
dy
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
x_dev
(
sizeof
(
XDataType
)
*
x
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
gamma_dev
(
sizeof
(
GammaDataType
)
*
gamma
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
mean_dev
(
sizeof
(
MeanInvStdDataType
)
*
mean
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
inv_std_dev
(
sizeof
(
MeanInvStdDataType
)
*
inv_std
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
dx_dev
(
sizeof
(
DXDataType
)
*
dx
.
mDesc
.
GetElementSpaceSize
());
dy_dev
.
ToDevice
(
dy
.
mData
.
data
());
x_dev
.
ToDevice
(
x
.
mData
.
data
());
gamma_dev
.
ToDevice
(
gamma
.
mData
.
data
());
mean_dev
.
ToDevice
(
mean
.
mData
.
data
());
inv_std_dev
.
ToDevice
(
inv_std
.
mData
.
data
());
// add device normalization instances
using
DeviceOp
=
ck
::
tensor_operation
::
device
::
DeviceNormalizationBwdData
<
DYDataType
,
XDataType
,
GammaDataType
,
MeanInvStdDataType
,
DXDataType
,
5
,
3
>
;
// get device op instances
const
auto
instance_ptrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
DeviceOp
>::
GetInstances
();
std
::
cout
<<
"found "
<<
instance_ptrs
.
size
()
<<
" instances"
<<
std
::
endl
;
std
::
string
best_instance_name
;
float
best_avg_time
=
std
::
numeric_limits
<
float
>::
max
();
float
best_gb_per_sec
=
0
;
if
(
do_verification
)
{
using
ReferenceInstance
=
ck
::
tensor_operation
::
host
::
ReferenceGroupnormBwd
<
DYDataType
,
XDataType
,
GammaDataType
,
MeanInvStdDataType
,
DGammaDataType
,
DBetaDataType
,
DXDataType
,
ComputeDataType
>
;
ReferenceInstance
ref
;
auto
ref_argument
=
ref
.
MakeArgument
(
dy
,
x
,
gamma
,
mean
,
inv_std
,
host_dgamma
,
host_dbeta
,
host_dx
,
length
);
auto
ref_invoker
=
ref
.
MakeInvoker
();
ref_invoker
.
Run
(
ref_argument
);
}
int
num_kernel
=
0
;
for
(
auto
&
inst_ptr
:
instance_ptrs
)
{
auto
argument_ptr
=
inst_ptr
->
MakeArgumentPointer
(
length
,
strideDy
,
strideX
,
strideGamma
,
strideMeanInvStd
,
strideMeanInvStd
,
strideDx
,
reduce_dim
,
dy_dev
.
GetDeviceBuffer
(),
x_dev
.
GetDeviceBuffer
(),
gamma_dev
.
GetDeviceBuffer
(),
mean_dev
.
GetDeviceBuffer
(),
inv_std_dev
.
GetDeviceBuffer
(),
dx_dev
.
GetDeviceBuffer
());
if
(
inst_ptr
->
IsSupportedArgument
(
argument_ptr
.
get
()))
{
++
num_kernel
;
}
else
{
if
(
time_kernel
)
{
std
::
cout
<<
inst_ptr
->
GetTypeString
()
<<
" skipped due to unsupported argument: "
;
LogRange
(
std
::
cout
<<
"input lengths = "
,
length
,
", "
)
<<
std
::
endl
;
}
continue
;
}
size_t
workspace_sz
=
inst_ptr
->
GetWorkSpaceSize
(
argument_ptr
.
get
());
DeviceMem
workspace_dev
(
workspace_sz
);
inst_ptr
->
SetWorkSpacePointer
(
argument_ptr
.
get
(),
workspace_dev
.
GetDeviceBuffer
());
auto
invoker_ptr
=
inst_ptr
->
MakeInvokerPointer
();
float
avg_time
=
invoker_ptr
->
Run
(
argument_ptr
.
get
(),
StreamConfig
{
nullptr
,
time_kernel
});
std
::
size_t
num_bytes
=
dy
.
mDesc
.
GetElementSize
()
*
sizeof
(
DYDataType
)
+
x
.
mDesc
.
GetElementSize
()
*
sizeof
(
XDataType
)
+
gamma
.
mDesc
.
GetElementSize
()
*
sizeof
(
GammaDataType
)
+
mean
.
mDesc
.
GetElementSize
()
*
sizeof
(
MeanInvStdDataType
)
+
inv_std
.
mDesc
.
GetElementSize
()
*
sizeof
(
MeanInvStdDataType
)
+
dx
.
mDesc
.
GetElementSize
()
*
sizeof
(
DXDataType
);
float
gb_per_sec
=
num_bytes
/
1.E6
/
avg_time
;
if
(
time_kernel
)
std
::
cout
<<
"Perf: "
<<
std
::
setw
(
10
)
<<
avg_time
<<
" ms, "
<<
gb_per_sec
<<
" GB/s, "
<<
inst_ptr
->
GetTypeString
()
<<
std
::
endl
;
if
(
avg_time
<
best_avg_time
)
{
best_instance_name
=
inst_ptr
->
GetTypeString
();
best_avg_time
=
avg_time
;
best_gb_per_sec
=
gb_per_sec
;
}
if
(
do_verification
)
{
dx_dev
.
FromDevice
(
dx
.
mData
.
data
());
bool
pass
=
ck
::
utils
::
check_err
(
dx
.
mData
,
host_dx
.
mData
,
"Error: Incorrect results"
,
1e-3
,
1e-3
);
if
(
do_log
)
{
LogRangeAsType
<
float
>
(
std
::
cout
<<
"dy : "
,
dy
.
mData
,
","
)
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"host_dx : "
,
host_dx
.
mData
,
","
)
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"dx : "
,
dx
.
mData
,
","
)
<<
std
::
endl
;
}
if
(
!
pass
)
{
std
::
cout
<<
inst_ptr
->
GetTypeString
()
<<
" failed verification: "
;
LogRange
(
std
::
cout
<<
"lengths = ["
,
length
,
", "
)
<<
"]."
<<
std
::
endl
;
return
false
;
}
else
{
if
(
time_kernel
)
std
::
cout
<<
"pass"
<<
std
::
endl
;
}
}
}
if
(
time_kernel
)
{
LogRange
(
std
::
cout
<<
"length = "
,
length
,
","
)
<<
", "
;
LogRange
(
std
::
cout
<<
"reduce dims "
,
reduce_dim
,
","
)
<<
std
::
endl
;
std
::
cout
<<
"best perf = "
<<
best_avg_time
<<
" ms, "
<<
best_gb_per_sec
<<
" GB/s,"
<<
best_instance_name
<<
std
::
endl
;
}
if
(
num_kernel
==
0
)
{
std
::
cout
<<
"Error: No kernel is applicable"
<<
std
::
endl
;
return
false
;
}
return
true
;
}
}
// namespace profiler
}
// namespace ck
profiler/include/profiler/profile_layernorm_bwd_data_impl.hpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#pragma once
#include <iomanip>
#include "ck/ck.hpp"
#include "ck/library/tensor_operation_instance/gpu/layernorm_bwd_data.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_layernorm_bwd.hpp"
namespace
ck
{
namespace
profiler
{
template
<
typename
DYDataType
,
typename
XDataType
,
typename
GammaDataType
,
typename
MeanInvStdDataType
,
typename
ComputeDataType
,
typename
DXDataType
,
index_t
Rank
>
bool
profile_layernorm_bwd_data_impl
(
int
do_verification
,
int
init_method
,
bool
do_log
,
bool
time_kernel
,
std
::
vector
<
index_t
>
length
)
{
// we don't need DGamma and DBeta here, just for reference class
using
DGammaDataType
=
DXDataType
;
using
DBetaDataType
=
DXDataType
;
if
(
length
.
size
()
!=
Rank
||
Rank
<
2
)
return
false
;
// Assume normalize dimension except for batch (first) dimension
std
::
vector
<
index_t
>
reduce_length
{
length
.
begin
()
+
1
,
length
.
end
()};
std
::
vector
<
index_t
>
reduce_dim
;
for
(
int
i
=
1
;
i
<
Rank
;
++
i
)
reduce_dim
.
push_back
(
i
);
Tensor
<
DYDataType
>
dy
(
length
);
Tensor
<
XDataType
>
x
(
length
);
Tensor
<
GammaDataType
>
gamma
(
reduce_length
);
Tensor
<
MeanInvStdDataType
>
mean
({
length
[
0
]});
Tensor
<
MeanInvStdDataType
>
inv_std
({
length
[
0
]});
Tensor
<
DXDataType
>
dx
(
length
);
Tensor
<
DXDataType
>
host_dx
(
length
);
Tensor
<
DGammaDataType
>
host_dgamma
(
reduce_length
);
Tensor
<
DBetaDataType
>
host_dbeta
(
reduce_length
);
std
::
vector
<
index_t
>
strideDy
=
std
::
vector
<
ck
::
index_t
>
{
dy
.
mDesc
.
GetStrides
().
begin
(),
dy
.
mDesc
.
GetStrides
().
end
()};
std
::
vector
<
index_t
>
strideX
=
strideDy
;
std
::
vector
<
index_t
>
strideDx
=
strideDy
;
std
::
vector
<
index_t
>
strideGamma
=
strideDy
;
strideGamma
[
0
]
=
0
;
std
::
vector
<
index_t
>
strideMeanInvStd
{
Rank
,
0
};
strideMeanInvStd
[
0
]
=
1
;
switch
(
init_method
)
{
case
0
:
dy
.
GenerateTensorValue
(
GeneratorTensor_1
<
DYDataType
>
{});
x
.
GenerateTensorValue
(
GeneratorTensor_1
<
XDataType
>
{});
gamma
.
GenerateTensorValue
(
GeneratorTensor_1
<
GammaDataType
>
{});
mean
.
GenerateTensorValue
(
GeneratorTensor_1
<
MeanInvStdDataType
>
{});
inv_std
.
GenerateTensorValue
(
GeneratorTensor_1
<
MeanInvStdDataType
>
{});
dx
.
GenerateTensorValue
(
GeneratorTensor_1
<
DXDataType
>
{});
break
;
case
1
:
dy
.
GenerateTensorValue
(
GeneratorTensor_2
<
DYDataType
>
{
-
5
,
5
});
x
.
GenerateTensorValue
(
GeneratorTensor_2
<
XDataType
>
{
-
5
,
5
});
gamma
.
GenerateTensorValue
(
GeneratorTensor_2
<
GammaDataType
>
{
-
5
,
5
});
mean
.
GenerateTensorValue
(
GeneratorTensor_2
<
MeanInvStdDataType
>
{
-
5
,
5
});
inv_std
.
GenerateTensorValue
(
GeneratorTensor_2
<
MeanInvStdDataType
>
{
-
5
,
5
});
dx
.
GenerateTensorValue
(
GeneratorTensor_2
<
DXDataType
>
{
-
5
,
5
});
break
;
default:
dy
.
GenerateTensorValue
(
GeneratorTensor_3
<
DYDataType
>
{
0
,
1
});
x
.
GenerateTensorValue
(
GeneratorTensor_3
<
XDataType
>
{
0
,
1
});
gamma
.
GenerateTensorValue
(
GeneratorTensor_3
<
GammaDataType
>
{
-
0.5
,
0.5
});
mean
.
GenerateTensorValue
(
GeneratorTensor_3
<
MeanInvStdDataType
>
{
-
0.5
,
0.5
});
inv_std
.
GenerateTensorValue
(
GeneratorTensor_3
<
MeanInvStdDataType
>
{
-
0.5
,
0.5
});
dx
.
GenerateTensorValue
(
GeneratorTensor_3
<
DXDataType
>
{
-
0.5
,
0.5
});
}
DeviceMem
dy_dev
(
sizeof
(
DYDataType
)
*
dy
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
x_dev
(
sizeof
(
XDataType
)
*
x
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
gamma_dev
(
sizeof
(
GammaDataType
)
*
gamma
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
mean_dev
(
sizeof
(
MeanInvStdDataType
)
*
mean
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
inv_std_dev
(
sizeof
(
MeanInvStdDataType
)
*
inv_std
.
mDesc
.
GetElementSpaceSize
());
DeviceMem
dx_dev
(
sizeof
(
DXDataType
)
*
dx
.
mDesc
.
GetElementSpaceSize
());
dy_dev
.
ToDevice
(
dy
.
mData
.
data
());
x_dev
.
ToDevice
(
x
.
mData
.
data
());
gamma_dev
.
ToDevice
(
gamma
.
mData
.
data
());
mean_dev
.
ToDevice
(
mean
.
mData
.
data
());
inv_std_dev
.
ToDevice
(
inv_std
.
mData
.
data
());
constexpr
int
NumReduceDim
=
Rank
-
1
;
// add device normalization instances
using
DeviceOp
=
ck
::
tensor_operation
::
device
::
DeviceNormalizationBwdData
<
DYDataType
,
XDataType
,
GammaDataType
,
MeanInvStdDataType
,
DXDataType
,
Rank
,
NumReduceDim
>
;
// get device op instances
const
auto
instance_ptrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
DeviceOp
>::
GetInstances
();
std
::
cout
<<
"found "
<<
instance_ptrs
.
size
()
<<
" instances"
<<
std
::
endl
;
std
::
string
best_instance_name
;
float
best_avg_time
=
std
::
numeric_limits
<
float
>::
max
();
float
best_gb_per_sec
=
0
;
if
(
do_verification
)
{
using
ReferenceInstance
=
ck
::
tensor_operation
::
host
::
ReferenceLayernormBwd
<
DYDataType
,
XDataType
,
GammaDataType
,
MeanInvStdDataType
,
DGammaDataType
,
DBetaDataType
,
DXDataType
,
ComputeDataType
>
;
ReferenceInstance
ref
;
auto
ref_argument
=
ref
.
MakeArgument
(
dy
,
x
,
gamma
,
mean
,
inv_std
,
host_dgamma
,
host_dbeta
,
host_dx
,
length
);
auto
ref_invoker
=
ref
.
MakeInvoker
();
ref_invoker
.
Run
(
ref_argument
);
}
int
num_kernel
=
0
;
for
(
auto
&
inst_ptr
:
instance_ptrs
)
{
auto
argument_ptr
=
inst_ptr
->
MakeArgumentPointer
(
length
,
strideDy
,
strideX
,
strideGamma
,
strideMeanInvStd
,
strideMeanInvStd
,
strideDx
,
reduce_dim
,
dy_dev
.
GetDeviceBuffer
(),
x_dev
.
GetDeviceBuffer
(),
gamma_dev
.
GetDeviceBuffer
(),
mean_dev
.
GetDeviceBuffer
(),
inv_std_dev
.
GetDeviceBuffer
(),
dx_dev
.
GetDeviceBuffer
());
if
(
inst_ptr
->
IsSupportedArgument
(
argument_ptr
.
get
()))
{
++
num_kernel
;
}
else
{
if
(
time_kernel
)
{
std
::
cout
<<
inst_ptr
->
GetTypeString
()
<<
" skipped due to unsupported argument: "
;
LogRange
(
std
::
cout
<<
"input lengths = "
,
length
,
", "
)
<<
std
::
endl
;
}
continue
;
}
size_t
workspace_sz
=
inst_ptr
->
GetWorkSpaceSize
(
argument_ptr
.
get
());
DeviceMem
workspace_dev
(
workspace_sz
);
inst_ptr
->
SetWorkSpacePointer
(
argument_ptr
.
get
(),
workspace_dev
.
GetDeviceBuffer
());
auto
invoker_ptr
=
inst_ptr
->
MakeInvokerPointer
();
float
avg_time
=
invoker_ptr
->
Run
(
argument_ptr
.
get
(),
StreamConfig
{
nullptr
,
time_kernel
});
std
::
size_t
num_bytes
=
dy
.
mDesc
.
GetElementSize
()
*
sizeof
(
DYDataType
)
+
x
.
mDesc
.
GetElementSize
()
*
sizeof
(
XDataType
)
+
gamma
.
mDesc
.
GetElementSize
()
*
sizeof
(
GammaDataType
)
+
mean
.
mDesc
.
GetElementSize
()
*
sizeof
(
MeanInvStdDataType
)
+
inv_std
.
mDesc
.
GetElementSize
()
*
sizeof
(
MeanInvStdDataType
)
+
dx
.
mDesc
.
GetElementSize
()
*
sizeof
(
DXDataType
);
float
gb_per_sec
=
num_bytes
/
1.E6
/
avg_time
;
if
(
time_kernel
)
std
::
cout
<<
"Perf: "
<<
std
::
setw
(
10
)
<<
avg_time
<<
" ms, "
<<
gb_per_sec
<<
" GB/s, "
<<
inst_ptr
->
GetTypeString
()
<<
std
::
endl
;
if
(
avg_time
<
best_avg_time
)
{
best_instance_name
=
inst_ptr
->
GetTypeString
();
best_avg_time
=
avg_time
;
best_gb_per_sec
=
gb_per_sec
;
}
if
(
do_verification
)
{
dx_dev
.
FromDevice
(
dx
.
mData
.
data
());
bool
pass
=
ck
::
utils
::
check_err
(
dx
.
mData
,
host_dx
.
mData
,
"Error: Incorrect results"
,
1e-3
,
1e-3
);
if
(
do_log
)
{
LogRangeAsType
<
float
>
(
std
::
cout
<<
"dy : "
,
dy
.
mData
,
","
)
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"host_dx : "
,
host_dx
.
mData
,
","
)
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"dx : "
,
dx
.
mData
,
","
)
<<
std
::
endl
;
}
if
(
!
pass
)
{
std
::
cout
<<
inst_ptr
->
GetTypeString
()
<<
" failed verification: "
;
LogRange
(
std
::
cout
<<
"lengths = ["
,
length
,
", "
)
<<
"]."
<<
std
::
endl
;
return
false
;
}
else
{
if
(
time_kernel
)
std
::
cout
<<
"pass"
<<
std
::
endl
;
}
}
}
if
(
time_kernel
)
{
LogRange
(
std
::
cout
<<
"length = "
,
length
,
","
)
<<
", "
;
LogRange
(
std
::
cout
<<
"reduce dims "
,
reduce_dim
,
","
)
<<
std
::
endl
;
std
::
cout
<<
"best perf = "
<<
best_avg_time
<<
" ms, "
<<
best_gb_per_sec
<<
" GB/s,"
<<
best_instance_name
<<
std
::
endl
;
}
if
(
num_kernel
==
0
)
{
std
::
cout
<<
"Error: No kernel is applicable"
<<
std
::
endl
;
return
false
;
}
return
true
;
}
}
// namespace profiler
}
// namespace ck
profiler/src/CMakeLists.txt
View file @
32806d5f
...
@@ -16,7 +16,9 @@ set(PROFILER_SOURCES
...
@@ -16,7 +16,9 @@ set(PROFILER_SOURCES
profile_grouped_conv_fwd.cpp
profile_grouped_conv_fwd.cpp
profile_grouped_conv_bwd_weight.cpp
profile_grouped_conv_bwd_weight.cpp
profile_reduce.cpp
profile_reduce.cpp
profile_groupnorm_bwd_data.cpp
profile_groupnorm_fwd.cpp
profile_groupnorm_fwd.cpp
profile_layernorm_bwd_data.cpp
profile_layernorm_fwd.cpp
profile_layernorm_fwd.cpp
profile_max_pool3d_fwd.cpp
profile_max_pool3d_fwd.cpp
profile_avg_pool3d_bwd.cpp
profile_avg_pool3d_bwd.cpp
...
@@ -78,6 +80,7 @@ target_link_libraries(${PROFILER_EXECUTABLE} PRIVATE device_grouped_conv3d_bwd_w
...
@@ -78,6 +80,7 @@ target_link_libraries(${PROFILER_EXECUTABLE} PRIVATE device_grouped_conv3d_bwd_w
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_conv2d_fwd_bias_relu_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_conv2d_fwd_bias_relu_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_conv2d_fwd_bias_relu_add_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_conv2d_fwd_bias_relu_add_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_normalization_fwd_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_normalization_fwd_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_normalization_bwd_data_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_softmax_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_softmax_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_reduce_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_reduce_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_batchnorm_instance
)
target_link_libraries
(
${
PROFILER_EXECUTABLE
}
PRIVATE device_batchnorm_instance
)
...
...
profiler/src/profile_groupnorm_bwd_data.cpp
0 → 100644
View file @
32806d5f
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include <iostream>
#include <vector>
#include <unordered_map>
#include "profiler/data_type_enum.hpp"
#include "profiler/profile_groupnorm_bwd_data_impl.hpp"
#include "profiler_operation_registry.hpp"
using
ck
::
index_t
;
struct
groupnormBwdDataArgParser
{
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
int
>>
long_opts
=
{{
"length"
,
{}}};
bool
parse_opt
(
int
argc
,
char
*
argv
[],
const
std
::
string
&
key
,
int
i
)
{
if
(
std
::
string
(
"--"
)
+
key
==
argv
[
i
])
{
int
pos
=
i
;
while
(
++
i
<
argc
&&
argv
[
i
][
0
]
!=
'-'
)
{}
int
end
=
i
;
for
(
int
j
=
pos
+
1
;
j
<
end
;
j
++
)
{
long_opts
[
key
].
push_back
(
std
::
stoi
(
argv
[
j
]));
}
return
true
;
}
return
false
;
}
void
operator
()(
int
argc
,
char
*
argv
[])
{
for
(
auto
&
kv
:
long_opts
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
parse_opt
(
argc
,
argv
,
kv
.
first
,
i
))
break
;
}
}
}
};
void
print_help_groupnorm_bwd_data
()
{
// eg: ckProfiler groupnorm_bwd_data 1 0 2 0 1 --length 1 16 16 32 40
std
::
cout
<<
"arg1: data type (0: fp16; 1: fp32)
\n
"
<<
"arg2: verification (0: no; 1: yes)
\n
"
<<
"arg3: initialization (0: no init; 1: integer value; 2: decimal value)
\n
"
<<
"arg4: print tensor value (0: no; 1: yes)
\n
"
<<
"arg5: time kernel (0=no, 1=yes)
\n
"
<<
"--length: tensor extents (e.g, --length 1 16 16 32 40)
\n
"
<<
std
::
endl
;
}
int
profile_groupnorm_bwd_data
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<=
2
)
{
print_help_groupnorm_bwd_data
();
return
0
;
}
groupnormBwdDataArgParser
arg_parser
;
// short unnamed options
const
ck
::
DataTypeEnum
data_type
=
static_cast
<
ck
::
DataTypeEnum
>
(
std
::
stoi
(
argv
[
2
]));
const
bool
do_verification
=
std
::
stoi
(
argv
[
3
]);
const
int
init_method
=
std
::
stoi
(
argv
[
4
]);
const
bool
do_log
=
std
::
stoi
(
argv
[
5
]);
const
bool
time_kernel
=
std
::
stoi
(
argv
[
6
]);
// parse the long options
arg_parser
(
argc
,
argv
);
const
std
::
vector
<
index_t
>
length
=
arg_parser
.
long_opts
[
"length"
];
using
F32
=
float
;
if
(
length
.
size
()
==
5
)
{
if
(
data_type
==
ck
::
DataTypeEnum
::
Float
)
{
ck
::
profiler
::
profile_groupnorm_bwd_data_impl
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
>
(
do_verification
,
init_method
,
do_log
,
time_kernel
,
length
);
}
else
{
throw
std
::
runtime_error
(
"not implemented yet"
);
}
}
else
{
throw
std
::
runtime_error
(
"length should be 5"
);
}
return
0
;
}
REGISTER_PROFILER_OPERATION
(
"groupnorm_bwd_data"
,
"Group Normalization"
,
profile_groupnorm_bwd_data
);
Prev
1
2
3
4
5
6
7
Next
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