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
48fe8532
Commit
48fe8532
authored
Aug 18, 2023
by
Jun Liu
Browse files
Merge branch 'amd-develop' into amd-master
parents
d88411d1
39002e9e
Changes
125
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
145 deletions
+22
-145
test/pool_fwd/test_avg_pool2d_fwd.cpp
test/pool_fwd/test_avg_pool2d_fwd.cpp
+0
-60
test/pool_fwd/test_avg_pool3d_fwd.cpp
test/pool_fwd/test_avg_pool3d_fwd.cpp
+8
-4
test/pool_fwd/test_max_pool2d_fwd.cpp
test/pool_fwd/test_max_pool2d_fwd.cpp
+0
-77
test/pool_fwd/test_max_pool3d_fwd.cpp
test/pool_fwd/test_max_pool3d_fwd.cpp
+11
-4
test/pool_fwd/test_pool_fwd_common.hpp
test/pool_fwd/test_pool_fwd_common.hpp
+3
-0
No files found.
test/pool_fwd/test_avg_pool2d_fwd.cpp
deleted
100644 → 0
View file @
d88411d1
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "gtest/gtest.h"
#include "profiler/profile_pool2d_fwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
template
<
typename
Tuple
>
class
TestAvgPool2dFwd
:
public
::
testing
::
Test
{
protected:
using
InDataType
=
std
::
tuple_element_t
<
0
,
Tuple
>
;
using
OutDataType
=
std
::
tuple_element_t
<
1
,
Tuple
>
;
using
ComputeDataType
=
std
::
tuple_element_t
<
2
,
Tuple
>
;
using
IndexDataType
=
std
::
tuple_element_t
<
3
,
Tuple
>
;
std
::
vector
<
PoolingParam
>
params
;
void
Run
()
{
for
(
auto
param
:
params
)
{
bool
success
=
ck
::
profiler
::
profile_pool2d_fwd_impl
<
InDataType
,
OutDataType
,
ComputeDataType
,
IndexDataType
,
ck
::
ReduceTensorOp
::
AVG
,
false
,
false
>
(
true
,
2
,
false
,
false
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
}
}
};
#ifdef __fp16__
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F32
,
I32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
I32
>>
;
#else
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F32
,
F32
,
F32
,
I32
>>
;
#endif
TYPED_TEST_SUITE
(
TestAvgPool2dFwd
,
KernelTypes
);
TYPED_TEST
(
TestAvgPool2dFwd
,
Test_Pool
)
{
// length, window_length, window_stride, left_pad, right_pad
this
->
params
=
{{{
1
,
1
,
1
,
1
},
{
1
,
1
},
{
1
,
1
},
{
0
,
0
},
{
0
,
0
}},
{{
2
,
16
,
64
,
64
},
{
64
,
64
},
{
1
,
1
},
{
0
,
0
},
{
0
,
0
}},
{{
2
,
32
,
30
,
30
},
{
2
,
2
},
{
2
,
2
},
{
1
,
1
},
{
1
,
1
}}};
this
->
Run
();
}
test/pool_fwd/test_avg_pool3d_fwd.cpp
View file @
48fe8532
...
@@ -25,6 +25,8 @@ class TestAvgPool3dFwd : public ::testing::Test
...
@@ -25,6 +25,8 @@ class TestAvgPool3dFwd : public ::testing::Test
OutDataType
,
OutDataType
,
ComputeDataType
,
ComputeDataType
,
IndexDataType
,
IndexDataType
,
ck
::
tensor_layout
::
convolution
::
NDHWC
,
ck
::
tensor_layout
::
convolution
::
NDHWC
,
ck
::
ReduceTensorOp
::
AVG
,
ck
::
ReduceTensorOp
::
AVG
,
false
,
false
,
false
>
(
true
,
false
>
(
true
,
...
@@ -34,6 +36,7 @@ class TestAvgPool3dFwd : public ::testing::Test
...
@@ -34,6 +36,7 @@ class TestAvgPool3dFwd : public ::testing::Test
param
.
length_
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
window_strides_
,
param
.
window_dilations_
,
param
.
input_left_pads_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
EXPECT_TRUE
(
success
);
...
@@ -49,10 +52,11 @@ using KernelTypes = ::testing::Types<std::tuple<F32, F32, F32, I32>>;
...
@@ -49,10 +52,11 @@ using KernelTypes = ::testing::Types<std::tuple<F32, F32, F32, I32>>;
TYPED_TEST_SUITE
(
TestAvgPool3dFwd
,
KernelTypes
);
TYPED_TEST_SUITE
(
TestAvgPool3dFwd
,
KernelTypes
);
TYPED_TEST
(
TestAvgPool3dFwd
,
Test_Pool
)
TYPED_TEST
(
TestAvgPool3dFwd
,
Test_Pool
)
{
{
// length, window_length, window_stride, left_pad, right_pad
// length, window_length, window_stride, window_dilation, left_pad, right_pad
this
->
params
=
{{{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
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
},
{
64
,
64
,
64
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
16
,
64
,
64
,
64
},
{
64
,
64
,
64
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
32
,
30
,
30
,
30
},
{
2
,
2
,
2
},
{
2
,
2
,
2
},
{
1
,
1
,
1
},
{
1
,
1
,
1
}}};
{{
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
();
this
->
Run
();
}
}
test/pool_fwd/test_max_pool2d_fwd.cpp
deleted
100644 → 0
View file @
d88411d1
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
#include "gtest/gtest.h"
#include "profiler/profile_pool2d_fwd_impl.hpp"
#include "test_pool_fwd_common.hpp"
template
<
typename
Tuple
>
class
TestMaxPool2dFwd
:
public
::
testing
::
Test
{
protected:
using
InDataType
=
std
::
tuple_element_t
<
0
,
Tuple
>
;
using
OutDataType
=
std
::
tuple_element_t
<
1
,
Tuple
>
;
using
ComputeDataType
=
std
::
tuple_element_t
<
2
,
Tuple
>
;
using
IndexDataType
=
std
::
tuple_element_t
<
3
,
Tuple
>
;
std
::
vector
<
PoolingParam
>
params
;
void
Run
()
{
for
(
auto
param
:
params
)
{
// max pool
bool
success
=
ck
::
profiler
::
profile_pool2d_fwd_impl
<
InDataType
,
OutDataType
,
ComputeDataType
,
IndexDataType
,
ck
::
ReduceTensorOp
::
MAX
,
false
,
false
>
(
true
,
2
,
false
,
false
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
// max pool + index
success
=
ck
::
profiler
::
profile_pool2d_fwd_impl
<
InDataType
,
OutDataType
,
ComputeDataType
,
IndexDataType
,
ck
::
ReduceTensorOp
::
MAX
,
false
,
true
>
(
true
,
2
,
false
,
false
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
}
}
};
#ifdef __fp16__
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F16
,
I32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
I32
>>
;
#else
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F32
,
F32
,
F32
,
I32
>>
;
#endif
TYPED_TEST_SUITE
(
TestMaxPool2dFwd
,
KernelTypes
);
TYPED_TEST
(
TestMaxPool2dFwd
,
Test_Pool
)
{
// length, window_length, window_stride, left_pad, right_pad
this
->
params
=
{{{
1
,
1
,
1
,
1
},
{
1
,
1
},
{
1
,
1
},
{
0
,
0
},
{
0
,
0
}},
{{
2
,
16
,
64
,
64
},
{
64
,
64
},
{
1
,
1
},
{
0
,
0
},
{
0
,
0
}},
{{
2
,
32
,
30
,
30
},
{
2
,
2
},
{
2
,
2
},
{
1
,
1
},
{
1
,
1
}}};
this
->
Run
();
}
test/pool_fwd/test_max_pool3d_fwd.cpp
View file @
48fe8532
...
@@ -26,6 +26,8 @@ class TestMaxPool3dFwd : public ::testing::Test
...
@@ -26,6 +26,8 @@ class TestMaxPool3dFwd : public ::testing::Test
OutDataType
,
OutDataType
,
ComputeDataType
,
ComputeDataType
,
IndexDataType
,
IndexDataType
,
ck
::
tensor_layout
::
convolution
::
NDHWC
,
ck
::
tensor_layout
::
convolution
::
NDHWC
,
ck
::
ReduceTensorOp
::
MAX
,
ck
::
ReduceTensorOp
::
MAX
,
false
,
false
,
false
>
(
true
,
false
>
(
true
,
...
@@ -35,6 +37,7 @@ class TestMaxPool3dFwd : public ::testing::Test
...
@@ -35,6 +37,7 @@ class TestMaxPool3dFwd : public ::testing::Test
param
.
length_
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
window_strides_
,
param
.
window_dilations_
,
param
.
input_left_pads_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
EXPECT_TRUE
(
success
);
...
@@ -44,6 +47,8 @@ class TestMaxPool3dFwd : public ::testing::Test
...
@@ -44,6 +47,8 @@ class TestMaxPool3dFwd : public ::testing::Test
OutDataType
,
OutDataType
,
ComputeDataType
,
ComputeDataType
,
IndexDataType
,
IndexDataType
,
ck
::
tensor_layout
::
convolution
::
NDHWC
,
ck
::
tensor_layout
::
convolution
::
NDHWC
,
ck
::
ReduceTensorOp
::
MAX
,
ck
::
ReduceTensorOp
::
MAX
,
false
,
false
,
true
>
(
true
,
true
>
(
true
,
...
@@ -53,6 +58,7 @@ class TestMaxPool3dFwd : public ::testing::Test
...
@@ -53,6 +58,7 @@ class TestMaxPool3dFwd : public ::testing::Test
param
.
length_
,
param
.
length_
,
param
.
window_spatial_lengths_
,
param
.
window_spatial_lengths_
,
param
.
window_strides_
,
param
.
window_strides_
,
param
.
window_dilations_
,
param
.
input_left_pads_
,
param
.
input_left_pads_
,
param
.
input_right_pads_
);
param
.
input_right_pads_
);
EXPECT_TRUE
(
success
);
EXPECT_TRUE
(
success
);
...
@@ -70,10 +76,11 @@ using KernelTypes = ::testing::Types<std::tuple<F32, F32, F32, I32>>;
...
@@ -70,10 +76,11 @@ using KernelTypes = ::testing::Types<std::tuple<F32, F32, F32, I32>>;
TYPED_TEST_SUITE
(
TestMaxPool3dFwd
,
KernelTypes
);
TYPED_TEST_SUITE
(
TestMaxPool3dFwd
,
KernelTypes
);
TYPED_TEST
(
TestMaxPool3dFwd
,
Test_Pool
)
TYPED_TEST
(
TestMaxPool3dFwd
,
Test_Pool
)
{
{
// length, window_length, window_stride, left_pad, right_pad
// length, window_length, window_stride, window_dilation, left_pad, right_pad
this
->
params
=
{{{
1
,
1
,
1
,
1
,
1
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
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
},
{
64
,
64
,
64
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
16
,
64
,
64
,
64
},
{
64
,
64
,
64
},
{
1
,
1
,
1
},
{
1
,
1
,
1
},
{
0
,
0
,
0
},
{
0
,
0
,
0
}},
{{
2
,
32
,
30
,
30
,
30
},
{
2
,
2
,
2
},
{
2
,
2
,
2
},
{
1
,
1
,
1
},
{
1
,
1
,
1
}}};
{{
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
();
this
->
Run
();
}
}
test/pool_fwd/test_pool_fwd_common.hpp
View file @
48fe8532
...
@@ -14,11 +14,13 @@ struct PoolingParam
...
@@ -14,11 +14,13 @@ struct PoolingParam
PoolingParam
(
const
std
::
vector
<
index_t
>&
length
,
PoolingParam
(
const
std
::
vector
<
index_t
>&
length
,
const
std
::
vector
<
index_t
>&
window_spatial_lengths
,
const
std
::
vector
<
index_t
>&
window_spatial_lengths
,
const
std
::
vector
<
index_t
>&
window_strides
,
const
std
::
vector
<
index_t
>&
window_strides
,
const
std
::
vector
<
index_t
>&
window_dilations
,
const
std
::
vector
<
index_t
>&
input_left_pads
,
const
std
::
vector
<
index_t
>&
input_left_pads
,
const
std
::
vector
<
index_t
>&
input_right_pads
)
const
std
::
vector
<
index_t
>&
input_right_pads
)
:
length_
(
length
),
:
length_
(
length
),
window_spatial_lengths_
(
window_spatial_lengths
),
window_spatial_lengths_
(
window_spatial_lengths
),
window_strides_
(
window_strides
),
window_strides_
(
window_strides
),
window_dilations_
(
window_dilations
),
input_left_pads_
(
input_left_pads
),
input_left_pads_
(
input_left_pads
),
input_right_pads_
(
input_right_pads
)
input_right_pads_
(
input_right_pads
)
{
{
...
@@ -26,6 +28,7 @@ struct PoolingParam
...
@@ -26,6 +28,7 @@ struct PoolingParam
std
::
vector
<
index_t
>
length_
;
std
::
vector
<
index_t
>
length_
;
std
::
vector
<
index_t
>
window_spatial_lengths_
;
std
::
vector
<
index_t
>
window_spatial_lengths_
;
std
::
vector
<
index_t
>
window_strides_
;
std
::
vector
<
index_t
>
window_strides_
;
std
::
vector
<
index_t
>
window_dilations_
;
std
::
vector
<
index_t
>
input_left_pads_
;
std
::
vector
<
index_t
>
input_left_pads_
;
std
::
vector
<
index_t
>
input_right_pads_
;
std
::
vector
<
index_t
>
input_right_pads_
;
};
};
Prev
1
…
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