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
0dc0af2e
Commit
0dc0af2e
authored
Dec 04, 2023
by
Bartlomiej Kocot
Browse files
Fix comments
parent
53fdf365
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
12 deletions
+16
-12
CHANGELOG.md
CHANGELOG.md
+1
-0
client_example/25_tensor_transforms/CMakeLists.txt
client_example/25_tensor_transforms/CMakeLists.txt
+2
-0
docs/index.rst
docs/index.rst
+1
-1
docs/wrapper.rst
docs/wrapper.rst
+5
-3
include/ck/wrapper/layout.hpp
include/ck/wrapper/layout.hpp
+6
-7
test/wrapper/test_layout.cpp
test/wrapper/test_layout.cpp
+1
-1
No files found.
CHANGELOG.md
View file @
0dc0af2e
...
...
@@ -19,6 +19,7 @@ None
-
Support for NHWGC (2D and 3D) grouped convolution backward weight (#769 #804)
-
Support for bf16/f32/f16 and NHWGC (2D and 3D) grouped convolution backward data (#757 #799)
-
Support for Batched Gemm DL (#732)
-
Introduce wrapper sublibrary (limited functionality) (#1071)
### Changes
-
Changed the grouped convolution API to maintain consistency with other convolution kernels (#817)
...
...
client_example/25_tensor_transforms/CMakeLists.txt
View file @
0dc0af2e
add_executable
(
client_tensor_transform tensor_transform.cpp
)
target_link_libraries
(
client_tensor_transform PRIVATE composable_kernel::device_other_operations
)
add_executable
(
client_tensor_transform_using_wrapper tensor_transform_using_wrapper.cpp
)
target_link_libraries
(
client_tensor_transform_using_wrapper PRIVATE composable_kernel::device_other_operations
)
docs/index.rst
View file @
0dc0af2e
...
...
@@ -34,7 +34,7 @@ Current CK library are structured into 4 layers:
* "Templated Tile Operators" layer
* "Templated Kernel and Invoker" layer
* "Instantiated Kernel and Invoker" layer
* "Wrapper for tensor tranform
s
operations"
* "Wrapper for tensor tran
s
form operations"
* "Client API" layer
.. image:: data/ck_layer.png
...
...
docs/wrapper.rst
View file @
0dc0af2e
...
...
@@ -5,8 +5,11 @@ Wrapper
-------------------------------------
Description
-------------------------------------
Note: Wrapper is currently under development. At the moment, its functionality
is limited.
.. note::
The wrapper is under development and its functionality is limited.
CK provides a lightweight wrapper for more complex operations implemented in
the library. It allows indexing of nested layouts using a simple interface
...
...
@@ -33,7 +36,6 @@ Example:
Output::
dims:4,(2,4) strides:2,(1,8)
Print2d
0 1 8 9 16 17 24 25
2 3 10 11 18 19 26 27
4 5 12 13 20 21 28 29
...
...
include/ck/wrapper/layout.hpp
View file @
0dc0af2e
...
...
@@ -109,7 +109,7 @@ struct Layout
// Iterate over shape tuple elements:
// 1. If corresponding idx element is tuple then return (will be unrolled)
// 2. If no, pack in tuple. It will be restored during unroll.
auto
unroll
ed_shape
_via_idx
=
generate_tuple
(
auto
align
ed_shape
=
generate_tuple
(
[
&
](
auto
i
)
{
if
constexpr
(
is_detected
<
is_tuple
,
tuple_element_t
<
i
,
Tuple
<
IdxDims
...
>>>::
value
)
...
...
@@ -124,7 +124,7 @@ struct Layout
Number
<
Tuple
<
IdxDims
...
>::
Size
()
>
{});
// Unroll and process next step
return
AlignShapeToIdx
(
UnrollNestedTuple
<
0
,
1
>
(
unroll
ed_shape
_via_idx
),
return
AlignShapeToIdx
(
UnrollNestedTuple
<
0
,
1
>
(
align
ed_shape
),
UnrollNestedTuple
<
0
,
1
>
(
idx
));
}
}
...
...
@@ -144,7 +144,7 @@ struct Layout
desc
,
make_tuple
(
make_merge_transform
(
merge_elems
)),
lower_dims
,
upper_dims
);
}
// Merge nested shape dims
// Merge nested shape dims
. Merge nested shape dims when idx is also nested.
// Input desc shape: 2, 2, 2, 2, 2, 2
// Example idx: 1, 1, 1, 1
// Example shape: 2, (2, 2), 2, (2, 2)
...
...
@@ -205,10 +205,9 @@ struct Layout
static_assert
(
Tuple
<
ShapeDims
...
>::
Size
()
==
Tuple
<
IdxDims
...
>::
Size
(),
"Idx rank and Shape rank must be the same (except 1d)."
);
// Unroll while IdxDims is nested
const
auto
unroll
ed_shape
_via_idx
=
AlignShapeToIdx
(
shape
,
idx
);
const
auto
align
ed_shape
=
AlignShapeToIdx
(
shape
,
idx
);
// Transform correct form of shape
return
CreateMergedDescriptor
(
unrolled_shape_via_idx
,
UnrollNestedTuple
(
idx
),
descriptor_
);
return
CreateMergedDescriptor
(
aligned_shape
,
UnrollNestedTuple
(
idx
),
descriptor_
);
}
}
...
...
@@ -224,7 +223,7 @@ struct Layout
}
public:
// If stride not passed,
deduce
from GenerateColumnMajorPackedStrides
// If
the
stride
is
not passed,
you can infer it
from
`
GenerateColumnMajorPackedStrides
`.
using
DeducedStrides
=
std
::
conditional_t
<
is_same_v
<
Strides
,
Tuple
<>>
,
remove_cvref_t
<
decltype
(
GenerateColumnMajorPackedStrides
(
Shape
{}))
>
,
...
...
test/wrapper/test_layout.cpp
View file @
0dc0af2e
...
...
@@ -356,7 +356,7 @@ TEST(TestLayoutHelpers, SizeAndGet)
EXPECT_EQ
(
ck
::
wrapper
::
size
<
1
>
(
layout_runtime
),
d1
*
d0
);
EXPECT_EQ
(
ck
::
wrapper
::
size
<
1
>
(
layout_compiletime
),
d1
*
d0
);
// Acces
via
new layout (using get
on
layout)
// Acces
s through
new layout (using get
with
layout
object
)
EXPECT_EQ
(
ck
::
wrapper
::
size
<
0
>
(
ck
::
wrapper
::
get
<
0
>
(
layout_runtime
)),
d4
*
d3
);
EXPECT_EQ
(
ck
::
wrapper
::
size
<
0
>
(
ck
::
wrapper
::
get
<
0
>
(
layout_compiletime
)),
d4
*
d3
);
EXPECT_EQ
(
ck
::
wrapper
::
size
<
1
>
(
ck
::
wrapper
::
get
<
0
>
(
layout_runtime
)),
d2
);
...
...
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