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
ca313a29
"src/scanner.cpp" did not exist on "07d4cac48f3181aaf6bb9cf36269200f308e5e45"
Commit
ca313a29
authored
Dec 02, 2022
by
letaoqin
Browse files
Merge branch 'develop' into dl_conv_multiple_d
parents
d47bf127
8784a72e
Changes
128
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
195 additions
and
23 deletions
+195
-23
profiler/src/profiler_operation_registry.hpp
profiler/src/profiler_operation_registry.hpp
+79
-0
test/CMakeLists.txt
test/CMakeLists.txt
+2
-1
test/batched_gemm/batched_gemm_bf16.cpp
test/batched_gemm/batched_gemm_bf16.cpp
+1
-1
test/batched_gemm/batched_gemm_fp16.cpp
test/batched_gemm/batched_gemm_fp16.cpp
+1
-1
test/batched_gemm/batched_gemm_fp32.cpp
test/batched_gemm/batched_gemm_fp32.cpp
+1
-1
test/batched_gemm/batched_gemm_int8.cpp
test/batched_gemm/batched_gemm_int8.cpp
+1
-1
test/batched_gemm_gemm/test_batched_gemm_gemm_util.hpp
test/batched_gemm_gemm/test_batched_gemm_gemm_util.hpp
+1
-1
test/batched_gemm_reduce/batched_gemm_reduce_fp16.cpp
test/batched_gemm_reduce/batched_gemm_reduce_fp16.cpp
+1
-1
test/batched_gemm_softmax_gemm/test_batched_gemm_softmax_gemm_util.hpp
...gemm_softmax_gemm/test_batched_gemm_softmax_gemm_util.hpp
+1
-1
test/batched_gemm_softmax_gemm_permute/test_batched_gemm_softmax_gemm_permute_util.hpp
...m_permute/test_batched_gemm_softmax_gemm_permute_util.hpp
+1
-1
test/batchnorm/CMakeLists.txt
test/batchnorm/CMakeLists.txt
+2
-0
test/batchnorm/batchnorm_bwd_rank_4.cpp
test/batchnorm/batchnorm_bwd_rank_4.cpp
+92
-0
test/batchnorm/batchnorm_fwd_rank_4.cpp
test/batchnorm/batchnorm_fwd_rank_4.cpp
+1
-1
test/convnd_bwd_data/convnd_bwd_data.cpp
test/convnd_bwd_data/convnd_bwd_data.cpp
+1
-1
test/convnd_fwd/convnd_fwd.cpp
test/convnd_fwd/convnd_fwd.cpp
+1
-1
test/elementwise_normalization/test_elementwise_layernorm_fp16.cpp
...entwise_normalization/test_elementwise_layernorm_fp16.cpp
+1
-1
test/gemm_reduce/gemm_reduce_fp16.cpp
test/gemm_reduce/gemm_reduce_fp16.cpp
+1
-1
test/gemm_split_k/gemm_split_k.cpp
test/gemm_split_k/gemm_split_k.cpp
+5
-7
test/grouped_convnd_bwd_weight/grouped_convnd_bwd_weight.cpp
test/grouped_convnd_bwd_weight/grouped_convnd_bwd_weight.cpp
+1
-1
test/grouped_convnd_fwd/grouped_convnd_fwd.cpp
test/grouped_convnd_fwd/grouped_convnd_fwd.cpp
+1
-1
No files found.
profiler/src/profiler_operation_registry.hpp
0 → 100644
View file @
ca313a29
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <optional>
#include <string_view>
#include <utility>
class
ProfilerOperationRegistry
final
{
ProfilerOperationRegistry
()
=
default
;
~
ProfilerOperationRegistry
()
=
default
;
public:
using
Operation
=
std
::
function
<
int
(
int
,
char
*
[])
>
;
private:
struct
Entry
final
{
explicit
Entry
(
std
::
string_view
description
,
Operation
operation
)
noexcept
:
description_
(
description
),
operation_
(
std
::
move
(
operation
))
{
}
std
::
string_view
description_
;
Operation
operation_
;
};
std
::
map
<
std
::
string_view
,
Entry
>
entries_
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
stream
,
const
ProfilerOperationRegistry
&
registry
)
{
stream
<<
"{
\n
"
;
for
(
auto
&
[
name
,
entry
]
:
registry
.
entries_
)
{
stream
<<
"
\t
"
<<
name
<<
": "
<<
entry
.
description_
<<
"
\n
"
;
}
stream
<<
"}"
;
return
stream
;
}
public:
static
ProfilerOperationRegistry
&
GetInstance
()
{
static
ProfilerOperationRegistry
registry
;
return
registry
;
}
std
::
optional
<
Operation
>
Get
(
std
::
string_view
name
)
const
{
const
auto
found
=
entries_
.
find
(
name
);
if
(
found
==
end
(
entries_
))
{
return
std
::
nullopt
;
}
return
(
found
->
second
).
operation_
;
}
bool
Add
(
std
::
string_view
name
,
std
::
string_view
description
,
Operation
operation
)
{
return
entries_
.
emplace
(
std
::
piecewise_construct
,
std
::
forward_as_tuple
(
name
),
std
::
forward_as_tuple
(
description
,
std
::
move
(
operation
)))
.
second
;
}
};
#define PP_CONCAT(x, y) PP_CONCAT_IMPL(x, y)
#define PP_CONCAT_IMPL(x, y) x##y
#define REGISTER_PROFILER_OPERATION(name, description, operation) \
static const bool PP_CONCAT(operation_registration_result_, __COUNTER__) = \
::ProfilerOperationRegistry::GetInstance().Add(name, description, operation)
test/CMakeLists.txt
View file @
ca313a29
include_directories
(
BEFORE
include_directories
(
BEFORE
${
PROJECT_SOURCE_DIR
}
/
${
PROJECT_SOURCE_DIR
}
/
${
PROJECT_SOURCE_DIR
}
/profiler/include
)
)
include
(
googletest
)
include
(
googletest
)
...
@@ -53,4 +54,4 @@ add_subdirectory(softmax)
...
@@ -53,4 +54,4 @@ add_subdirectory(softmax)
add_subdirectory
(
normalization
)
add_subdirectory
(
normalization
)
add_subdirectory
(
data_type
)
add_subdirectory
(
data_type
)
add_subdirectory
(
elementwise_normalization
)
add_subdirectory
(
elementwise_normalization
)
add_subdirectory
(
batchnorm
_fwd
)
add_subdirectory
(
batchnorm
)
test/batched_gemm/batched_gemm_bf16.cpp
View file @
ca313a29
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <iostream>
#include "profiler/
include/
profile_batched_gemm_impl.hpp"
#include "profiler/profile_batched_gemm_impl.hpp"
namespace
{
namespace
{
using
ADataType
=
ck
::
bhalf_t
;
using
ADataType
=
ck
::
bhalf_t
;
...
...
test/batched_gemm/batched_gemm_fp16.cpp
View file @
ca313a29
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <iostream>
#include "profiler/
include/
profile_batched_gemm_impl.hpp"
#include "profiler/profile_batched_gemm_impl.hpp"
namespace
{
namespace
{
using
ADataType
=
ck
::
half_t
;
using
ADataType
=
ck
::
half_t
;
...
...
test/batched_gemm/batched_gemm_fp32.cpp
View file @
ca313a29
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <iostream>
#include "profiler/
include/
profile_batched_gemm_impl.hpp"
#include "profiler/profile_batched_gemm_impl.hpp"
namespace
{
namespace
{
using
ADataType
=
float
;
using
ADataType
=
float
;
...
...
test/batched_gemm/batched_gemm_int8.cpp
View file @
ca313a29
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <iostream>
#include "profiler/
include/
profile_batched_gemm_impl.hpp"
#include "profiler/profile_batched_gemm_impl.hpp"
namespace
{
namespace
{
using
ADataType
=
int8_t
;
using
ADataType
=
int8_t
;
...
...
test/batched_gemm_gemm/test_batched_gemm_gemm_util.hpp
View file @
ca313a29
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include <vector>
#include <vector>
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_gemm_xdl_cshuffle.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_gemm_xdl_cshuffle.hpp"
#include "profiler/
include/
profile_batched_gemm_gemm_impl.hpp"
#include "profiler/profile_batched_gemm_gemm_impl.hpp"
using
ck
::
tensor_operation
::
device
::
GemmSpecialization
;
using
ck
::
tensor_operation
::
device
::
GemmSpecialization
;
...
...
test/batched_gemm_reduce/batched_gemm_reduce_fp16.cpp
View file @
ca313a29
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <iostream>
#include "profiler/
include/
profile_batched_gemm_reduce_impl.hpp"
#include "profiler/profile_batched_gemm_reduce_impl.hpp"
int
main
()
int
main
()
{
{
...
...
test/batched_gemm_softmax_gemm/test_batched_gemm_softmax_gemm_util.hpp
View file @
ca313a29
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include <vector>
#include <vector>
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_softmax_gemm_xdl_cshuffle.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_softmax_gemm_xdl_cshuffle.hpp"
#include "profiler/
include/
profile_batched_gemm_softmax_gemm_impl.hpp"
#include "profiler/profile_batched_gemm_softmax_gemm_impl.hpp"
using
ck
::
tensor_operation
::
device
::
GemmSpecialization
;
using
ck
::
tensor_operation
::
device
::
GemmSpecialization
;
template
<
ck
::
index_t
N
>
template
<
ck
::
index_t
N
>
...
...
test/batched_gemm_softmax_gemm_permute/test_batched_gemm_softmax_gemm_permute_util.hpp
View file @
ca313a29
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include "ck/ck.hpp"
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_softmax_gemm_permute_xdl_cshuffle.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_batched_gemm_softmax_gemm_permute_xdl_cshuffle.hpp"
#include "profiler/
include/
profile_batched_gemm_softmax_gemm_permute_impl.hpp"
#include "profiler/profile_batched_gemm_softmax_gemm_permute_impl.hpp"
using
ck
::
tensor_operation
::
device
::
GemmSpecialization
;
using
ck
::
tensor_operation
::
device
::
GemmSpecialization
;
using
ck
::
tensor_operation
::
device
::
MaskingSpecialization
;
using
ck
::
tensor_operation
::
device
::
MaskingSpecialization
;
...
...
test/batchnorm
_fwd
/CMakeLists.txt
→
test/batchnorm/CMakeLists.txt
View file @
ca313a29
add_gtest_executable
(
test_batchnorm_fwd_rank_4 batchnorm_fwd_rank_4.cpp
)
add_gtest_executable
(
test_batchnorm_fwd_rank_4 batchnorm_fwd_rank_4.cpp
)
add_gtest_executable
(
test_batchnorm_bwd_rank_4 batchnorm_bwd_rank_4.cpp
)
target_link_libraries
(
test_batchnorm_fwd_rank_4 PRIVATE utility device_batchnorm_instance
)
target_link_libraries
(
test_batchnorm_fwd_rank_4 PRIVATE utility device_batchnorm_instance
)
target_link_libraries
(
test_batchnorm_bwd_rank_4 PRIVATE utility device_batchnorm_instance
)
test/batchnorm/batchnorm_bwd_rank_4.cpp
0 → 100644
View file @
ca313a29
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
#include <cstdlib>
#include <iostream>
#include <initializer_list>
#include <vector>
#include <tuple>
#include <gtest/gtest.h>
#include "profiler/profile_batchnorm_backward_impl.hpp"
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
using
BF16
=
ck
::
bhalf_t
;
using
F64
=
double
;
template
<
typename
Tuple
>
class
TestBatchNormBwdRank4
:
public
::
testing
::
Test
{
private:
const
double
epsilon
=
std
::
numeric_limits
<
float
>::
epsilon
();
protected:
using
XDataType
=
std
::
tuple_element_t
<
0
,
Tuple
>
;
using
DxDataType
=
std
::
tuple_element_t
<
1
,
Tuple
>
;
using
DyDataType
=
std
::
tuple_element_t
<
2
,
Tuple
>
;
using
AccDataType
=
std
::
tuple_element_t
<
3
,
Tuple
>
;
using
ScaleDataType
=
std
::
tuple_element_t
<
4
,
Tuple
>
;
using
BiasDataType
=
std
::
tuple_element_t
<
5
,
Tuple
>
;
using
MeanVarDataType
=
std
::
tuple_element_t
<
6
,
Tuple
>
;
std
::
vector
<
std
::
vector
<
size_t
>>
list_of_lengths
=
{
{
128
,
16
,
3
,
1024
},
{
128
,
16
,
6
,
512
},
{
1
,
1
,
1
,
1
},
{
4
,
4
,
4
,
4
},
{
32
,
32
,
32
,
32
}};
std
::
vector
<
int
>
reduceDims
;
template
<
int
NumReduceDim
>
void
Run
()
{
for
(
auto
&
inOutLengths
:
list_of_lengths
)
{
bool
pass
=
true
;
EXPECT_FALSE
(
reduceDims
.
size
()
!=
NumReduceDim
);
pass
=
pass
&&
ck
::
profiler
::
profile_batchnorm_backward_impl
<
XDataType
,
DxDataType
,
DyDataType
,
AccDataType
,
ScaleDataType
,
BiasDataType
,
MeanVarDataType
,
4
,
NumReduceDim
>
(
true
,
3
,
false
,
false
,
inOutLengths
,
reduceDims
,
true
,
epsilon
);
pass
=
pass
&&
ck
::
profiler
::
profile_batchnorm_backward_impl
<
XDataType
,
DxDataType
,
DyDataType
,
AccDataType
,
ScaleDataType
,
BiasDataType
,
MeanVarDataType
,
4
,
NumReduceDim
>
(
true
,
3
,
false
,
false
,
inOutLengths
,
reduceDims
,
false
,
epsilon
);
EXPECT_TRUE
(
pass
);
}
}
};
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F32
,
F32
,
F32
,
F16
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
BF16
,
F32
,
F32
,
F32
,
BF16
,
F32
,
F32
>
,
std
::
tuple
<
F64
,
F64
,
F64
,
F64
,
F64
,
F64
,
F64
>>
;
TYPED_TEST_SUITE
(
TestBatchNormBwdRank4
,
KernelTypes
);
// nhwc
TYPED_TEST
(
TestBatchNormBwdRank4
,
nhwc
)
{
this
->
reduceDims
=
{
0
,
1
,
2
};
this
->
template
Run
<
3
>();
}
// nchw
TYPED_TEST
(
TestBatchNormBwdRank4
,
nchw
)
{
this
->
reduceDims
=
{
0
,
2
,
3
};
this
->
template
Run
<
3
>();
}
test/batchnorm
_fwd
/batchnorm_fwd_rank_4.cpp
→
test/batchnorm/batchnorm_fwd_rank_4.cpp
View file @
ca313a29
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include <tuple>
#include <tuple>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "profiler/
include/
profile_batchnorm_forward_impl.hpp"
#include "profiler/profile_batchnorm_forward_impl.hpp"
using
F16
=
ck
::
half_t
;
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
using
F32
=
float
;
...
...
test/convnd_bwd_data/convnd_bwd_data.cpp
View file @
ca313a29
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include <tuple>
#include <tuple>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "profiler/
include/
profile_conv_bwd_data_impl.hpp"
#include "profiler/profile_conv_bwd_data_impl.hpp"
template
<
typename
Tuple
>
template
<
typename
Tuple
>
class
TestConvndBwdData
:
public
::
testing
::
Test
class
TestConvndBwdData
:
public
::
testing
::
Test
...
...
test/convnd_fwd/convnd_fwd.cpp
View file @
ca313a29
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include <tuple>
#include <tuple>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "profiler/
include/
profile_conv_fwd_impl.hpp"
#include "profiler/profile_conv_fwd_impl.hpp"
template
<
typename
Tuple
>
template
<
typename
Tuple
>
class
TestConvndFwd
:
public
::
testing
::
Test
class
TestConvndFwd
:
public
::
testing
::
Test
...
...
test/elementwise_normalization/test_elementwise_layernorm_fp16.cpp
View file @
ca313a29
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#include "profiler/
include/
profile_elementwise_layernorm_impl.hpp"
#include "profiler/profile_elementwise_layernorm_impl.hpp"
using
F16
=
ck
::
half_t
;
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
using
F32
=
float
;
...
...
test/gemm_reduce/gemm_reduce_fp16.cpp
View file @
ca313a29
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <iostream>
#include <iostream>
#include "profiler/
include/
profile_gemm_reduce_impl.hpp"
#include "profiler/profile_gemm_reduce_impl.hpp"
int
main
()
int
main
()
{
{
...
...
test/gemm_split_k/gemm_split_k.cpp
View file @
ca313a29
...
@@ -226,9 +226,8 @@ int main(int argc, char* argv[])
...
@@ -226,9 +226,8 @@ int main(int argc, char* argv[])
std
::
vector
<
gemmArgs
>
test_cases
;
std
::
vector
<
gemmArgs
>
test_cases
;
if
(
argc
==
1
)
if
(
argc
==
1
)
{
{
test_cases
=
{{
GemmMatrixLayout
::
MK_KN_MN
,
3
,
3
,
3
,
3
,
3
,
3
,
1
}};
test_cases
=
{{
GemmMatrixLayout
::
MK_KN_MN
,
1024
,
1024
,
1024
,
1024
,
1024
,
1024
,
2
},
// JD: Populate with more and meaningful
{
GemmMatrixLayout
::
MK_KN_MN
,
1024
,
1024
,
1024
,
1024
,
1024
,
1024
,
8
}};
return
0
;
}
}
else
if
(
argc
==
9
)
else
if
(
argc
==
9
)
{
{
...
@@ -253,11 +252,10 @@ int main(int argc, char* argv[])
...
@@ -253,11 +252,10 @@ int main(int argc, char* argv[])
printf
(
"arg2 to 7: M, N, K, StrideA, StrideB, StrideC KBatch
\n
"
);
printf
(
"arg2 to 7: M, N, K, StrideA, StrideB, StrideC KBatch
\n
"
);
return
-
1
;
return
-
1
;
}
}
bool
error
=
false
;
for
(
const
auto
&
kinder
:
test_cases
)
for
(
const
auto
&
kinder
:
test_cases
)
{
{
const
auto
res
=
test_gemm
(
kinder
);
error
|=
test_gemm
(
kinder
);
if
(
!
res
)
return
-
1
;
}
}
return
0
;
return
error
?
1
:
0
;
}
}
test/grouped_convnd_bwd_weight/grouped_convnd_bwd_weight.cpp
View file @
ca313a29
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "profiler/
include/
profile_grouped_conv_bwd_weight_impl.hpp"
#include "profiler/profile_grouped_conv_bwd_weight_impl.hpp"
template
<
typename
Tuple
>
template
<
typename
Tuple
>
class
TestGroupedConvndBwdWeight
:
public
::
testing
::
Test
class
TestGroupedConvndBwdWeight
:
public
::
testing
::
Test
...
...
test/grouped_convnd_fwd/grouped_convnd_fwd.cpp
View file @
ca313a29
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include <vector>
#include <vector>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "profiler/
include/
profile_grouped_conv_fwd_impl.hpp"
#include "profiler/profile_grouped_conv_fwd_impl.hpp"
class
TestGroupedConvNdFwd
:
public
::
testing
::
Test
class
TestGroupedConvNdFwd
:
public
::
testing
::
Test
{
{
...
...
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