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
dc70e3e1
Unverified
Commit
dc70e3e1
authored
Nov 01, 2022
by
arai713
Committed by
GitHub
Nov 01, 2022
Browse files
Merge branch 'develop' into gridwise_2d
parents
10947a54
8ee36118
Changes
105
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
21 deletions
+152
-21
test/gemm/instance/gemm_f16_tt_instance.hpp
test/gemm/instance/gemm_f16_tt_instance.hpp
+41
-0
test/gemm/run_gemm_test.inc
test/gemm/run_gemm_test.inc
+41
-0
test/normalization/test_groupnorm_fp16.cpp
test/normalization/test_groupnorm_fp16.cpp
+0
-7
test/normalization/test_groupnorm_fp32.cpp
test/normalization/test_groupnorm_fp32.cpp
+0
-7
test/space_filling_curve/space_filling_curve.cpp
test/space_filling_curve/space_filling_curve.cpp
+70
-7
No files found.
test/gemm/instance/gemm_f16_tt_instance.hpp
0 → 100644
View file @
dc70e3e1
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
#include <cstdlib>
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/device/tensor_layout.hpp"
#include "ck/tensor_operation/gpu/device/gemm_specialization.hpp"
#include "ck/tensor_operation/gpu/device/impl/device_gemm_xdl_cshuffle.hpp"
#include "ck/tensor_operation/gpu/element/element_wise_operation.hpp"
#include "ck/library/tensor_operation_instance/add_device_operation_instance.hpp"
namespace
ck
{
namespace
tensor_operation
{
namespace
device
{
namespace
instance
{
using
F16
=
ck
::
half_t
;
using
F32
=
float
;
using
Row
=
ck
::
tensor_layout
::
gemm
::
RowMajor
;
using
Col
=
ck
::
tensor_layout
::
gemm
::
ColumnMajor
;
template
<
ck
::
index_t
...
Is
>
using
S
=
ck
::
Sequence
<
Is
...
>
;
using
PassThrough
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
void
add_gemm_f16_tt_256x256
(
std
::
vector
<
std
::
unique_ptr
<
BaseOperator
>>&
instances
);
void
add_gemm_f16_tt_256x128
(
std
::
vector
<
std
::
unique_ptr
<
BaseOperator
>>&
instances
);
void
add_gemm_f16_tt_128x128
(
std
::
vector
<
std
::
unique_ptr
<
BaseOperator
>>&
instances
);
void
add_gemm_f16_tt_128x64
(
std
::
vector
<
std
::
unique_ptr
<
BaseOperator
>>&
instances
);
}
// namespace instance
}
// namespace device
}
// namespace tensor_operation
}
// namespace ck
test/gemm/run_gemm_test.inc
0 → 100644
View file @
dc70e3e1
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2022, Advanced Micro Devices, Inc. All rights reserved.
int
run_gemm_test
()
{
using
Row
=
ck
::
tensor_layout
::
gemm
::
RowMajor
;
using
Col
=
ck
::
tensor_layout
::
gemm
::
ColumnMajor
;
using
PassThrough
=
ck
::
tensor_operation
::
element_wise
::
PassThrough
;
auto
test
=
[
&
](
auto
a_layout
,
auto
b_layout
,
auto
c_layout
)
{
bool
pass
=
true
;
using
DeviceOp
=
ck
::
tensor_operation
::
device
::
DeviceGemm
<
decltype
(
a_layout
),
decltype
(
b_layout
),
decltype
(
c_layout
),
ADataType
,
BDataType
,
CDataType
,
PassThrough
,
PassThrough
,
PassThrough
>
;
const
auto
gemmPtrs
=
ck
::
tensor_operation
::
device
::
instance
::
DeviceOperationInstanceFactory
<
DeviceOp
>::
GetInstances
();
for
(
auto
&
gemmPtr
:
gemmPtrs
)
{
pass
&=
ck
::
gemm_util
::
TestGemm
<
AccDataType
>
{}(
gemmPtr
.
get
());
}
return
pass
;
};
bool
pass
=
test
(
Row
{},
Row
{},
Row
{})
&&
test
(
Row
{},
Col
{},
Row
{})
&&
test
(
Col
{},
Row
{},
Row
{})
&&
test
(
Col
{},
Col
{},
Row
{});
std
::
cout
<<
"TestGemm ..... "
<<
(
pass
?
"SUCCESS"
:
"FAILURE"
)
<<
std
::
endl
;
return
pass
?
0
:
1
;
}
test/normalization/test_groupnorm_fp16.cpp
View file @
dc70e3e1
...
...
@@ -45,13 +45,6 @@ class TestGroupnorm : public ::testing::Test
using
KernelTypes
=
::
testing
::
Types
<
// XDataType, GammaDataType, BetaDataType, AccDataType, YDataType>
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>
,
std
::
tuple
<
F16
,
F16
,
F16
,
F32
,
F16
>>
;
TYPED_TEST_SUITE
(
TestGroupnorm
,
KernelTypes
);
...
...
test/normalization/test_groupnorm_fp32.cpp
View file @
dc70e3e1
...
...
@@ -43,13 +43,6 @@ class TestGroupnorm : public ::testing::Test
using
KernelTypes
=
::
testing
::
Types
<
// XDataType, GammaDataType, BetaDataType, AccDataType, YDataType>
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>
,
std
::
tuple
<
F32
,
F32
,
F32
,
F32
,
F32
>>
;
TYPED_TEST_SUITE
(
TestGroupnorm
,
KernelTypes
);
...
...
test/space_filling_curve/space_filling_curve.cpp
View file @
dc70e3e1
...
...
@@ -12,28 +12,91 @@
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
)
{
(
void
)
argc
;
(
void
)
argv
;
traverse_using_space_filling_curve
();
traverse_using_space_filling_curve_linear
();
traverse_using_space_filling_curve_snakecurved
();
return
0
;
}
void
traverse_using_space_filling_curve
()
void
traverse_using_space_filling_curve
_linear
()
{
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
>
;
using
TensorLengths
=
Sequence
<
3
,
2
,
2
>
;
using
DimAccessOrder
=
Sequence
<
2
,
0
,
1
>
;
using
ScalarsPerAccess
=
Sequence
<
1
,
1
,
1
>
;
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
),
make_tuple
(
0
,
2
,
0
),
...
...
Prev
1
2
3
4
5
6
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