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
a4e34d88
Unverified
Commit
a4e34d88
authored
Dec 02, 2022
by
rocking5566
Committed by
GitHub
Dec 02, 2022
Browse files
Merge branch 'develop' into gemm_layernorm_welford
parents
6916e3e4
ad541ad6
Changes
63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
8 deletions
+97
-8
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
+0
-1
test/gemm_split_k/gemm_split_k.cpp
test/gemm_split_k/gemm_split_k.cpp
+5
-7
No files found.
test/batchnorm/batchnorm_bwd_rank_4.cpp
0 → 100644
View file @
a4e34d88
// 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/include/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 @
a4e34d88
...
...
@@ -90,7 +90,6 @@ class TestBatchNormFwdRank4 : public ::testing::Test
using
KernelTypes
=
::
testing
::
Types
<
std
::
tuple
<
F16
,
F16
,
F32
,
F16
,
F16
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
BF16
,
BF16
,
F32
,
BF16
,
BF16
,
F32
>
,
std
::
tuple
<
I8
,
I8
,
F32
,
I8
,
I8
,
F32
>
,
std
::
tuple
<
F64
,
F64
,
F64
,
F64
,
F64
,
F64
>>
;
TYPED_TEST_SUITE
(
TestBatchNormFwdRank4
,
KernelTypes
);
...
...
test/gemm_split_k/gemm_split_k.cpp
View file @
a4e34d88
...
...
@@ -226,9 +226,8 @@ int main(int argc, char* argv[])
std
::
vector
<
gemmArgs
>
test_cases
;
if
(
argc
==
1
)
{
test_cases
=
{{
GemmMatrixLayout
::
MK_KN_MN
,
3
,
3
,
3
,
3
,
3
,
3
,
1
}};
// JD: Populate with more and meaningful
return
0
;
test_cases
=
{{
GemmMatrixLayout
::
MK_KN_MN
,
1024
,
1024
,
1024
,
1024
,
1024
,
1024
,
2
},
{
GemmMatrixLayout
::
MK_KN_MN
,
1024
,
1024
,
1024
,
1024
,
1024
,
1024
,
8
}};
}
else
if
(
argc
==
9
)
{
...
...
@@ -253,11 +252,10 @@ int main(int argc, char* argv[])
printf
(
"arg2 to 7: M, N, K, StrideA, StrideB, StrideC KBatch
\n
"
);
return
-
1
;
}
bool
error
=
false
;
for
(
const
auto
&
kinder
:
test_cases
)
{
const
auto
res
=
test_gemm
(
kinder
);
if
(
!
res
)
return
-
1
;
error
|=
test_gemm
(
kinder
);
}
return
0
;
return
error
?
1
:
0
;
}
Prev
1
2
3
4
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