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
84bbb63e
Commit
84bbb63e
authored
Sep 27, 2020
by
Chao Liu
Browse files
refactoring Array, Tuple
parent
3bc39592
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
composable_kernel/include/tensor_description/multi_index.hpp
composable_kernel/include/tensor_description/multi_index.hpp
+0
-8
composable_kernel/include/utility/array.hpp
composable_kernel/include/utility/array.hpp
+1
-1
composable_kernel/include/utility/tuple.hpp
composable_kernel/include/utility/tuple.hpp
+3
-3
No files found.
composable_kernel/include/tensor_description/multi_index.hpp
View file @
84bbb63e
...
@@ -9,20 +9,12 @@ namespace ck {
...
@@ -9,20 +9,12 @@ namespace ck {
template
<
index_t
N
>
template
<
index_t
N
>
using
MultiIndex
=
Array
<
index_t
,
N
>
;
using
MultiIndex
=
Array
<
index_t
,
N
>
;
#if 1 // debug
template
<
typename
...
Xs
>
template
<
typename
...
Xs
>
__host__
__device__
constexpr
auto
make_multi_index
(
Xs
...
xs
)
__host__
__device__
constexpr
auto
make_multi_index
(
Xs
...
xs
)
{
{
return
make_array
<
index_t
>
(
xs
...);
return
make_array
<
index_t
>
(
xs
...);
}
}
#else
#else
template
<
typename
...
Xs
>
__host__
__device__
constexpr
auto
make_multi_index
(
const
Xs
&
...
xs
)
{
return
make_array
(
xs
...);
}
#endif
#else
template
<
index_t
N
>
template
<
index_t
N
>
using
MultiIndex
=
StaticallyIndexedArray
<
index_t
,
N
>
;
using
MultiIndex
=
StaticallyIndexedArray
<
index_t
,
N
>
;
...
...
composable_kernel/include/utility/array.hpp
View file @
84bbb63e
...
@@ -12,7 +12,7 @@ struct Array
...
@@ -12,7 +12,7 @@ struct Array
using
type
=
Array
;
using
type
=
Array
;
using
data_type
=
TData
;
using
data_type
=
TData
;
TData
mData
[
NSize
]
=
{
0
}
;
TData
mData
[
NSize
];
__host__
__device__
static
constexpr
index_t
Size
()
{
return
NSize
;
}
__host__
__device__
static
constexpr
index_t
Size
()
{
return
NSize
;
}
...
...
composable_kernel/include/utility/tuple.hpp
View file @
84bbb63e
...
@@ -20,7 +20,7 @@ struct TupleElement
...
@@ -20,7 +20,7 @@ struct TupleElement
__host__
__device__
explicit
constexpr
TupleElement
()
:
mData
()
{}
__host__
__device__
explicit
constexpr
TupleElement
()
:
mData
()
{}
template
<
typename
T
>
template
<
typename
T
>
__host__
__device__
explicit
constexpr
TupleElement
(
T
&&
v
)
:
mData
(
st
atic_cast
<
T
&&
>
(
v
))
__host__
__device__
explicit
constexpr
TupleElement
(
T
&&
v
)
:
mData
(
st
d
::
forward
<
T
>
(
v
))
{
{
}
}
...
@@ -57,7 +57,7 @@ struct TupleImpl<Sequence<Is...>, Xs...> : TupleElement<TupleElementKey<Is>, Xs>
...
@@ -57,7 +57,7 @@ struct TupleImpl<Sequence<Is...>, Xs...> : TupleElement<TupleElementKey<Is>, Xs>
template
<
typename
...
Ys
>
template
<
typename
...
Ys
>
__host__
__device__
explicit
constexpr
TupleImpl
(
Ys
&&
...
ys
)
__host__
__device__
explicit
constexpr
TupleImpl
(
Ys
&&
...
ys
)
:
TupleElement
<
TupleElementKey
<
Is
>
,
Xs
>
(
st
atic_cast
<
Ys
&&
>
(
ys
))...
:
TupleElement
<
TupleElementKey
<
Is
>
,
Xs
>
(
st
d
::
forward
<
Ys
>
(
ys
))...
{
{
}
}
...
@@ -85,7 +85,7 @@ struct Tuple : detail::TupleImpl<typename arithmetic_sequence_gen<0, sizeof...(X
...
@@ -85,7 +85,7 @@ struct Tuple : detail::TupleImpl<typename arithmetic_sequence_gen<0, sizeof...(X
detail
::
TupleImpl
<
typename
arithmetic_sequence_gen
<
0
,
sizeof
...(
Xs
),
1
>::
type
,
Xs
...
>
;
detail
::
TupleImpl
<
typename
arithmetic_sequence_gen
<
0
,
sizeof
...(
Xs
),
1
>::
type
,
Xs
...
>
;
template
<
typename
...
Ys
>
template
<
typename
...
Ys
>
__host__
__device__
explicit
constexpr
Tuple
(
Ys
&&
...
ys
)
:
base
(
st
atic_cast
<
Ys
&&
>
(
ys
)...)
__host__
__device__
explicit
constexpr
Tuple
(
Ys
&&
...
ys
)
:
base
(
st
d
::
forward
<
Ys
>
(
ys
)...)
{
{
}
}
...
...
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