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
5a7f7334
Commit
5a7f7334
authored
Aug 31, 2023
by
Jing Zhang
Browse files
merge develop
parents
14822d71
f5ec04f0
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
174 additions
and
3 deletions
+174
-3
test/pool/CMakeLists.txt
test/pool/CMakeLists.txt
+16
-0
test/pool/test_avg_pool3d_bwd.cpp
test/pool/test_avg_pool3d_bwd.cpp
+74
-0
test/pool/test_avg_pool3d_fwd.cpp
test/pool/test_avg_pool3d_fwd.cpp
+0
-0
test/pool/test_max_pool3d_bwd.cpp
test/pool/test_max_pool3d_bwd.cpp
+79
-0
test/pool/test_max_pool3d_fwd.cpp
test/pool/test_max_pool3d_fwd.cpp
+0
-0
test/pool/test_pool_fwd_common.hpp
test/pool/test_pool_fwd_common.hpp
+5
-3
No files found.
test/pool
_fwd
/CMakeLists.txt
→
test/pool/CMakeLists.txt
View file @
5a7f7334
add_custom_target
(
test_pool
_fwd
)
add_custom_target
(
test_pool
)
add_gtest_executable
(
test_avg_pool3d_bwd test_avg_pool3d_bwd.cpp
)
add_gtest_executable
(
test_max_pool3d_bwd test_max_pool3d_bwd.cpp
)
add_gtest_executable
(
test_avg_pool3d_fwd test_avg_pool3d_fwd.cpp
)
add_gtest_executable
(
test_max_pool3d_fwd test_max_pool3d_fwd.cpp
)
target_link_libraries
(
test_avg_pool3d_bwd PRIVATE utility device_avg_pool3d_bwd_instance
)
target_link_libraries
(
test_max_pool3d_bwd PRIVATE utility device_max_pool_bwd_instance
)
target_link_libraries
(
test_avg_pool3d_fwd PRIVATE utility device_pool3d_fwd_instance
)
target_link_libraries
(
test_max_pool3d_fwd PRIVATE utility device_pool3d_fwd_instance
)
add_dependencies
(
test_pool_fwd test_avg_pool3d_fwd
)
add_dependencies
(
test_pool_fwd test_max_pool3d_fwd
)
add_dependencies
(
test_pool test_avg_pool3d_bwd
)
add_dependencies
(
test_pool test_max_pool3d_bwd
)
add_dependencies
(
test_pool test_avg_pool3d_fwd
)
add_dependencies
(
test_pool test_max_pool3d_fwd
)
test/pool/test_avg_pool3d_bwd.cpp
0 → 100644
View file @
5a7f7334
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "gtest/gtest.h"
#include "profiler/profile_avg_pool3d_bwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
template
<
typename
Tuple
>
class
TestAvgPool3dBwd
:
public
::
testing
::
Test
{
protected:
using
DOutDataType
=
std
::
tuple_element_t
<
0
,
Tuple
>
;
using
DInDataType
=
std
::
tuple_element_t
<
1
,
Tuple
>
;
using
ComputeDataType
=
std
::
tuple_element_t
<
2
,
Tuple
>
;
using
DOutLayout
=
std
::
tuple_element_t
<
3
,
Tuple
>
;
using
DInLayout
=
std
::
tuple_element_t
<
4
,
Tuple
>
;
std
::
vector
<
PoolingParam
>
params
;
void
Run
()
{
for
(
auto
param
:
params
)
{
bool
success
=
ck
::
profiler
::
profile_avg_pool3d_bwd_impl
<
DOutDataType
,
DInDataType
,
ComputeDataType
,
DOutLayout
,
DInLayout
>
(
true
,
2
,
false
,
false
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
window_dilations_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
}
}
};
#if defined(CK_ENABLE_FP16) && defined(CK_ENABLE_BF16) && defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
BF16
,
BF16
,
F32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP16) && defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_BF16) && defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
BF16
,
BF16
,
F32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP16) && defined(CK_ENABLE_BF16)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
BF16
,
BF16
,
F32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP16)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_BF16)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
BF16
,
BF16
,
F32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F32
,
F32
,
F32
,
NDHWC
,
NDHWC
>>
;
#endif
TYPED_TEST_SUITE
(
TestAvgPool3dBwd
,
KernelTypes
);
TYPED_TEST
(
TestAvgPool3dBwd
,
Test_Pool
)
{
// length, window_length, window_stride, window_dilation, left_pad, right_pad
this
->
params
=
{{{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
16
,
64
,
64
,
64
},
{
4
,
4
,
4
},
{
4
,
4
,
4
},
{
2
,
2
,
2
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
32
,
30
,
30
,
30
},
{
2
,
2
,
2
},
{
2
,
2
,
2
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
}}};
this
->
Run
();
}
test/pool
_fwd
/test_avg_pool3d_fwd.cpp
→
test/pool/test_avg_pool3d_fwd.cpp
View file @
5a7f7334
File moved
test/pool/test_max_pool3d_bwd.cpp
0 → 100644
View file @
5a7f7334
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "gtest/gtest.h"
#include "profiler/profile_max_pool3d_bwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
template
<
typename
Tuple
>
class
TestMaxPool3dBwd
:
public
::
testing
::
Test
{
protected:
using
DOutDataType
=
std
::
tuple_element_t
<
0
,
Tuple
>
;
using
DInDataType
=
std
::
tuple_element_t
<
1
,
Tuple
>
;
using
IndexDataType
=
std
::
tuple_element_t
<
2
,
Tuple
>
;
using
InDataType
=
DInDataType
;
using
OutDataType
=
DOutDataType
;
std
::
vector
<
PoolingParam
>
params
;
void
Run
()
{
for
(
auto
param
:
params
)
{
bool
success
=
ck
::
profiler
::
profile_max_pool3d_bwd_impl
<
InDataType
,
OutDataType
,
IndexDataType
,
DOutDataType
,
DInDataType
,
false
>
(
true
,
2
,
false
,
false
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
window_dilations_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
}
}
};
#if defined(CK_ENABLE_FP16) && defined(CK_ENABLE_BF16) && defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
I32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
BF16
,
BF16
,
I32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
F32
,
F32
,
I32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP16) && defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
I32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
F32
,
F32
,
I32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_BF16) && defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
BF16
,
BF16
,
I32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
F32
,
F32
,
I32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP16) && defined(CK_ENABLE_BF16)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
I32
,
NDHWC
,
NDHWC
>
,
std
::
tuple
<
BF16
,
BF16
,
I32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP16)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
I32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_BF16)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
BF16
,
BF16
,
I32
,
NDHWC
,
NDHWC
>>
;
#elif defined(CK_ENABLE_FP32)
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F32
,
F32
,
I32
,
NDHWC
,
NDHWC
>>
;
#endif
TYPED_TEST_SUITE
(
TestMaxPool3dBwd
,
KernelTypes
);
TYPED_TEST
(
TestMaxPool3dBwd
,
Test_Pool
)
{
// length, window_length, window_stride, window_dilation, left_pad, right_pad
this
->
params
=
{{{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
16
,
64
,
64
,
64
},
{
4
,
4
,
4
},
{
4
,
4
,
4
},
{
2
,
2
,
2
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
32
,
30
,
30
,
30
},
{
2
,
2
,
2
},
{
2
,
2
,
2
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
}}};
// this->params = {{{2, 32, 30, 30, 30}, {2, 2, 2}, {2, 2, 2}, {1, 1, 1}, {1, 1, 1}, {1, 1,
// 1}}};
this
->
Run
();
}
test/pool
_fwd
/test_max_pool3d_fwd.cpp
→
test/pool/test_max_pool3d_fwd.cpp
View file @
5a7f7334
File moved
test/pool
_fwd
/test_pool_fwd_common.hpp
→
test/pool/test_pool_fwd_common.hpp
View file @
5a7f7334
...
...
@@ -4,10 +4,12 @@
#include "gtest/gtest.h"
#include "ck/ck.hpp"
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
using
I32
=
int32_t
;
using
F16
=
ck
::
half_t
;
using
BF16
=
ck
::
bhalf_t
;
using
F32
=
float
;
using
I32
=
int32_t
;
using
ck
::
index_t
;
using
NDHWC
=
ck
::
tensor_layout
::
convolution
::
NDHWC
;
struct
PoolingParam
{
...
...
Prev
1
2
3
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