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
50fc7dde
Commit
50fc7dde
authored
Mar 11, 2022
by
Jianfeng yan
Browse files
added more static_assert
parent
9e33fe70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
include/ck/tensor_operation/gpu/thread/threadwise_tensor_slice_transfer.hpp
...operation/gpu/thread/threadwise_tensor_slice_transfer.hpp
+10
-1
include/ck/utility/sequence.hpp
include/ck/utility/sequence.hpp
+6
-0
include/ck/utility/tensor_space_filling_curve.hpp
include/ck/utility/tensor_space_filling_curve.hpp
+4
-0
No files found.
include/ck/tensor_operation/gpu/thread/threadwise_tensor_slice_transfer.hpp
View file @
50fc7dde
...
@@ -79,6 +79,8 @@ struct ThreadwiseTensorSliceTransfer_v1r3
...
@@ -79,6 +79,8 @@ struct ThreadwiseTensorSliceTransfer_v1r3
{
{
static_assert
(
SrcDesc
::
IsKnownAtCompileTime
(),
static_assert
(
SrcDesc
::
IsKnownAtCompileTime
(),
"wrong! SrcDesc need to known at compile-time"
);
"wrong! SrcDesc need to known at compile-time"
);
static_assert
(
SliceLengths
::
At
(
Number
<
DstVectorDim
>
{})
%
DstScalarPerVector
==
0
,
"wrong! Not divisible"
);
}
}
__device__
void
SetDstSliceOrigin
(
const
DstDesc
&
dst_desc
,
const
Index
&
dst_slice_origin_idx
)
__device__
void
SetDstSliceOrigin
(
const
DstDesc
&
dst_desc
,
const
Index
&
dst_slice_origin_idx
)
...
@@ -250,6 +252,8 @@ struct ThreadwiseTensorSliceTransfer_v2
...
@@ -250,6 +252,8 @@ struct ThreadwiseTensorSliceTransfer_v2
{
{
static_assert
(
DstDesc
::
IsKnownAtCompileTime
(),
static_assert
(
DstDesc
::
IsKnownAtCompileTime
(),
"wrong! SrcDesc need to known at compile-time"
);
"wrong! SrcDesc need to known at compile-time"
);
static_assert
(
SliceLengths
::
At
(
Number
<
SrcVectorDim
>
{})
%
SrcScalarPerVector
==
0
,
"wrong! Not divisible"
);
}
}
__device__
void
SetSrcSliceOrigin
(
const
SrcDesc
&
src_desc
,
const
Index
&
src_slice_origin_idx
)
__device__
void
SetSrcSliceOrigin
(
const
SrcDesc
&
src_desc
,
const
Index
&
src_slice_origin_idx
)
...
@@ -439,6 +443,10 @@ struct ThreadwiseTensorSliceTransfer_v3
...
@@ -439,6 +443,10 @@ struct ThreadwiseTensorSliceTransfer_v3
:
src_coord_
(
make_tensor_coordinate
(
src_desc
,
src_slice_origin
)),
:
src_coord_
(
make_tensor_coordinate
(
src_desc
,
src_slice_origin
)),
dst_coord_
(
make_tensor_coordinate
(
dst_desc
,
dst_slice_origin
))
dst_coord_
(
make_tensor_coordinate
(
dst_desc
,
dst_slice_origin
))
{
{
static_assert
(
SliceLengths
::
At
(
Number
<
SrcVectorDim
>
{})
%
SrcScalarPerVector
==
0
,
"wrong! Not divisible"
);
static_assert
(
SliceLengths
::
At
(
Number
<
DstVectorDim
>
{})
%
DstScalarPerVector
==
0
,
"wrong! Not divisible"
);
}
}
__device__
void
SetSrcSliceOrigin
(
const
SrcDesc
&
src_desc
,
const
Index
&
src_slice_origin_idx
)
__device__
void
SetSrcSliceOrigin
(
const
SrcDesc
&
src_desc
,
const
Index
&
src_slice_origin_idx
)
...
@@ -1016,7 +1024,8 @@ struct ThreadwiseTensorSliceTransfer_v4
...
@@ -1016,7 +1024,8 @@ struct ThreadwiseTensorSliceTransfer_v4
static_assert
(
SrcDesc
::
IsKnownAtCompileTime
()
&&
DstDesc
::
IsKnownAtCompileTime
(),
static_assert
(
SrcDesc
::
IsKnownAtCompileTime
()
&&
DstDesc
::
IsKnownAtCompileTime
(),
"wrong! SrcDesc and DstDesc need to known at compile-time"
);
"wrong! SrcDesc and DstDesc need to known at compile-time"
);
static_assert
(
SliceLengths
::
At
(
Number
<
SrcVectorDim
>
{})
%
SrcScalarPerVector
==
0
,
"wrong!"
);
static_assert
(
SliceLengths
::
At
(
Number
<
SrcVectorDim
>
{})
%
SrcScalarPerVector
==
0
,
"wrong! Not divisible"
);
}
}
template
<
typename
SrcRefToOriginDisplacement
,
template
<
typename
SrcRefToOriginDisplacement
,
...
...
include/ck/utility/sequence.hpp
View file @
50fc7dde
...
@@ -606,6 +606,12 @@ struct sequence_map_inverse
...
@@ -606,6 +606,12 @@ struct sequence_map_inverse
SeqMap
::
Size
()
>::
type
;
SeqMap
::
Size
()
>::
type
;
};
};
template
<
index_t
...
Xs
,
index_t
...
Ys
>
__host__
__device__
constexpr
bool
operator
==
(
Sequence
<
Xs
...
>
,
Sequence
<
Ys
...
>
)
{
return
(
true
&&
...
&&
(
Xs
==
Ys
));
}
template
<
index_t
...
Xs
,
index_t
...
Ys
>
template
<
index_t
...
Xs
,
index_t
...
Ys
>
__host__
__device__
constexpr
auto
operator
+
(
Sequence
<
Xs
...
>
,
Sequence
<
Ys
...
>
)
__host__
__device__
constexpr
auto
operator
+
(
Sequence
<
Xs
...
>
,
Sequence
<
Ys
...
>
)
{
{
...
...
include/ck/utility/tensor_space_filling_curve.hpp
View file @
50fc7dde
...
@@ -37,6 +37,10 @@ struct SpaceFillingCurve
...
@@ -37,6 +37,10 @@ struct SpaceFillingCurve
__host__
__device__
static
constexpr
index_t
GetNumOfAccess
()
__host__
__device__
static
constexpr
index_t
GetNumOfAccess
()
{
{
static_assert
(
TensorLengths
::
Size
()
==
ScalarsPerAccess
::
Size
());
static_assert
(
TensorLengths
{}
%
ScalarsPerAccess
{}
==
typename
uniform_sequence_gen
<
TensorLengths
::
Size
(),
0
>::
type
{});
return
reduce_on_sequence
(
TensorLengths
{},
math
::
multiplies
{},
Number
<
1
>
{})
/
return
reduce_on_sequence
(
TensorLengths
{},
math
::
multiplies
{},
Number
<
1
>
{})
/
ScalarPerVector
;
ScalarPerVector
;
}
}
...
...
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