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
9b3365e1
Unverified
Commit
9b3365e1
authored
Nov 12, 2022
by
Po Yen Chen
Committed by
GitHub
Nov 12, 2022
Browse files
Merge branch 'develop' into gridwise_2d
parents
9608beee
b79bbbc2
Changes
187
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
221 additions
and
245 deletions
+221
-245
profiler/include/profile_conv_bwd_data_impl.hpp
profiler/include/profile_conv_bwd_data_impl.hpp
+1
-2
profiler/include/profile_conv_fwd_bias_relu_add_impl.hpp
profiler/include/profile_conv_fwd_bias_relu_add_impl.hpp
+7
-8
profiler/include/profile_conv_fwd_bias_relu_impl.hpp
profiler/include/profile_conv_fwd_bias_relu_impl.hpp
+7
-8
profiler/include/profile_conv_fwd_impl.hpp
profiler/include/profile_conv_fwd_impl.hpp
+1
-1
profiler/include/profile_convnd_bwd_data_impl.hpp
profiler/include/profile_convnd_bwd_data_impl.hpp
+1
-1
profiler/include/profile_convnd_bwd_weight_impl.hpp
profiler/include/profile_convnd_bwd_weight_impl.hpp
+1
-1
profiler/include/profile_elementwise_layernorm_impl.hpp
profiler/include/profile_elementwise_layernorm_impl.hpp
+4
-2
profiler/include/profile_gemm_add_add_fastgelu_impl.hpp
profiler/include/profile_gemm_add_add_fastgelu_impl.hpp
+7
-8
profiler/include/profile_gemm_bias_add_reduce_impl.hpp
profiler/include/profile_gemm_bias_add_reduce_impl.hpp
+13
-17
profiler/include/profile_gemm_bilinear_impl.hpp
profiler/include/profile_gemm_bilinear_impl.hpp
+7
-8
profiler/include/profile_gemm_impl.hpp
profiler/include/profile_gemm_impl.hpp
+6
-6
profiler/include/profile_gemm_reduce_impl.hpp
profiler/include/profile_gemm_reduce_impl.hpp
+12
-15
profiler/include/profile_gemm_splitk_impl.hpp
profiler/include/profile_gemm_splitk_impl.hpp
+6
-6
profiler/include/profile_grouped_conv_bwd_weight_impl.hpp
profiler/include/profile_grouped_conv_bwd_weight_impl.hpp
+61
-73
profiler/include/profile_grouped_conv_fwd_impl.hpp
profiler/include/profile_grouped_conv_fwd_impl.hpp
+24
-25
profiler/include/profile_grouped_gemm_impl.hpp
profiler/include/profile_grouped_gemm_impl.hpp
+6
-6
profiler/include/profile_groupnorm_impl.hpp
profiler/include/profile_groupnorm_impl.hpp
+1
-2
profiler/include/profile_reduce_impl.hpp
profiler/include/profile_reduce_impl.hpp
+2
-3
profiler/src/profile_grouped_conv_bwd_weight.cpp
profiler/src/profile_grouped_conv_bwd_weight.cpp
+48
-47
profiler/src/profiler.cpp
profiler/src/profiler.cpp
+6
-6
No files found.
profiler/include/profile_conv_bwd_data_impl.hpp
View file @
9b3365e1
...
@@ -209,8 +209,7 @@ bool profile_conv_bwd_data_impl(int do_verification,
...
@@ -209,8 +209,7 @@ bool profile_conv_bwd_data_impl(int do_verification,
{
{
in_device_buf
.
FromDevice
(
input_device_result
.
mData
.
data
());
in_device_buf
.
FromDevice
(
input_device_result
.
mData
.
data
());
pass
=
pass
=
pass
&
ck
::
utils
::
check_err
(
input_device_result
,
input_host_result
);
pass
&
ck
::
utils
::
check_err
(
input_device_result
.
mData
,
input_host_result
.
mData
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_conv_fwd_bias_relu_add_impl.hpp
View file @
9b3365e1
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_conv_fwd_bias_activation_add.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_conv_fwd_bias_activation_add.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -68,19 +69,19 @@ void profile_conv_fwd_bias_relu_add_impl(int do_verification,
...
@@ -68,19 +69,19 @@ void profile_conv_fwd_bias_relu_add_impl(int do_verification,
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
N_
,
std
::
size_t
C_
,
std
::
size_t
H
,
std
::
size_t
W
,
auto
layout
)
{
[](
std
::
size_t
N_
,
std
::
size_t
C_
,
std
::
size_t
H
,
std
::
size_t
W
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
constexpr
(
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NCHW
>::
value
||
if
constexpr
(
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NCHW
>::
value
||
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
KCYX
>::
value
||
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
KCYX
>::
value
||
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NKHW
>::
value
)
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NKHW
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
N_
,
C_
,
H
,
W
}),
return
HostTensorDescriptor
({
N_
,
C_
,
H
,
W
},
{
C_
*
H
*
W
,
H
*
W
,
W
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
C_
*
H
*
W
,
H
*
W
,
W
,
1
}));
}
}
else
if
constexpr
(
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWC
>::
value
||
else
if
constexpr
(
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWC
>::
value
||
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
KYXC
>::
value
||
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
KYXC
>::
value
||
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWK
>::
value
)
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWK
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
N_
,
C_
,
H
,
W
}),
return
HostTensorDescriptor
({
N_
,
C_
,
H
,
W
},
{
C_
*
H
*
W
,
1
_uz
,
W
*
C_
,
C_
});
std
::
vector
<
std
::
size_t
>
({
C_
*
H
*
W
,
1
,
W
*
C_
,
C_
}));
}
}
};
};
...
@@ -92,8 +93,7 @@ void profile_conv_fwd_bias_relu_add_impl(int do_verification,
...
@@ -92,8 +93,7 @@ void profile_conv_fwd_bias_relu_add_impl(int do_verification,
f_host_tensor_descriptor
(
N
,
K
,
Ho
,
Wo
,
OutLayout
{}));
f_host_tensor_descriptor
(
N
,
K
,
Ho
,
Wo
,
OutLayout
{}));
// bias: assume contiguous 1d vector
// bias: assume contiguous 1d vector
Tensor
<
OutDataType
>
bias_k
(
Tensor
<
OutDataType
>
bias_k
({
K
});
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
K
)})));
// residual: assume same layout as output tensor
// residual: assume same layout as output tensor
Tensor
<
OutDataType
>
resi_n_k_ho_wo
(
f_host_tensor_descriptor
(
N
,
K
,
Ho
,
Wo
,
OutLayout
{}));
Tensor
<
OutDataType
>
resi_n_k_ho_wo
(
f_host_tensor_descriptor
(
N
,
K
,
Ho
,
Wo
,
OutLayout
{}));
...
@@ -251,8 +251,7 @@ void profile_conv_fwd_bias_relu_add_impl(int do_verification,
...
@@ -251,8 +251,7 @@ void profile_conv_fwd_bias_relu_add_impl(int do_verification,
{
{
out_device_buf
.
FromDevice
(
out_n_k_ho_wo_device_result
.
mData
.
data
());
out_device_buf
.
FromDevice
(
out_n_k_ho_wo_device_result
.
mData
.
data
());
ck
::
utils
::
check_err
(
out_n_k_ho_wo_device_result
.
mData
,
ck
::
utils
::
check_err
(
out_n_k_ho_wo_device_result
,
out_n_k_ho_wo_host_result
);
out_n_k_ho_wo_host_result
.
mData
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_conv_fwd_bias_relu_impl.hpp
View file @
9b3365e1
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_conv_fwd_bias_activation.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_conv_fwd_bias_activation.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -68,19 +69,19 @@ void profile_conv_fwd_bias_relu_impl(int do_verification,
...
@@ -68,19 +69,19 @@ void profile_conv_fwd_bias_relu_impl(int do_verification,
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
N_
,
std
::
size_t
C_
,
std
::
size_t
H
,
std
::
size_t
W
,
auto
layout
)
{
[](
std
::
size_t
N_
,
std
::
size_t
C_
,
std
::
size_t
H
,
std
::
size_t
W
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
constexpr
(
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NCHW
>::
value
||
if
constexpr
(
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NCHW
>::
value
||
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
KCYX
>::
value
||
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
KCYX
>::
value
||
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NKHW
>::
value
)
is_same
<
decltype
(
layout
),
ck
::
tensor_layout
::
convolution
::
NKHW
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
N_
,
C_
,
H
,
W
}),
return
HostTensorDescriptor
({
N_
,
C_
,
H
,
W
},
{
C_
*
H
*
W
,
H
*
W
,
W
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
C_
*
H
*
W
,
H
*
W
,
W
,
1
}));
}
}
else
if
constexpr
(
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWC
>::
value
||
else
if
constexpr
(
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWC
>::
value
||
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
KYXC
>::
value
||
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
KYXC
>::
value
||
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWK
>::
value
)
is_same
<
decltype
(
layout
),
tensor_layout
::
convolution
::
NHWK
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
N_
,
C_
,
H
,
W
}),
return
HostTensorDescriptor
({
N_
,
C_
,
H
,
W
},
{
C_
*
H
*
W
,
1
_uz
,
W
*
C_
,
C_
});
std
::
vector
<
std
::
size_t
>
({
C_
*
H
*
W
,
1
,
W
*
C_
,
C_
}));
}
}
};
};
...
@@ -92,8 +93,7 @@ void profile_conv_fwd_bias_relu_impl(int do_verification,
...
@@ -92,8 +93,7 @@ void profile_conv_fwd_bias_relu_impl(int do_verification,
f_host_tensor_descriptor
(
N
,
K
,
Ho
,
Wo
,
OutLayout
{}));
f_host_tensor_descriptor
(
N
,
K
,
Ho
,
Wo
,
OutLayout
{}));
// bias: assume contiguous 1d vector
// bias: assume contiguous 1d vector
Tensor
<
OutDataType
>
bias_k
(
Tensor
<
OutDataType
>
bias_k
({
K
});
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
K
)})));
std
::
cout
<<
"in_n_c_hi_wi: "
<<
in_n_c_hi_wi
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"in_n_c_hi_wi: "
<<
in_n_c_hi_wi
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"wei_k_c_y_x: "
<<
wei_k_c_y_x
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"wei_k_c_y_x: "
<<
wei_k_c_y_x
.
mDesc
<<
std
::
endl
;
...
@@ -239,8 +239,7 @@ void profile_conv_fwd_bias_relu_impl(int do_verification,
...
@@ -239,8 +239,7 @@ void profile_conv_fwd_bias_relu_impl(int do_verification,
{
{
out_device_buf
.
FromDevice
(
out_n_k_ho_wo_device_result
.
mData
.
data
());
out_device_buf
.
FromDevice
(
out_n_k_ho_wo_device_result
.
mData
.
data
());
ck
::
utils
::
check_err
(
out_n_k_ho_wo_device_result
.
mData
,
ck
::
utils
::
check_err
(
out_n_k_ho_wo_device_result
,
out_n_k_ho_wo_host_result
);
out_n_k_ho_wo_host_result
.
mData
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_conv_fwd_impl.hpp
View file @
9b3365e1
...
@@ -191,7 +191,7 @@ bool profile_conv_fwd_impl(int do_verification,
...
@@ -191,7 +191,7 @@ bool profile_conv_fwd_impl(int do_verification,
{
{
out_device_buf
.
FromDevice
(
device_output
.
mData
.
data
());
out_device_buf
.
FromDevice
(
device_output
.
mData
.
data
());
pass
=
pass
&
ck
::
utils
::
check_err
(
device_output
.
mData
,
host_output
.
mData
);
pass
=
pass
&
ck
::
utils
::
check_err
(
device_output
,
host_output
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_convnd_bwd_data_impl.hpp
View file @
9b3365e1
...
@@ -453,7 +453,7 @@ bool profile_convnd_bwd_data_impl(int do_verification,
...
@@ -453,7 +453,7 @@ bool profile_convnd_bwd_data_impl(int do_verification,
std
::
cout
<<
"Pass Info: "
<<
conv_ptr
->
GetTypeString
()
<<
std
::
endl
;
std
::
cout
<<
"Pass Info: "
<<
conv_ptr
->
GetTypeString
()
<<
std
::
endl
;
}
}
success
=
ck
::
utils
::
check_err
(
input_host_result
.
mData
,
input_device_result
.
mData
);
success
=
ck
::
utils
::
check_err
(
input_host_result
,
input_device_result
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_convnd_bwd_weight_impl.hpp
View file @
9b3365e1
...
@@ -433,7 +433,7 @@ bool profile_convnd_bwd_weight_impl(int do_verification,
...
@@ -433,7 +433,7 @@ bool profile_convnd_bwd_weight_impl(int do_verification,
{
{
wei_device_buf
.
FromDevice
(
weights_device_result
.
mData
.
data
());
wei_device_buf
.
FromDevice
(
weights_device_result
.
mData
.
data
());
success
=
ck
::
utils
::
check_err
(
weights_host_result
.
mData
,
weights_device_result
.
mData
);
success
=
ck
::
utils
::
check_err
(
weights_host_result
,
weights_device_result
);
if
(
success
==
false
)
if
(
success
==
false
)
{
{
...
...
profiler/include/profile_elementwise_layernorm_impl.hpp
View file @
9b3365e1
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_layernorm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_layernorm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -68,8 +69,9 @@ bool profile_elementwise_layernorm_impl(int do_verification,
...
@@ -68,8 +69,9 @@ bool profile_elementwise_layernorm_impl(int do_verification,
std
::
vector
<
index_t
>
gammaBetaStride
=
{
0
,
1
};
std
::
vector
<
index_t
>
gammaBetaStride
=
{
0
,
1
};
auto
f_host_tensor_descriptor2d
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
)
{
auto
f_host_tensor_descriptor2d
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
)
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
using
namespace
ck
::
literals
;
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
};
};
Tensor
<
ADataType
>
a
(
length
);
Tensor
<
ADataType
>
a
(
length
);
...
...
profiler/include/profile_gemm_add_add_fastgelu_impl.hpp
View file @
9b3365e1
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -47,15 +48,15 @@ bool profile_gemm_add_add_fastgelu_impl(int do_verification,
...
@@ -47,15 +48,15 @@ bool profile_gemm_add_add_fastgelu_impl(int do_verification,
{
{
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -121,8 +122,7 @@ bool profile_gemm_add_add_fastgelu_impl(int do_verification,
...
@@ -121,8 +122,7 @@ bool profile_gemm_add_add_fastgelu_impl(int do_verification,
// run reference
// run reference
if
(
do_verification
)
if
(
do_verification
)
{
{
Tensor
<
AccDataType
>
c_m_n
(
HostTensorDescriptor
(
Tensor
<
AccDataType
>
c_m_n
({
M
,
N
});
std
::
vector
<
std
::
size_t
>
{
static_cast
<
std
::
size_t
>
(
M
),
static_cast
<
std
::
size_t
>
(
N
)}));
using
ReferenceGemmInstance
=
ck
::
tensor_operation
::
host
::
ReferenceGemm
<
ADataType
,
using
ReferenceGemmInstance
=
ck
::
tensor_operation
::
host
::
ReferenceGemm
<
ADataType
,
BDataType
,
BDataType
,
...
@@ -223,8 +223,7 @@ bool profile_gemm_add_add_fastgelu_impl(int do_verification,
...
@@ -223,8 +223,7 @@ bool profile_gemm_add_add_fastgelu_impl(int do_verification,
{
{
e_device_buf
.
FromDevice
(
e_m_n_device_result
.
mData
.
data
());
e_device_buf
.
FromDevice
(
e_m_n_device_result
.
mData
.
data
());
pass
=
pass
&&
pass
=
pass
&&
ck
::
utils
::
check_err
(
e_m_n_device_result
,
e_m_n_host_result
);
ck
::
utils
::
check_err
(
e_m_n_device_result
.
mData
,
e_m_n_host_result
.
mData
);
}
}
}
}
else
else
...
...
profiler/include/profile_gemm_bias_add_reduce_impl.hpp
View file @
9b3365e1
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -75,21 +76,20 @@ void profile_gemm_bias_add_reduce_impl(int do_verification,
...
@@ -75,21 +76,20 @@ void profile_gemm_bias_add_reduce_impl(int do_verification,
int
StrideD0
)
int
StrideD0
)
{
{
auto
f_host_tensor_descriptor1d
=
[](
std
::
size_t
len
,
std
::
size_t
stride
)
{
auto
f_host_tensor_descriptor1d
=
[](
std
::
size_t
len
,
std
::
size_t
stride
)
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
len
}),
return
HostTensorDescriptor
({
len
},
{
stride
});
std
::
vector
<
std
::
size_t
>
({
stride
}));
};
};
auto
f_host_tensor_descriptor2d
=
auto
f_host_tensor_descriptor2d
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -99,16 +99,12 @@ void profile_gemm_bias_add_reduce_impl(int do_verification,
...
@@ -99,16 +99,12 @@ void profile_gemm_bias_add_reduce_impl(int do_verification,
Tensor
<
CDataType
>
c_m_n_host_result
(
f_host_tensor_descriptor2d
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
CDataType
>
c_m_n_host_result
(
f_host_tensor_descriptor2d
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
BiasDataType
>
bias_n
(
f_host_tensor_descriptor1d
(
N
,
1
));
Tensor
<
BiasDataType
>
bias_n
(
f_host_tensor_descriptor1d
(
N
,
1
));
Tensor
<
D0DataType
>
d0_m_n
(
f_host_tensor_descriptor2d
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
D0DataType
>
d0_m_n
(
f_host_tensor_descriptor2d
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
ReduceDataType
>
reduce0_m_host_result
(
Tensor
<
ReduceDataType
>
reduce0_m_host_result
({
M
});
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
Tensor
<
ReduceDataType
>
reduce1_m_host_result
({
M
});
Tensor
<
ReduceDataType
>
reduce1_m_host_result
(
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
Tensor
<
CDataType
>
c_m_n_device_result
(
f_host_tensor_descriptor2d
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
CDataType
>
c_m_n_device_result
(
f_host_tensor_descriptor2d
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
ReduceDataType
>
reduce0_m_device_result
(
Tensor
<
ReduceDataType
>
reduce0_m_device_result
({
M
});
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
Tensor
<
ReduceDataType
>
reduce1_m_device_result
({
M
});
Tensor
<
ReduceDataType
>
reduce1_m_device_result
(
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
std
::
cout
<<
"a_m_k: "
<<
a_m_k
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"a_m_k: "
<<
a_m_k
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"b_k_n: "
<<
b_k_n
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"b_k_n: "
<<
b_k_n
.
mDesc
<<
std
::
endl
;
...
@@ -347,9 +343,9 @@ void profile_gemm_bias_add_reduce_impl(int do_verification,
...
@@ -347,9 +343,9 @@ void profile_gemm_bias_add_reduce_impl(int do_verification,
reduce0_device_buf
.
FromDevice
(
reduce0_m_device_result
.
mData
.
data
());
reduce0_device_buf
.
FromDevice
(
reduce0_m_device_result
.
mData
.
data
());
reduce1_device_buf
.
FromDevice
(
reduce1_m_device_result
.
mData
.
data
());
reduce1_device_buf
.
FromDevice
(
reduce1_m_device_result
.
mData
.
data
());
ck
::
utils
::
check_err
(
c_m_n_device_result
.
mData
,
c_m_n_host_result
.
mData
);
ck
::
utils
::
check_err
(
c_m_n_device_result
,
c_m_n_host_result
);
ck
::
utils
::
check_err
(
reduce0_m_device_result
.
mData
,
reduce0_m_host_result
.
mData
);
ck
::
utils
::
check_err
(
reduce0_m_device_result
,
reduce0_m_host_result
);
ck
::
utils
::
check_err
(
reduce1_m_device_result
.
mData
,
reduce1_m_host_result
.
mData
);
ck
::
utils
::
check_err
(
reduce1_m_device_result
,
reduce1_m_host_result
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_gemm_bilinear_impl.hpp
View file @
9b3365e1
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -46,15 +47,15 @@ bool profile_gemm_bilinear_impl(int do_verification,
...
@@ -46,15 +47,15 @@ bool profile_gemm_bilinear_impl(int do_verification,
{
{
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -116,8 +117,7 @@ bool profile_gemm_bilinear_impl(int do_verification,
...
@@ -116,8 +117,7 @@ bool profile_gemm_bilinear_impl(int do_verification,
// run reference
// run reference
if
(
do_verification
)
if
(
do_verification
)
{
{
Tensor
<
AccDataType
>
c_m_n
(
HostTensorDescriptor
(
Tensor
<
AccDataType
>
c_m_n
({
M
,
N
});
std
::
vector
<
std
::
size_t
>
{
static_cast
<
std
::
size_t
>
(
M
),
static_cast
<
std
::
size_t
>
(
N
)}));
using
ReferenceGemmInstance
=
ck
::
tensor_operation
::
host
::
ReferenceGemm
<
ADataType
,
using
ReferenceGemmInstance
=
ck
::
tensor_operation
::
host
::
ReferenceGemm
<
ADataType
,
BDataType
,
BDataType
,
...
@@ -215,8 +215,7 @@ bool profile_gemm_bilinear_impl(int do_verification,
...
@@ -215,8 +215,7 @@ bool profile_gemm_bilinear_impl(int do_verification,
{
{
e_device_buf
.
FromDevice
(
e_m_n_device_result
.
mData
.
data
());
e_device_buf
.
FromDevice
(
e_m_n_device_result
.
mData
.
data
());
pass
=
pass
&&
pass
=
pass
&&
ck
::
utils
::
check_err
(
e_m_n_device_result
,
e_m_n_host_result
);
ck
::
utils
::
check_err
(
e_m_n_device_result
.
mData
,
e_m_n_host_result
.
mData
);
}
}
}
}
else
else
...
...
profiler/include/profile_gemm_impl.hpp
View file @
9b3365e1
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -45,15 +46,15 @@ int profile_gemm_impl(int do_verification,
...
@@ -45,15 +46,15 @@ int profile_gemm_impl(int do_verification,
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -187,8 +188,7 @@ int profile_gemm_impl(int do_verification,
...
@@ -187,8 +188,7 @@ int profile_gemm_impl(int do_verification,
{
{
c_device_buf
.
FromDevice
(
c_m_n_device_result
.
mData
.
data
());
c_device_buf
.
FromDevice
(
c_m_n_device_result
.
mData
.
data
());
pass
=
pass
=
pass
&
ck
::
utils
::
check_err
(
c_m_n_device_result
,
c_m_n_host_result
);
pass
&
ck
::
utils
::
check_err
(
c_m_n_device_result
.
mData
,
c_m_n_host_result
.
mData
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_gemm_reduce_impl.hpp
View file @
9b3365e1
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -75,15 +76,15 @@ bool profile_gemm_reduce_impl(int do_verification,
...
@@ -75,15 +76,15 @@ bool profile_gemm_reduce_impl(int do_verification,
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -91,16 +92,12 @@ bool profile_gemm_reduce_impl(int do_verification,
...
@@ -91,16 +92,12 @@ bool profile_gemm_reduce_impl(int do_verification,
Tensor
<
BDataType
>
b_k_n
(
f_host_tensor_descriptor
(
K
,
N
,
StrideB
,
BLayout
{}));
Tensor
<
BDataType
>
b_k_n
(
f_host_tensor_descriptor
(
K
,
N
,
StrideB
,
BLayout
{}));
Tensor
<
CDataType
>
c_m_n_host_result
(
f_host_tensor_descriptor
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
CDataType
>
c_m_n_host_result
(
f_host_tensor_descriptor
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
ReduceDataType
>
reduce0_m_host_result
(
Tensor
<
ReduceDataType
>
reduce0_m_host_result
({
M
});
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
Tensor
<
ReduceDataType
>
reduce1_m_host_result
({
M
});
Tensor
<
ReduceDataType
>
reduce1_m_host_result
(
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
Tensor
<
CDataType
>
c_m_n_device_result
(
f_host_tensor_descriptor
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
CDataType
>
c_m_n_device_result
(
f_host_tensor_descriptor
(
M
,
N
,
StrideC
,
CLayout
{}));
Tensor
<
ReduceDataType
>
reduce0_m_device_result
(
Tensor
<
ReduceDataType
>
reduce0_m_device_result
({
M
});
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
Tensor
<
ReduceDataType
>
reduce1_m_device_result
({
M
});
Tensor
<
ReduceDataType
>
reduce1_m_device_result
(
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
static_cast
<
std
::
size_t
>
(
M
)})));
std
::
cout
<<
"a_m_k: "
<<
a_m_k
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"a_m_k: "
<<
a_m_k
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"b_k_n: "
<<
b_k_n
.
mDesc
<<
std
::
endl
;
std
::
cout
<<
"b_k_n: "
<<
b_k_n
.
mDesc
<<
std
::
endl
;
...
@@ -313,9 +310,9 @@ bool profile_gemm_reduce_impl(int do_verification,
...
@@ -313,9 +310,9 @@ bool profile_gemm_reduce_impl(int do_verification,
reduce0_device_buf
.
FromDevice
(
reduce0_m_device_result
.
mData
.
data
());
reduce0_device_buf
.
FromDevice
(
reduce0_m_device_result
.
mData
.
data
());
reduce1_device_buf
.
FromDevice
(
reduce1_m_device_result
.
mData
.
data
());
reduce1_device_buf
.
FromDevice
(
reduce1_m_device_result
.
mData
.
data
());
ck
::
utils
::
check_err
(
c_m_n_device_result
.
mData
,
c_m_n_host_result
.
mData
);
ck
::
utils
::
check_err
(
c_m_n_device_result
,
c_m_n_host_result
);
ck
::
utils
::
check_err
(
reduce0_m_device_result
.
mData
,
reduce0_m_host_result
.
mData
);
ck
::
utils
::
check_err
(
reduce0_m_device_result
,
reduce0_m_host_result
);
ck
::
utils
::
check_err
(
reduce1_m_device_result
.
mData
,
reduce1_m_host_result
.
mData
);
ck
::
utils
::
check_err
(
reduce1_m_device_result
,
reduce1_m_host_result
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_gemm_splitk_impl.hpp
View file @
9b3365e1
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -46,15 +47,15 @@ bool profile_gemm_splitk_impl(int do_verification,
...
@@ -46,15 +47,15 @@ bool profile_gemm_splitk_impl(int do_verification,
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -190,8 +191,7 @@ bool profile_gemm_splitk_impl(int do_verification,
...
@@ -190,8 +191,7 @@ bool profile_gemm_splitk_impl(int do_verification,
{
{
c_device_buf
.
FromDevice
(
c_m_n_device_result
.
mData
.
data
());
c_device_buf
.
FromDevice
(
c_m_n_device_result
.
mData
.
data
());
pass
=
pass
=
pass
&
ck
::
utils
::
check_err
(
c_m_n_device_result
,
c_m_n_host_result
);
pass
&
ck
::
utils
::
check_err
(
c_m_n_device_result
.
mData
,
c_m_n_host_result
.
mData
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_conv_bwd_weight_impl.hpp
→
profiler/include/profile_
grouped_
conv_bwd_weight_impl.hpp
View file @
9b3365e1
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
#pragma once
#pragma once
#include
"ck/ck.hpp"
#include
<algorithm>
#include <iomanip>
#include <iomanip>
#include <iostream>
#include <iostream>
#include <iterator>
#include <typeinfo>
#include <typeinfo>
#include "ck/ck.hpp"
#include "ck/ck.hpp"
...
@@ -13,7 +14,7 @@
...
@@ -13,7 +14,7 @@
#include "ck/tensor_operation/gpu/device/device_conv_fwd.hpp"
#include "ck/tensor_operation/gpu/device/device_conv_fwd.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
#include "ck/library/tensor_operation_instance/gpu/convolution_backward_weight.hpp"
#include "ck/library/tensor_operation_instance/gpu/
grouped_
convolution_backward_weight.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
...
@@ -26,32 +27,6 @@
...
@@ -26,32 +27,6 @@
namespace
ck
{
namespace
ck
{
namespace
profiler
{
namespace
profiler
{
template
<
typename
DataType
>
void
show_data_nhwc_layout
(
Tensor
<
DataType
>&
nhwc
)
{
std
::
cout
<<
"["
;
for
(
int
n
=
0
;
n
<
ck
::
type_convert
<
int
>
(
nhwc
.
mDesc
.
GetLengths
()[
0
]);
n
++
)
{
std
::
cout
<<
"["
;
for
(
int
hi
=
0
;
hi
<
ck
::
type_convert
<
int
>
(
nhwc
.
mDesc
.
GetLengths
()[
2
]);
hi
++
)
{
std
::
cout
<<
"["
;
for
(
int
wi
=
0
;
wi
<
ck
::
type_convert
<
int
>
(
nhwc
.
mDesc
.
GetLengths
()[
3
]);
wi
++
)
{
std
::
cout
<<
"["
;
for
(
int
c
=
0
;
c
<
ck
::
type_convert
<
int
>
(
nhwc
.
mDesc
.
GetLengths
()[
1
]);
c
++
)
{
std
::
cout
<<
static_cast
<
float
>
(
nhwc
(
n
,
c
,
hi
,
wi
))
<<
" "
;
}
std
::
cout
<<
"]"
;
}
std
::
cout
<<
"]"
;
}
std
::
cout
<<
"]"
;
}
std
::
cout
<<
"]"
;
}
template
<
ck
::
index_t
NDimSpatial
,
template
<
ck
::
index_t
NDimSpatial
,
typename
InLayout
,
typename
InLayout
,
typename
WeiLayout
,
typename
WeiLayout
,
...
@@ -59,12 +34,12 @@ template <ck::index_t NDimSpatial,
...
@@ -59,12 +34,12 @@ template <ck::index_t NDimSpatial,
typename
InDataType
,
typename
InDataType
,
typename
WeiDataType
,
typename
WeiDataType
,
typename
OutDataType
>
typename
OutDataType
>
bool
profile_conv_bwd_weight_impl
(
int
do_verification
,
bool
profile_
grouped_
conv_bwd_weight_impl
(
int
do_verification
,
int
init_method
,
int
init_method
,
bool
do_log
,
bool
do_log
,
bool
time_kernel
,
bool
time_kernel
,
const
ck
::
utils
::
conv
::
ConvParam
&
conv_param
,
const
ck
::
utils
::
conv
::
ConvParam
&
conv_param
,
ck
::
index_t
split_k
)
ck
::
index_t
split_k
)
{
{
using
InElementOp
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
InElementOp
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
WeiElementOp
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
using
WeiElementOp
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
...
@@ -114,16 +89,14 @@ bool profile_conv_bwd_weight_impl(int do_verification,
...
@@ -114,16 +89,14 @@ bool profile_conv_bwd_weight_impl(int do_verification,
if
(
do_verification
)
if
(
do_verification
)
{
{
auto
ref_conv
=
ck
::
tensor_operation
::
host
::
ReferenceConvBwdWeight
<
NDimSpatial
,
auto
ref_conv
=
ck
::
tensor_operation
::
host
::
ReferenceConvBwdWeight
<
NDimSpatial
,
InDataType
,
InDataType
,
WeiDataType
,
WeiDataType
,
OutDataType
,
OutDataType
,
InElementOp
,
InElementOp
,
WeiElementOp
,
WeiElementOp
,
OutElementOp
>
{};
OutElementOp
>
{};
auto
ref_invoker
=
ref_conv
.
MakeInvoker
();
auto
ref_invoker
=
ref_conv
.
MakeInvoker
();
auto
ref_argument
=
ref_conv
.
MakeArgument
(
input
,
auto
ref_argument
=
ref_conv
.
MakeArgument
(
input
,
weight_host_result
,
weight_host_result
,
output
,
output
,
...
@@ -138,16 +111,16 @@ bool profile_conv_bwd_weight_impl(int do_verification,
...
@@ -138,16 +111,16 @@ bool profile_conv_bwd_weight_impl(int do_verification,
ref_invoker
.
Run
(
ref_argument
);
ref_invoker
.
Run
(
ref_argument
);
}
}
using
DeviceOp
=
ck
::
tensor_operation
::
device
::
DeviceConvBwdWeight
<
NDimSpatial
,
using
DeviceOp
=
ck
::
tensor_operation
::
device
::
Device
Grouped
ConvBwdWeight
<
NDimSpatial
,
InLayout
,
InLayout
,
WeiLayout
,
WeiLayout
,
OutLayout
,
OutLayout
,
InDataType
,
InDataType
,
WeiDataType
,
WeiDataType
,
OutDataType
,
OutDataType
,
InElementOp
,
InElementOp
,
WeiElementOp
,
WeiElementOp
,
OutElementOp
>
;
OutElementOp
>
;
// get device op instances
// get device op instances
const
auto
op_ptrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
const
auto
op_ptrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
...
@@ -163,22 +136,41 @@ bool profile_conv_bwd_weight_impl(int do_verification,
...
@@ -163,22 +136,41 @@ bool profile_conv_bwd_weight_impl(int do_verification,
// profile device Conv instances
// profile device Conv instances
bool
all_pass
=
true
;
bool
all_pass
=
true
;
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_spatial_lengths
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
filter_spatial_lengths
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
output_spatial_lengths
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
conv_filter_strides
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
conv_filter_dilations
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_left_pads
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_right_pads
{};
auto
range_copy
=
[](
const
auto
&
from
,
auto
to
)
{
std
::
copy
(
begin
(
from
),
end
(
from
),
to
);
};
range_copy
(
conv_param
.
input_spatial_lengths_
,
begin
(
input_spatial_lengths
));
range_copy
(
conv_param
.
filter_spatial_lengths_
,
begin
(
filter_spatial_lengths
));
range_copy
(
conv_param
.
output_spatial_lengths_
,
begin
(
output_spatial_lengths
));
range_copy
(
conv_param
.
conv_filter_strides_
,
begin
(
conv_filter_strides
));
range_copy
(
conv_param
.
conv_filter_dilations_
,
begin
(
conv_filter_dilations
));
range_copy
(
conv_param
.
input_left_pads_
,
begin
(
input_left_pads
));
range_copy
(
conv_param
.
input_right_pads_
,
begin
(
input_right_pads
));
for
(
auto
&
op_ptr
:
op_ptrs
)
for
(
auto
&
op_ptr
:
op_ptrs
)
{
{
auto
argument_ptr
=
auto
argument_ptr
=
op_ptr
->
MakeArgumentPointer
(
static_cast
<
InDataType
*>
(
in_device_buf
.
GetDeviceBuffer
()),
op_ptr
->
MakeArgumentPointer
(
static_cast
<
InDataType
*>
(
in_device_buf
.
GetDeviceBuffer
()),
static_cast
<
WeiDataType
*>
(
wei_device_buf
.
GetDeviceBuffer
()),
static_cast
<
WeiDataType
*>
(
wei_device_buf
.
GetDeviceBuffer
()),
static_cast
<
OutDataType
*>
(
out_device_buf
.
GetDeviceBuffer
()),
static_cast
<
OutDataType
*>
(
out_device_buf
.
GetDeviceBuffer
()),
conv_param
.
G_
,
conv_param
.
N_
,
conv_param
.
N_
,
conv_param
.
K_
,
conv_param
.
K_
,
conv_param
.
C_
,
conv_param
.
C_
,
conv_param
.
input_spatial_lengths
_
,
input_spatial_lengths
,
conv_param
.
filter_spatial_lengths
_
,
filter_spatial_lengths
,
conv_param
.
output_spatial_lengths
_
,
output_spatial_lengths
,
conv_param
.
conv_filter_strides
_
,
conv_filter_strides
,
conv_param
.
conv_filter_dilations
_
,
conv_filter_dilations
,
conv_param
.
input_left_pads
_
,
input_left_pads
,
conv_param
.
input_right_pads
_
,
input_right_pads
,
in_element_op
,
in_element_op
,
wei_element_op
,
wei_element_op
,
out_element_op
,
out_element_op
,
...
@@ -217,33 +209,29 @@ bool profile_conv_bwd_weight_impl(int do_verification,
...
@@ -217,33 +209,29 @@ bool profile_conv_bwd_weight_impl(int do_verification,
{
{
wei_device_buf
.
FromDevice
(
weight_device_result
.
mData
.
data
());
wei_device_buf
.
FromDevice
(
weight_device_result
.
mData
.
data
());
bool
pass
=
bool
pass
=
ck
::
utils
::
check_err
(
weight_device_result
,
weight_host_result
);
ck
::
utils
::
check_err
(
weight_host_result
.
mData
,
weight_device_result
.
mData
);
if
(
!
pass
)
if
(
!
pass
)
{
{
std
::
cout
<<
"Fail info:"
<<
op_ptr
->
GetTypeString
()
<<
std
::
endl
;
std
::
cout
<<
"Fail info:
"
<<
op_ptr
->
GetTypeString
()
<<
std
::
endl
;
}
}
all_pass
&=
pass
;
all_pass
&=
pass
;
if
(
do_log
)
if
(
do_log
)
{
{
std
::
cout
<<
"in : "
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"output : "
,
output
.
mData
,
","
)
<<
std
::
endl
;
show_data_nhwc_layout
(
output
);
;
std
::
cout
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"weight (device): "
,
weight_device_result
.
mData
,
","
)
std
::
cout
<<
"wei: "
;
<<
std
::
endl
;
show_data_nhwc_layout
(
weight_host_result
);
;
std
::
cout
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"weight (host): "
,
weight_host_result
.
mData
,
","
)
std
::
cout
<<
"out : "
;
<<
std
::
endl
;
show_data_nhwc_layout
(
input
);
;
std
::
cout
<<
std
::
endl
;
LogRangeAsType
<
float
>
(
std
::
cout
<<
"input: "
,
input
.
mData
,
","
)
<<
std
::
endl
;
;
std
::
cout
<<
"wei_device: "
;
show_data_nhwc_layout
(
weight_device_result
);
std
::
cout
<<
std
::
endl
;
}
}
}
}
}
}
...
...
profiler/include/profile_grouped_conv_fwd_impl.hpp
View file @
9b3365e1
...
@@ -9,14 +9,12 @@
...
@@ -9,14 +9,12 @@
#include "ck/ck.hpp"
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "ck/tensor_operation/gpu/device/device_grouped_conv_fwd_multiple_d.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
#include "ck/library/tensor_operation_instance/gpu/grouped_convolution_forward.hpp"
#include "ck/library/tensor_operation_instance/gpu/grouped_convolution_forward.hpp"
#include "ck/tensor_operation/gpu/device/device_grouped_conv_fwd.hpp"
#include "ck/library/tensor_operation_instance/gpu/grouped_convolution_forward_dl.hpp"
#include "ck/library/tensor_operation_instance/gpu/grouped_convolution_forward_dl.hpp"
#include "ck/library/utility/algorithm.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
...
@@ -69,7 +67,7 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
...
@@ -69,7 +67,7 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_left_pads
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_left_pads
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_right_pads
{};
std
::
array
<
ck
::
index_t
,
NDimSpatial
>
input_right_pads
{};
auto
copy
=
[](
auto
&
x
,
auto
&
y
)
{
std
::
copy
(
x
.
begin
(),
x
.
end
()
,
y
.
begin
());
};
auto
copy
=
[](
const
auto
&
x
,
auto
&
y
)
{
ck
::
ranges
::
copy
(
x
,
y
.
begin
());
};
copy
(
in_g_n_c_wis_desc
.
GetLengths
(),
a_g_n_c_wis_lengths
);
copy
(
in_g_n_c_wis_desc
.
GetLengths
(),
a_g_n_c_wis_lengths
);
copy
(
in_g_n_c_wis_desc
.
GetStrides
(),
a_g_n_c_wis_strides
);
copy
(
in_g_n_c_wis_desc
.
GetStrides
(),
a_g_n_c_wis_strides
);
...
@@ -182,7 +180,7 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
...
@@ -182,7 +180,7 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
{
{
out_device_buf
.
FromDevice
(
device_output
.
mData
.
data
());
out_device_buf
.
FromDevice
(
device_output
.
mData
.
data
());
pass
=
pass
&
ck
::
utils
::
check_err
(
device_output
.
mData
,
host_output
.
mData
);
pass
=
pass
&
ck
::
utils
::
check_err
(
device_output
,
host_output
);
if
(
do_log
)
if
(
do_log
)
{
{
...
@@ -224,26 +222,25 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
...
@@ -224,26 +222,25 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
for
(
auto
&
op_ptr
:
op_ptrs
)
for
(
auto
&
op_ptr
:
op_ptrs
)
{
{
auto
argument_ptr
=
op_ptr
->
MakeArgumentPointer
(
auto
argument_ptr
=
op_ptr
->
MakeArgumentPointer
(
in_device_buf
.
GetDeviceBuffer
(),
in_device_buf
.
GetDeviceBuffer
(),
wei_device_buf
.
GetDeviceBuffer
(),
wei_device_buf
.
GetDeviceBuffer
(),
{},
std
::
array
<
const
void
*
,
0
>
{},
out_device_buf
.
GetDeviceBuffer
(),
out_device_buf
.
GetDeviceBuffer
(),
a_g_n_c_wis_lengths
,
a_g_n_c_wis_lengths
,
a_g_n_c_wis_strides
,
a_g_n_c_wis_strides
,
b_g_k_c_xs_lengths
,
b_g_k_c_xs_lengths
,
b_g_k_c_xs_strides
,
b_g_k_c_xs_strides
,
{},
std
::
array
<
std
::
array
<
ck
::
index_t
,
NDimSpatial
+
3
>
,
0
>
{{}},
{},
std
::
array
<
std
::
array
<
ck
::
index_t
,
NDimSpatial
+
3
>
,
0
>
{{}},
e_g_n_k_wos_lengths
,
e_g_n_k_wos_lengths
,
e_g_n_k_wos_strides
,
e_g_n_k_wos_strides
,
conv_filter_strides
,
conv_filter_strides
,
conv_filter_dilations
,
conv_filter_dilations
,
input_left_pads
,
input_left_pads
,
input_right_pads
,
input_right_pads
,
in_element_op
,
in_element_op
,
wei_element_op
,
wei_element_op
,
out_element_op
);
out_element_op
);
run_impl
(
op_ptr
,
argument_ptr
);
run_impl
(
op_ptr
,
argument_ptr
);
}
}
...
@@ -262,8 +259,10 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
...
@@ -262,8 +259,10 @@ bool profile_grouped_conv_fwd_impl(int do_verification,
WeiElementOp
,
WeiElementOp
,
OutElementOp
>
;
OutElementOp
>
;
// get device op instances
const
auto
op_ptrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
const
auto
op_ptrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
DeviceOp
>::
GetInstances
();
DeviceOp
>::
GetInstances
();
std
::
cout
<<
"dl found "
<<
op_ptrs
.
size
()
<<
" instances"
<<
std
::
endl
;
std
::
cout
<<
"dl found "
<<
op_ptrs
.
size
()
<<
" instances"
<<
std
::
endl
;
for
(
auto
&
op_ptr
:
op_ptrs
)
for
(
auto
&
op_ptr
:
op_ptrs
)
...
...
profiler/include/profile_grouped_gemm_impl.hpp
View file @
9b3365e1
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/device_memory.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/host_tensor_generator.hpp"
#include "ck/library/utility/literals.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
#include "ck/library/reference_tensor_operation/cpu/reference_gemm.hpp"
namespace
ck
{
namespace
ck
{
...
@@ -45,15 +46,15 @@ bool profile_grouped_gemm_impl(int do_verification,
...
@@ -45,15 +46,15 @@ bool profile_grouped_gemm_impl(int do_verification,
auto
f_host_tensor_descriptor
=
auto
f_host_tensor_descriptor
=
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
[](
std
::
size_t
row
,
std
::
size_t
col
,
std
::
size_t
stride
,
auto
layout
)
{
using
namespace
ck
::
literals
;
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
if
(
is_same
<
decltype
(
layout
),
tensor_layout
::
gemm
::
RowMajor
>::
value
)
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
stride
,
1
_uz
});
std
::
vector
<
std
::
size_t
>
({
stride
,
1
}));
}
}
else
else
{
{
return
HostTensorDescriptor
(
std
::
vector
<
std
::
size_t
>
({
row
,
col
}),
return
HostTensorDescriptor
({
row
,
col
},
{
1
_uz
,
stride
});
std
::
vector
<
std
::
size_t
>
({
1
,
stride
}));
}
}
};
};
...
@@ -257,8 +258,7 @@ bool profile_grouped_gemm_impl(int do_verification,
...
@@ -257,8 +258,7 @@ bool profile_grouped_gemm_impl(int do_verification,
c_element_op
);
c_element_op
);
ref_invoker
.
Run
(
ref_argument
);
ref_invoker
.
Run
(
ref_argument
);
pass
=
pass
&&
ck
::
utils
::
check_err
(
c_m_n_device_results
[
i
].
mData
,
pass
=
pass
&&
ck
::
utils
::
check_err
(
c_m_n_device_results
[
i
],
c_m_n_host_result
);
c_m_n_host_result
.
mData
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_groupnorm_impl.hpp
View file @
9b3365e1
...
@@ -165,8 +165,7 @@ bool profile_groupnorm_impl(int do_verification,
...
@@ -165,8 +165,7 @@ bool profile_groupnorm_impl(int do_verification,
{
{
y_dev
.
FromDevice
(
y
.
mData
.
data
());
y_dev
.
FromDevice
(
y
.
mData
.
data
());
bool
pass
=
bool
pass
=
ck
::
utils
::
check_err
(
y
,
host_y
,
"Error: Incorrect results"
,
1e-3
,
1e-3
);
ck
::
utils
::
check_err
(
y
.
mData
,
host_y
.
mData
,
"Error: Incorrect results"
,
1e-3
,
1e-3
);
if
(
do_log
)
if
(
do_log
)
{
{
...
...
profiler/include/profile_reduce_impl.hpp
View file @
9b3365e1
...
@@ -411,13 +411,12 @@ bool profile_reduce_impl_impl(bool do_verification,
...
@@ -411,13 +411,12 @@ bool profile_reduce_impl_impl(bool do_verification,
bool
single_pass
;
bool
single_pass
;
out_dev
.
FromDevice
(
out
.
mData
.
data
());
out_dev
.
FromDevice
(
out
.
mData
.
data
());
single_pass
=
ck
::
utils
::
check_err
(
out
.
mData
,
out_ref
.
mData
);
single_pass
=
ck
::
utils
::
check_err
(
out
,
out_ref
);
if
(
OutputIndex
)
if
(
OutputIndex
)
{
{
out_indices_dev
.
FromDevice
(
out_indices
.
mData
.
data
());
out_indices_dev
.
FromDevice
(
out_indices
.
mData
.
data
());
single_pass
=
single_pass
&&
single_pass
=
single_pass
&&
ck
::
utils
::
check_err
(
out_indices
,
out_indices_ref
);
ck
::
utils
::
check_err
(
out_indices
.
mData
,
out_indices_ref
.
mData
);
};
};
if
(
!
single_pass
)
if
(
!
single_pass
)
...
...
profiler/src/profile_conv_bwd_weight.cpp
→
profiler/src/profile_
grouped_
conv_bwd_weight.cpp
View file @
9b3365e1
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
#include <cstdlib>
#include <initializer_list>
#include <iostream>
#include <iostream>
#include <numeric>
#include <numeric>
#include <initializer_list>
#include <cstdlib>
#include "profiler/include/profile_conv_bwd_weight_impl.hpp"
#include "profiler/include/profile_
grouped_
conv_bwd_weight_impl.hpp"
namespace
{
namespace
{
enum
struct
ConvLayout
enum
struct
ConvLayout
{
{
NCHW_KCYX_NKHW
,
// 0
G
NCHW_
G
KCYX_
G
NKHW
,
// 0
NHWC_KYXC_NHWK
,
// 1
G
NHWC_
G
KYXC_
G
NHWK
,
// 1
};
};
enum
struct
ConvDataType
enum
struct
ConvDataType
...
@@ -25,24 +25,25 @@ enum struct ConvDataType
...
@@ -25,24 +25,25 @@ enum struct ConvDataType
static
void
print_helper_msg
()
static
void
print_helper_msg
()
{
{
std
::
cout
std
::
cout
<<
"arg1: tensor operation (conv_bwd_weight: Convolution Backward Weight
\n
"
<<
"arg1: tensor operation (conv_bwd_weight: Convolution Backward Weight
\n
"
<<
"arg2: data type (0: Input fp32, Weight fp32, Output fp32
\n
"
<<
"arg2: data type (0: Input fp32, Weight fp32, Output fp32
\n
"
<<
" 1: Input fp16, Weight fp16, Output fp16
\n
"
<<
" 1: Input fp16, Weight fp16, Output fp16
\n
"
<<
" 2: Input bf16, Weight fp32, Output bf16)
\n
"
<<
" 2: Input bf16, Weight fp32, Output bf16)
\n
"
<<
"arg3: tensor layout (0: Input[G, N, C, Hi, Wi], Weight[G, K, C, Y, X], Output[G, "
<<
"arg3: tensor layout (0: Input[N, C, Hi, Wi], Weight[K, C, Y, X], Output[N, K, Ho, Wo]
\n
"
"N, K, Ho, Wo]
\n
"
<<
" 1: Input[N, Hi, Wi, C], Weight[K, Y, X, C], Output[N, Ho, Wo, K]
\n
"
<<
" 1: Input[G, N, Hi, Wi, C], Weight[G, K, Y, X, C], Output[G, "
<<
"arg4: verification (0: no, 1: yes)
\n
"
"N, Ho, Wo, K]
\n
"
<<
"arg5: initialization (0: no init, 1: integer value, 2: decimal value)
\n
"
<<
"arg4: verification (0: no, 1: yes)
\n
"
<<
"arg6: print tensor value (0: no; 1: yes)
\n
"
<<
"arg5: initialization (0: no init, 1: integer value, 2: decimal value)
\n
"
<<
"arg7: time kernel (0: no, 1: yes)
\n
"
<<
"arg6: print tensor value (0: no; 1: yes)
\n
"
<<
ck
::
utils
::
conv
::
get_conv_param_parser_helper_msg
()
<<
" SplitK
\n
"
<<
"arg7: time kernel (0: no, 1: yes)
\n
"
<<
std
::
endl
;
<<
ck
::
utils
::
conv
::
get_conv_param_parser_helper_msg
()
<<
" SplitK
\n
"
<<
std
::
endl
;
}
}
}
// namespace
}
// namespace
int
profile_conv_bwd_weight
(
int
argc
,
char
*
argv
[])
int
profile_
grouped_
conv_bwd_weight
(
int
argc
,
char
*
argv
[])
{
{
// 8 for control, 1 for num_dim_spatial
// 8 for control, 1 for num_dim_spatial
if
(
argc
<
9
)
if
(
argc
<
9
)
...
@@ -75,17 +76,17 @@ int profile_conv_bwd_weight(int argc, char* argv[])
...
@@ -75,17 +76,17 @@ int profile_conv_bwd_weight(int argc, char* argv[])
using
F16
=
ck
::
half_t
;
using
F16
=
ck
::
half_t
;
using
BF16
=
ck
::
bhalf_t
;
using
BF16
=
ck
::
bhalf_t
;
using
NWC
=
ck
::
tensor_layout
::
convolution
::
NWC
;
using
G
NWC
=
ck
::
tensor_layout
::
convolution
::
G
NWC
;
using
NHWC
=
ck
::
tensor_layout
::
convolution
::
NHWC
;
using
G
NHWC
=
ck
::
tensor_layout
::
convolution
::
G
NHWC
;
using
NDHWC
=
ck
::
tensor_layout
::
convolution
::
NDHWC
;
using
G
NDHWC
=
ck
::
tensor_layout
::
convolution
::
G
NDHWC
;
using
KXC
=
ck
::
tensor_layout
::
convolution
::
KXC
;
using
G
KXC
=
ck
::
tensor_layout
::
convolution
::
G
KXC
;
using
KYXC
=
ck
::
tensor_layout
::
convolution
::
KYXC
;
using
G
KYXC
=
ck
::
tensor_layout
::
convolution
::
G
KYXC
;
using
KZYXC
=
ck
::
tensor_layout
::
convolution
::
KZYXC
;
using
G
KZYXC
=
ck
::
tensor_layout
::
convolution
::
G
KZYXC
;
using
NWK
=
ck
::
tensor_layout
::
convolution
::
NWK
;
using
G
NWK
=
ck
::
tensor_layout
::
convolution
::
G
NWK
;
using
NHWK
=
ck
::
tensor_layout
::
convolution
::
NHWK
;
using
G
NHWK
=
ck
::
tensor_layout
::
convolution
::
G
NHWK
;
using
NDHWK
=
ck
::
tensor_layout
::
convolution
::
NDHWK
;
using
G
NDHWK
=
ck
::
tensor_layout
::
convolution
::
G
NDHWK
;
constexpr
auto
I1
=
ck
::
Number
<
1
>
{};
constexpr
auto
I1
=
ck
::
Number
<
1
>
{};
constexpr
auto
I2
=
ck
::
Number
<
2
>
{};
constexpr
auto
I2
=
ck
::
Number
<
2
>
{};
...
@@ -108,64 +109,64 @@ int profile_conv_bwd_weight(int argc, char* argv[])
...
@@ -108,64 +109,64 @@ int profile_conv_bwd_weight(int argc, char* argv[])
using
WeiDataType
=
decltype
(
wei_type
);
using
WeiDataType
=
decltype
(
wei_type
);
using
OutDataType
=
decltype
(
out_type
);
using
OutDataType
=
decltype
(
out_type
);
bool
pass
=
ck
::
profiler
::
profile_conv_bwd_weight_impl
<
NDimSpatial
,
bool
pass
=
ck
::
profiler
::
profile_
grouped_
conv_bwd_weight_impl
<
NDimSpatial
,
InLayout
,
InLayout
,
WeiLayout
,
WeiLayout
,
OutLayout
,
OutLayout
,
InDataType
,
InDataType
,
WeiDataType
,
WeiDataType
,
OutDataType
>
(
OutDataType
>
(
do_verification
,
init_method
,
do_log
,
time_kernel
,
params
,
split_k
);
do_verification
,
init_method
,
do_log
,
time_kernel
,
params
,
split_k
);
return
pass
?
0
:
1
;
return
pass
?
0
:
1
;
};
};
if
(
num_dim_spatial
==
1
&&
layout
==
ConvLayout
::
NHWC_KYXC_NHWK
)
if
(
num_dim_spatial
==
1
&&
layout
==
ConvLayout
::
G
NHWC_
G
KYXC_
G
NHWK
)
{
{
if
(
data_type
==
ConvDataType
::
F32_F32_F32
)
if
(
data_type
==
ConvDataType
::
F32_F32_F32
)
{
{
return
profile
(
I1
,
NWC
{},
KXC
{},
NWK
{},
F32
{},
F32
{},
F32
{});
return
profile
(
I1
,
G
NWC
{},
G
KXC
{},
G
NWK
{},
F32
{},
F32
{},
F32
{});
}
}
else
if
(
data_type
==
ConvDataType
::
F16_F16_F16
)
else
if
(
data_type
==
ConvDataType
::
F16_F16_F16
)
{
{
return
profile
(
I1
,
NWC
{},
KXC
{},
NWK
{},
F16
{},
F16
{},
F16
{});
return
profile
(
I1
,
G
NWC
{},
G
KXC
{},
G
NWK
{},
F16
{},
F16
{},
F16
{});
}
}
else
if
(
data_type
==
ConvDataType
::
BF16_F32_BF16
)
else
if
(
data_type
==
ConvDataType
::
BF16_F32_BF16
)
{
{
// fp32 atomic add is used for weight tensor in bf16 kernel
// fp32 atomic add is used for weight tensor in bf16 kernel
return
profile
(
I1
,
NWC
{},
KXC
{},
NWK
{},
BF16
{},
F32
{},
BF16
{});
return
profile
(
I1
,
G
NWC
{},
G
KXC
{},
G
NWK
{},
BF16
{},
F32
{},
BF16
{});
}
}
}
}
else
if
(
num_dim_spatial
==
2
&&
layout
==
ConvLayout
::
NHWC_KYXC_NHWK
)
else
if
(
num_dim_spatial
==
2
&&
layout
==
ConvLayout
::
G
NHWC_
G
KYXC_
G
NHWK
)
{
{
if
(
data_type
==
ConvDataType
::
F32_F32_F32
)
if
(
data_type
==
ConvDataType
::
F32_F32_F32
)
{
{
return
profile
(
I2
,
NHWC
{},
KYXC
{},
NHWK
{},
F32
{},
F32
{},
F32
{});
return
profile
(
I2
,
G
NHWC
{},
G
KYXC
{},
G
NHWK
{},
F32
{},
F32
{},
F32
{});
}
}
else
if
(
data_type
==
ConvDataType
::
F16_F16_F16
)
else
if
(
data_type
==
ConvDataType
::
F16_F16_F16
)
{
{
return
profile
(
I2
,
NHWC
{},
KYXC
{},
NHWK
{},
F16
{},
F16
{},
F16
{});
return
profile
(
I2
,
G
NHWC
{},
G
KYXC
{},
G
NHWK
{},
F16
{},
F16
{},
F16
{});
}
}
else
if
(
data_type
==
ConvDataType
::
BF16_F32_BF16
)
else
if
(
data_type
==
ConvDataType
::
BF16_F32_BF16
)
{
{
// fp32 atomic add is used for weight tensor in bf16 kernel
// fp32 atomic add is used for weight tensor in bf16 kernel
return
profile
(
I2
,
NHWC
{},
KYXC
{},
NHWK
{},
BF16
{},
F32
{},
BF16
{});
return
profile
(
I2
,
G
NHWC
{},
G
KYXC
{},
G
NHWK
{},
BF16
{},
F32
{},
BF16
{});
}
}
}
}
else
if
(
num_dim_spatial
==
3
&&
layout
==
ConvLayout
::
NHWC_KYXC_NHWK
)
else
if
(
num_dim_spatial
==
3
&&
layout
==
ConvLayout
::
G
NHWC_
G
KYXC_
G
NHWK
)
{
{
if
(
data_type
==
ConvDataType
::
F32_F32_F32
)
if
(
data_type
==
ConvDataType
::
F32_F32_F32
)
{
{
return
profile
(
I3
,
NDHWC
{},
KZYXC
{},
NDHWK
{},
F32
{},
F32
{},
F32
{});
return
profile
(
I3
,
G
NDHWC
{},
G
KZYXC
{},
G
NDHWK
{},
F32
{},
F32
{},
F32
{});
}
}
else
if
(
data_type
==
ConvDataType
::
F16_F16_F16
)
else
if
(
data_type
==
ConvDataType
::
F16_F16_F16
)
{
{
return
profile
(
I3
,
NDHWC
{},
KZYXC
{},
NDHWK
{},
F16
{},
F16
{},
F16
{});
return
profile
(
I3
,
G
NDHWC
{},
G
KZYXC
{},
G
NDHWK
{},
F16
{},
F16
{},
F16
{});
}
}
else
if
(
data_type
==
ConvDataType
::
BF16_F32_BF16
)
else
if
(
data_type
==
ConvDataType
::
BF16_F32_BF16
)
{
{
// fp32 atomic add is used for weight tensor in bf16 kernel
// fp32 atomic add is used for weight tensor in bf16 kernel
return
profile
(
I3
,
NDHWC
{},
KZYXC
{},
NDHWK
{},
BF16
{},
F32
{},
BF16
{});
return
profile
(
I3
,
G
NDHWC
{},
G
KZYXC
{},
G
NDHWK
{},
BF16
{},
F32
{},
BF16
{});
}
}
}
}
...
...
profiler/src/profiler.cpp
View file @
9b3365e1
...
@@ -18,8 +18,8 @@ int profile_conv_fwd(int, char*[]);
...
@@ -18,8 +18,8 @@ int profile_conv_fwd(int, char*[]);
int
profile_conv_fwd_bias_relu
(
int
,
char
*
[]);
int
profile_conv_fwd_bias_relu
(
int
,
char
*
[]);
int
profile_conv_fwd_bias_relu_add
(
int
,
char
*
[]);
int
profile_conv_fwd_bias_relu_add
(
int
,
char
*
[]);
int
profile_conv_bwd_data
(
int
,
char
*
[]);
int
profile_conv_bwd_data
(
int
,
char
*
[]);
int
profile_conv_bwd_weight
(
int
,
char
*
[]);
int
profile_grouped_conv_fwd
(
int
,
char
*
[]);
int
profile_grouped_conv_fwd
(
int
,
char
*
[]);
int
profile_grouped_conv_bwd_weight
(
int
,
char
*
[]);
int
profile_softmax
(
int
,
char
*
[]);
int
profile_softmax
(
int
,
char
*
[]);
int
profile_layernorm
(
int
,
char
*
[]);
int
profile_layernorm
(
int
,
char
*
[]);
int
profile_groupnorm
(
int
,
char
*
[]);
int
profile_groupnorm
(
int
,
char
*
[]);
...
@@ -43,8 +43,8 @@ static void print_helper_message()
...
@@ -43,8 +43,8 @@ static void print_helper_message()
" conv_fwd_bias_relu: ForwardConvolution+Bias+ReLU
\n
"
" conv_fwd_bias_relu: ForwardConvolution+Bias+ReLU
\n
"
" conv_fwd_bias_relu_add: ForwardConvolution+Bias+ReLU+Add
\n
"
" conv_fwd_bias_relu_add: ForwardConvolution+Bias+ReLU+Add
\n
"
" conv_bwd_data: Convolution Backward Data
\n
"
" conv_bwd_data: Convolution Backward Data
\n
"
" conv_bwd_weight: Convolution Backward Weight
\n
"
" grouped_conv_fwd: Grouped Convolution Forward
\n
"
" grouped_conv_fwd: Grouped Convolution Forward
\n
"
" grouped_conv_bwd_weight: Grouped Convolution Backward Weight
\n
"
" softmax: Softmax
\n
"
" softmax: Softmax
\n
"
" reduce: Reduce
\n
"
);
" reduce: Reduce
\n
"
);
// clang-format on
// clang-format on
...
@@ -118,14 +118,14 @@ int main(int argc, char* argv[])
...
@@ -118,14 +118,14 @@ int main(int argc, char* argv[])
{
{
return
profile_conv_bwd_data
(
argc
,
argv
);
return
profile_conv_bwd_data
(
argc
,
argv
);
}
}
else
if
(
strcmp
(
argv
[
1
],
"conv_bwd_weight"
)
==
0
)
{
return
profile_conv_bwd_weight
(
argc
,
argv
);
}
else
if
(
strcmp
(
argv
[
1
],
"grouped_conv_fwd"
)
==
0
)
else
if
(
strcmp
(
argv
[
1
],
"grouped_conv_fwd"
)
==
0
)
{
{
return
profile_grouped_conv_fwd
(
argc
,
argv
);
return
profile_grouped_conv_fwd
(
argc
,
argv
);
}
}
else
if
(
strcmp
(
argv
[
1
],
"conv_bwd_weight"
)
==
0
)
{
return
profile_grouped_conv_bwd_weight
(
argc
,
argv
);
}
else
if
(
strcmp
(
argv
[
1
],
"reduce"
)
==
0
)
else
if
(
strcmp
(
argv
[
1
],
"reduce"
)
==
0
)
{
{
return
profile_reduce
(
argc
,
argv
);
return
profile_reduce
(
argc
,
argv
);
...
...
Prev
1
…
5
6
7
8
9
10
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