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
e00a943e
Commit
e00a943e
authored
May 17, 2022
by
myamlak
Browse files
Merge remote-tracking branch 'origin/develop' into myamlak/cgemm
parents
ffe12e2e
9f71ff48
Changes
162
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
84 deletions
+84
-84
test/reference_conv_fwd/CMakeLists.txt
test/reference_conv_fwd/CMakeLists.txt
+1
-1
test/reference_conv_fwd/reference_conv_fwd.cpp
test/reference_conv_fwd/reference_conv_fwd.cpp
+83
-83
No files found.
test/reference_conv_fwd/CMakeLists.txt
View file @
e00a943e
add_gtest_executable
(
test_reference_conv_fwd reference_conv_fwd.cpp
)
add_gtest_executable
(
test_reference_conv_fwd reference_conv_fwd.cpp
)
target_link_libraries
(
test_reference_conv_fwd PRIVATE host_tensor conv_
fwd_
util
)
target_link_libraries
(
test_reference_conv_fwd PRIVATE host_tensor conv_util
)
test/reference_conv_fwd/reference_conv_fwd.cpp
View file @
e00a943e
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include "check_err.hpp"
#include "check_err.hpp"
#include "config.hpp"
#include "config.hpp"
#include "conv_
fwd_
util.hpp"
#include "conv_util.hpp"
#include "element_wise_operation.hpp"
#include "element_wise_operation.hpp"
#include "fill.hpp"
#include "fill.hpp"
#include "host_tensor.hpp"
#include "host_tensor.hpp"
...
@@ -34,21 +34,21 @@ run_reference_convolution_forward(const ck::utils::conv::ConvParams& params,
...
@@ -34,21 +34,21 @@ run_reference_convolution_forward(const ck::utils::conv::ConvParams& params,
const
FillInputOp
&
fill_input_op
=
FillInputOp
{},
const
FillInputOp
&
fill_input_op
=
FillInputOp
{},
const
FillWeightsOp
&
fill_weights_op
=
FillWeightsOp
{
0.5
f
})
const
FillWeightsOp
&
fill_weights_op
=
FillWeightsOp
{
0.5
f
})
{
{
std
::
vector
<
std
::
size_t
>
input_dims
{
static_cast
<
std
::
size_t
>
(
params
.
N
),
std
::
vector
<
std
::
size_t
>
input_dims
{
static_cast
<
std
::
size_t
>
(
params
.
N
_
),
static_cast
<
std
::
size_t
>
(
params
.
C
)};
static_cast
<
std
::
size_t
>
(
params
.
C
_
)};
input_dims
.
insert
(
std
::
end
(
input_dims
),
input_dims
.
insert
(
std
::
end
(
input_dims
),
std
::
begin
(
params
.
input_spatial_lengths
),
std
::
begin
(
params
.
input_spatial_lengths
_
),
std
::
end
(
params
.
input_spatial_lengths
));
std
::
end
(
params
.
input_spatial_lengths
_
));
std
::
vector
<
std
::
size_t
>
filter_dims
{
static_cast
<
std
::
size_t
>
(
params
.
K
),
std
::
vector
<
std
::
size_t
>
filter_dims
{
static_cast
<
std
::
size_t
>
(
params
.
K
_
),
static_cast
<
std
::
size_t
>
(
params
.
C
)};
static_cast
<
std
::
size_t
>
(
params
.
C
_
)};
filter_dims
.
insert
(
std
::
end
(
filter_dims
),
filter_dims
.
insert
(
std
::
end
(
filter_dims
),
std
::
begin
(
params
.
filter_spatial_lengths
),
std
::
begin
(
params
.
filter_spatial_lengths
_
),
std
::
end
(
params
.
filter_spatial_lengths
));
std
::
end
(
params
.
filter_spatial_lengths
_
));
const
std
::
vector
<
ck
::
index_t
>&
output_spatial_lengths
=
params
.
GetOutputSpatialLengths
();
const
std
::
vector
<
ck
::
index_t
>&
output_spatial_lengths
=
params
.
GetOutputSpatialLengths
();
std
::
vector
<
std
::
size_t
>
output_dims
{
static_cast
<
std
::
size_t
>
(
params
.
N
),
std
::
vector
<
std
::
size_t
>
output_dims
{
static_cast
<
std
::
size_t
>
(
params
.
N
_
),
static_cast
<
std
::
size_t
>
(
params
.
K
)};
static_cast
<
std
::
size_t
>
(
params
.
K
_
)};
output_dims
.
insert
(
std
::
end
(
output_dims
),
output_dims
.
insert
(
std
::
end
(
output_dims
),
std
::
begin
(
output_spatial_lengths
),
std
::
begin
(
output_spatial_lengths
),
std
::
end
(
output_spatial_lengths
));
std
::
end
(
output_spatial_lengths
));
...
@@ -74,10 +74,10 @@ run_reference_convolution_forward(const ck::utils::conv::ConvParams& params,
...
@@ -74,10 +74,10 @@ run_reference_convolution_forward(const ck::utils::conv::ConvParams& params,
auto
ref_argument
=
ref_conv
.
MakeArgument
(
input
,
auto
ref_argument
=
ref_conv
.
MakeArgument
(
input
,
weights
,
weights
,
host_output
,
host_output
,
params
.
conv_filter_strides
,
params
.
conv_filter_strides
_
,
params
.
conv_filter_dilations
,
params
.
conv_filter_dilations
_
,
params
.
input_left_pads
,
params
.
input_left_pads
_
,
params
.
input_right_pads
,
params
.
input_right_pads
_
,
InElementOp
{},
InElementOp
{},
WeiElementOp
{},
WeiElementOp
{},
OutElementOp
{});
OutElementOp
{});
...
@@ -91,15 +91,15 @@ run_reference_convolution_forward(const ck::utils::conv::ConvParams& params,
...
@@ -91,15 +91,15 @@ run_reference_convolution_forward(const ck::utils::conv::ConvParams& params,
TEST
(
ReferenceConvolutionFWD
,
Conv2DNHWC
)
TEST
(
ReferenceConvolutionFWD
,
Conv2DNHWC
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
N
=
1
;
params
.
N
_
=
1
;
params
.
K
=
1
;
params
.
K
_
=
1
;
params
.
C
=
2
;
params
.
C
_
=
2
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
6
,
6
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
6
,
6
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
};
auto
out_tensor
=
run_reference_convolution_forward
<
2
>
(
params
);
auto
out_tensor
=
run_reference_convolution_forward
<
2
>
(
params
);
std
::
vector
<
std
::
size_t
>
ref_dims
{
1
,
1
,
4
,
4
};
std
::
vector
<
std
::
size_t
>
ref_dims
{
1
,
1
,
4
,
4
};
...
@@ -127,15 +127,15 @@ TEST(ReferenceConvolutionFWD, Conv2DNHWC)
...
@@ -127,15 +127,15 @@ TEST(ReferenceConvolutionFWD, Conv2DNHWC)
TEST
(
ReferenceConvolutionFWD
,
Conv2DNHWCStridesDilationsPadding
)
TEST
(
ReferenceConvolutionFWD
,
Conv2DNHWCStridesDilationsPadding
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
N
=
1
;
params
.
N
_
=
1
;
params
.
K
=
2
;
params
.
K
_
=
2
;
params
.
C
=
2
;
params
.
C
_
=
2
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
12
,
12
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
12
,
12
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
2
,
2
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
2
,
2
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
2
,
2
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
2
,
2
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
};
auto
out_tensor
=
run_reference_convolution_forward
<
2
>
(
params
);
auto
out_tensor
=
run_reference_convolution_forward
<
2
>
(
params
);
std
::
vector
<
std
::
size_t
>
ref_dims
=
std
::
vector
<
std
::
size_t
>
{
1
,
2
,
5
,
5
};
std
::
vector
<
std
::
size_t
>
ref_dims
=
std
::
vector
<
std
::
size_t
>
{
1
,
2
,
5
,
5
};
...
@@ -153,16 +153,16 @@ TEST(ReferenceConvolutionFWD, Conv2DNHWCStridesDilationsPadding)
...
@@ -153,16 +153,16 @@ TEST(ReferenceConvolutionFWD, Conv2DNHWCStridesDilationsPadding)
TEST
(
ReferenceConvolutionFWD
,
Conv1DNWC
)
TEST
(
ReferenceConvolutionFWD
,
Conv1DNWC
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
num_dim_spatial
=
1
;
params
.
num_dim_spatial
_
=
1
;
params
.
N
=
1
;
params
.
N
_
=
1
;
params
.
K
=
1
;
params
.
K
_
=
1
;
params
.
C
=
2
;
params
.
C
_
=
2
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
6
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
6
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
};
auto
out_tensor
=
auto
out_tensor
=
run_reference_convolution_forward
<
1
,
run_reference_convolution_forward
<
1
,
...
@@ -182,16 +182,16 @@ TEST(ReferenceConvolutionFWD, Conv1DNWC)
...
@@ -182,16 +182,16 @@ TEST(ReferenceConvolutionFWD, Conv1DNWC)
TEST
(
ReferenceConvolutionFWD
,
Conv1DNWCStridesDilationsPadding
)
TEST
(
ReferenceConvolutionFWD
,
Conv1DNWCStridesDilationsPadding
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
num_dim_spatial
=
1
;
params
.
num_dim_spatial
_
=
1
;
params
.
N
=
1
;
params
.
N
_
=
1
;
params
.
K
=
2
;
params
.
K
_
=
2
;
params
.
C
=
2
;
params
.
C
_
=
2
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
12
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
12
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
2
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
2
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
2
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
2
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
auto
out_tensor
=
auto
out_tensor
=
run_reference_convolution_forward
<
1
,
run_reference_convolution_forward
<
1
,
...
@@ -211,16 +211,16 @@ TEST(ReferenceConvolutionFWD, Conv1DNWCStridesDilationsPadding)
...
@@ -211,16 +211,16 @@ TEST(ReferenceConvolutionFWD, Conv1DNWCStridesDilationsPadding)
TEST
(
ReferenceConvolutionFWD
,
Conv1DNWCSameOutputSize
)
TEST
(
ReferenceConvolutionFWD
,
Conv1DNWCSameOutputSize
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
num_dim_spatial
=
1
;
params
.
num_dim_spatial
_
=
1
;
params
.
N
=
2
;
params
.
N
_
=
2
;
params
.
K
=
16
;
params
.
K
_
=
16
;
params
.
C
=
4
;
params
.
C
_
=
4
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
16
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
16
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
1
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
1
};
auto
out_tensor2
=
run_reference_convolution_forward
<
1
,
auto
out_tensor2
=
run_reference_convolution_forward
<
1
,
float
,
float
,
...
@@ -305,16 +305,16 @@ TEST(ReferenceConvolutionFWD, Conv1DNWCSameOutputSize)
...
@@ -305,16 +305,16 @@ TEST(ReferenceConvolutionFWD, Conv1DNWCSameOutputSize)
TEST
(
ReferenceConvolutionFWD
,
Conv3DNCDHW
)
TEST
(
ReferenceConvolutionFWD
,
Conv3DNCDHW
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
num_dim_spatial
=
3
;
params
.
num_dim_spatial
_
=
3
;
params
.
N
=
1
;
params
.
N
_
=
1
;
params
.
K
=
1
;
params
.
K
_
=
1
;
params
.
C
=
2
;
params
.
C
_
=
2
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
,
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
,
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
6
,
6
,
6
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
6
,
6
,
6
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
,
1
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
,
1
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
,
1
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
,
1
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
auto
out_tensor
=
run_reference_convolution_forward
<
3
,
auto
out_tensor
=
run_reference_convolution_forward
<
3
,
float
,
float
,
...
@@ -344,16 +344,16 @@ TEST(ReferenceConvolutionFWD, Conv3DNCDHW)
...
@@ -344,16 +344,16 @@ TEST(ReferenceConvolutionFWD, Conv3DNCDHW)
TEST
(
ReferenceConvolutionFWD
,
Conv3DNCDHWStridesDilations
)
TEST
(
ReferenceConvolutionFWD
,
Conv3DNCDHWStridesDilations
)
{
{
ck
::
utils
::
conv
::
ConvParams
params
;
ck
::
utils
::
conv
::
ConvParams
params
;
params
.
num_dim_spatial
=
3
;
params
.
num_dim_spatial
_
=
3
;
params
.
N
=
1
;
params
.
N
_
=
1
;
params
.
K
=
2
;
params
.
K
_
=
2
;
params
.
C
=
2
;
params
.
C
_
=
2
;
params
.
filter_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
,
3
};
params
.
filter_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
,
3
};
params
.
input_spatial_lengths
=
std
::
vector
<
ck
::
index_t
>
{
12
,
12
,
12
};
params
.
input_spatial_lengths
_
=
std
::
vector
<
ck
::
index_t
>
{
12
,
12
,
12
};
params
.
conv_filter_strides
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
,
3
};
params
.
conv_filter_strides
_
=
std
::
vector
<
ck
::
index_t
>
{
3
,
3
,
3
};
params
.
conv_filter_dilations
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
,
1
};
params
.
conv_filter_dilations
_
=
std
::
vector
<
ck
::
index_t
>
{
1
,
1
,
1
};
params
.
input_left_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
params
.
input_left_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
params
.
input_right_pads
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
params
.
input_right_pads
_
=
std
::
vector
<
ck
::
index_t
>
{
0
,
0
,
0
};
auto
out_tensor
=
run_reference_convolution_forward
<
3
,
auto
out_tensor
=
run_reference_convolution_forward
<
3
,
float
,
float
,
...
...
Prev
1
…
5
6
7
8
9
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