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
d0b49a14
Commit
d0b49a14
authored
Oct 28, 2022
by
Qianfeng Zhang
Browse files
Merge branch 'develop' into bnorm_bwd_pr
parents
29026b0e
87fd1152
Changes
602
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
28 deletions
+91
-28
test/normalization/test_layernorm2d_util.hpp
test/normalization/test_layernorm2d_util.hpp
+21
-21
test/space_filling_curve/space_filling_curve.cpp
test/space_filling_curve/space_filling_curve.cpp
+70
-7
No files found.
test/
layernorm
/test_layernorm2d_util.hpp
→
test/
normalization
/test_layernorm2d_util.hpp
View file @
d0b49a14
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include "ck/ck.hpp"
#include "ck/ck.hpp"
#include "ck/utility/number.hpp"
#include "ck/utility/number.hpp"
#include "ck/tensor_operation/gpu/device/device_
layernorm
_impl.hpp"
#include "ck/tensor_operation/gpu/device/
impl/
device_
normalization
_impl.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/check_err.hpp"
#include "ck/library/utility/host_tensor.hpp"
#include "ck/library/utility/host_tensor.hpp"
...
@@ -65,26 +65,26 @@ class TestLayernorm2d : public ::testing::Test
...
@@ -65,26 +65,26 @@ class TestLayernorm2d : public ::testing::Test
Rank
,
Rank
,
NumReduceDim
>
;
NumReduceDim
>
;
using
DeviceInstance
=
tensor_operation
::
device
::
Device
Layernorm
Impl
<
XDataType
,
using
DeviceInstance
=
tensor_operation
::
device
::
Device
Normalization
Impl
<
XDataType
,
GammaDataType
,
GammaDataType
,
BetaDataType
,
BetaDataType
,
AccDataType
,
AccDataType
,
YDataType
,
YDataType
,
PassThrough
,
PassThrough
,
Rank
,
Rank
,
NumReduceDim
,
NumReduceDim
,
BlockSize
,
BlockSize
,
MThreadClusterSize
,
MThreadClusterSize
,
KThreadClusterSize
,
KThreadClusterSize
,
MThreadSliceSize
,
MThreadSliceSize
,
KThreadSliceSize
,
KThreadSliceSize
,
XYSrcVectorDim
,
XYSrcVectorDim
,
XSrcVectorSize
,
XSrcVectorSize
,
GammaSrcVectorDim
,
GammaSrcVectorDim
,
GammaSrcVectorSize
,
GammaSrcVectorSize
,
BetaSrcVectorDim
,
BetaSrcVectorDim
,
BetaSrcVectorSize
,
BetaSrcVectorSize
,
YDstVectorSize
>
;
YDstVectorSize
>
;
TestLayernorm2d
()
:
ref_instance_invoker_
(
ReferenceInstance
{}.
MakeInvoker
())
{}
TestLayernorm2d
()
:
ref_instance_invoker_
(
ReferenceInstance
{}.
MakeInvoker
())
{}
...
...
test/space_filling_curve/space_filling_curve.cpp
View file @
d0b49a14
...
@@ -12,28 +12,91 @@
...
@@ -12,28 +12,91 @@
using
namespace
ck
;
using
namespace
ck
;
void
traverse_using_space_filling_curve
();
void
traverse_using_space_filling_curve_linear
();
void
traverse_using_space_filling_curve_snakecurved
();
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
(
void
)
argc
;
(
void
)
argc
;
(
void
)
argv
;
(
void
)
argv
;
traverse_using_space_filling_curve
();
traverse_using_space_filling_curve_linear
();
traverse_using_space_filling_curve_snakecurved
();
return
0
;
return
0
;
}
}
void
traverse_using_space_filling_curve
()
void
traverse_using_space_filling_curve
_linear
()
{
{
constexpr
auto
I0
=
Number
<
0
>
{};
constexpr
auto
I0
=
Number
<
0
>
{};
constexpr
auto
I1
=
Number
<
1
>
{};
constexpr
auto
I1
=
Number
<
1
>
{};
constexpr
auto
I2
=
Number
<
2
>
{};
constexpr
auto
I2
=
Number
<
2
>
{};
using
TensorLengths
=
Sequence
<
16
,
10
,
9
>
;
using
TensorLengths
=
Sequence
<
3
,
2
,
2
>
;
using
DimAccessOrder
=
Sequence
<
2
,
0
,
1
>
;
using
DimAccessOrder
=
Sequence
<
2
,
0
,
1
>
;
using
ScalarsPerAccess
=
Sequence
<
4
,
2
,
3
>
;
using
ScalarsPerAccess
=
Sequence
<
1
,
1
,
1
>
;
using
SpaceFillingCurve
=
SpaceFillingCurve
<
TensorLengths
,
DimAccessOrder
,
ScalarsPerAccess
>
;
using
SpaceFillingCurve
=
SpaceFillingCurve
<
TensorLengths
,
DimAccessOrder
,
ScalarsPerAccess
,
false
>
;
constexpr
auto
expected
=
make_tuple
(
make_tuple
(
0
,
0
,
0
),
make_tuple
(
0
,
1
,
0
),
make_tuple
(
1
,
0
,
0
),
make_tuple
(
1
,
1
,
0
),
make_tuple
(
2
,
0
,
0
),
make_tuple
(
2
,
1
,
0
),
make_tuple
(
0
,
0
,
1
),
make_tuple
(
0
,
1
,
1
),
make_tuple
(
1
,
0
,
1
),
make_tuple
(
1
,
1
,
1
),
make_tuple
(
2
,
0
,
1
),
make_tuple
(
2
,
1
,
1
));
constexpr
index_t
num_access
=
SpaceFillingCurve
::
GetNumOfAccess
();
static_assert
(
num_access
==
reduce_on_sequence
(
TensorLengths
{}
/
ScalarsPerAccess
{},
math
::
multiplies
{},
Number
<
1
>
{}));
static_for
<
1
,
num_access
,
1
>
{}([
&
](
auto
i
)
{
constexpr
auto
idx_curr
=
SpaceFillingCurve
::
GetIndex
(
i
);
static_assert
(
idx_curr
[
I0
]
==
expected
[
i
][
I0
]);
static_assert
(
idx_curr
[
I1
]
==
expected
[
i
][
I1
]);
static_assert
(
idx_curr
[
I2
]
==
expected
[
i
][
I2
]);
constexpr
auto
backward_step
=
SpaceFillingCurve
::
GetBackwardStep
(
i
);
constexpr
auto
expected_step
=
expected
[
i
-
I1
]
-
expected
[
i
];
static_assert
(
backward_step
[
I0
]
==
expected_step
[
I0
]);
static_assert
(
backward_step
[
I1
]
==
expected_step
[
I1
]);
static_assert
(
backward_step
[
I2
]
==
expected_step
[
I2
]);
});
static_for
<
0
,
num_access
-
1
,
1
>
{}([
&
](
auto
i
)
{
constexpr
auto
idx_curr
=
SpaceFillingCurve
::
GetIndex
(
i
);
static_assert
(
idx_curr
[
I0
]
==
expected
[
i
][
I0
]);
static_assert
(
idx_curr
[
I1
]
==
expected
[
i
][
I1
]);
static_assert
(
idx_curr
[
I2
]
==
expected
[
i
][
I2
]);
constexpr
auto
forward_step
=
SpaceFillingCurve
::
GetForwardStep
(
i
);
constexpr
auto
expected_step
=
expected
[
i
+
I1
]
-
expected
[
i
];
static_assert
(
forward_step
[
I0
]
==
expected_step
[
I0
]);
static_assert
(
forward_step
[
I1
]
==
expected_step
[
I1
]);
static_assert
(
forward_step
[
I2
]
==
expected_step
[
I2
]);
});
}
void
traverse_using_space_filling_curve_snakecurved
()
{
constexpr
auto
I0
=
Number
<
0
>
{};
constexpr
auto
I1
=
Number
<
1
>
{};
constexpr
auto
I2
=
Number
<
2
>
{};
using
TensorLengths
=
Sequence
<
16
,
10
,
9
>
;
using
DimAccessOrder
=
Sequence
<
2
,
0
,
1
>
;
using
ScalarsPerAccess
=
Sequence
<
4
,
2
,
3
>
;
using
SpaceFillingCurve
=
SpaceFillingCurve
<
TensorLengths
,
DimAccessOrder
,
ScalarsPerAccess
,
true
>
;
constexpr
auto
expected
=
make_tuple
(
make_tuple
(
0
,
0
,
0
),
constexpr
auto
expected
=
make_tuple
(
make_tuple
(
0
,
0
,
0
),
make_tuple
(
0
,
2
,
0
),
make_tuple
(
0
,
2
,
0
),
...
...
Prev
1
…
27
28
29
30
31
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